@tiptap/static-renderer 3.21.0 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { NodeType, MarkType, ExtensionAttribute, Node, Mark as Mark$1, JSONContent, Extensions } from '@tiptap/core';
1
+ import { NodeType, MarkType, ExtensionAttribute, Mark, Node as Node$1, JSONContent, Extensions } from '@tiptap/core';
2
2
  import React from 'react';
3
- import { DOMOutputSpec, Mark, Node as Node$1 } from '@tiptap/pm/model';
3
+ import { DOMOutputSpec, Mark as Mark$1, Node } from '@tiptap/pm/model';
4
4
 
5
5
  /**
6
6
  * This function returns the attributes of a node or mark that are defined by the given extension attributes.
@@ -244,14 +244,14 @@ type DomOutputSpecToElement<T> = (content: DOMOutputSpec) => (children?: T | T[]
244
244
  * @param extensionAttributes All available extension attributes
245
245
  * @returns A tuple with the name of the extension and a React component that renders the extension
246
246
  */
247
- declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledNode'>>): [string, (props: NodeProps<Node$1, T | T[]>) => T];
247
+ declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledNode'>>): [string, (props: NodeProps<Node, T | T[]>) => T];
248
248
  /**
249
249
  * This takes a MarkExtension and maps it to a React component
250
250
  * @param extension The mark extension to map to a React component
251
251
  * @param extensionAttributes All available extension attributes
252
252
  * @returns A tuple with the name of the extension and a React component that renders the extension
253
253
  */
254
- declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledMark'>>): [string, (props: MarkProps<Mark, T | T[]>) => T];
254
+ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledMark'>>): [string, (props: MarkProps<Mark$1, T | T[]>) => T];
255
255
  /**
256
256
  * This function will statically render a Prosemirror Node to a target element type using the given extensions
257
257
  * @param renderer The renderer to use to render the Prosemirror Node to the target element type
@@ -263,17 +263,17 @@ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutpu
263
263
  * @returns The rendered target element type
264
264
  */
265
265
  declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefinedTypes, content, extensions, options, }: {
266
- renderer: (options: TiptapStaticRendererOptions<T, Mark, Node$1>) => (ctx: {
267
- content: Node$1;
266
+ renderer: (options: TiptapStaticRendererOptions<T, Mark$1, Node>) => (ctx: {
267
+ content: Node;
268
268
  }) => T;
269
269
  domOutputSpecToElement: DomOutputSpecToElement<T>;
270
270
  mapDefinedTypes: {
271
- doc: (props: NodeProps<Node$1, T | T[]>) => T;
272
- text: (props: NodeProps<Node$1, T | T[]>) => T;
271
+ doc: (props: NodeProps<Node, T | T[]>) => T;
272
+ text: (props: NodeProps<Node, T | T[]>) => T;
273
273
  };
274
- content: Node$1 | JSONContent;
274
+ content: Node | JSONContent;
275
275
  extensions: Extensions;
276
- options?: Partial<TiptapStaticRendererOptions<T, Mark, Node$1>>;
276
+ options?: Partial<TiptapStaticRendererOptions<T, Mark$1, Node>>;
277
277
  }): T;
278
278
 
279
279
  /**
@@ -290,9 +290,9 @@ declare function domOutputSpecToHTMLString(content: DOMOutputSpec): (children?:
290
290
  * @returns The rendered HTML string
291
291
  */
292
292
  declare function renderToHTMLString({ content, extensions, options, }: {
293
- content: Node$1 | JSONContent;
293
+ content: Node | JSONContent;
294
294
  extensions: Extensions;
295
- options?: Partial<TiptapStaticRendererOptions<string, Mark, Node$1>>;
295
+ options?: Partial<TiptapStaticRendererOptions<string, Mark$1, Node>>;
296
296
  }): string;
297
297
 
298
298
  /**
@@ -300,9 +300,9 @@ declare function renderToHTMLString({ content, extensions, options, }: {
300
300
  * This is a simple example of how we can render content to markdown. This is not a full implementation of a markdown renderer.
301
301
  */
302
302
  declare function renderToMarkdown({ content, extensions, options, }: {
303
- content: Node$1 | JSONContent;
303
+ content: Node | JSONContent;
304
304
  extensions: Extensions;
305
- options?: Partial<TiptapStaticRendererOptions<string, Mark, Node$1>>;
305
+ options?: Partial<TiptapStaticRendererOptions<string, Mark$1, Node>>;
306
306
  }): string;
307
307
 
308
308
  /**
@@ -326,9 +326,9 @@ declare function domOutputSpecToReactElement(content: DOMOutputSpec, key?: numbe
326
326
  * @returns The React element that represents the rendered content
327
327
  */
328
328
  declare function renderToReactElement({ content, extensions, options, }: {
329
- content: Node$1 | JSONContent;
329
+ content: Node | JSONContent;
330
330
  extensions: Extensions;
331
- options?: Partial<TiptapStaticRendererOptions<React.ReactNode, Mark, Node$1>>;
331
+ options?: Partial<TiptapStaticRendererOptions<React.ReactNode, Mark$1, Node>>;
332
332
  }): React.ReactNode;
333
333
 
334
334
  export { type DomOutputSpecToElement, type MarkProps, type NodeProps, TiptapStaticRenderer, type TiptapStaticRendererOptions, domOutputSpecToHTMLString, domOutputSpecToReactElement, getAttributes, getHTMLAttributes, mapAttrsToHTMLAttributes, mapMarkExtensionToReactNode, mapNodeExtensionToReactNode, renderJSONContentToReactElement, renderJSONContentToString, renderToElement, renderToHTMLString, renderToMarkdown, renderToReactElement, serializeAttrsToHTMLString, serializeChildrenToHTMLString };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { NodeType, MarkType, ExtensionAttribute, Node, Mark as Mark$1, JSONContent, Extensions } from '@tiptap/core';
1
+ import { NodeType, MarkType, ExtensionAttribute, Mark, Node as Node$1, JSONContent, Extensions } from '@tiptap/core';
2
2
  import React from 'react';
3
- import { DOMOutputSpec, Mark, Node as Node$1 } from '@tiptap/pm/model';
3
+ import { DOMOutputSpec, Mark as Mark$1, Node } from '@tiptap/pm/model';
4
4
 
5
5
  /**
6
6
  * This function returns the attributes of a node or mark that are defined by the given extension attributes.
@@ -244,14 +244,14 @@ type DomOutputSpecToElement<T> = (content: DOMOutputSpec) => (children?: T | T[]
244
244
  * @param extensionAttributes All available extension attributes
245
245
  * @returns A tuple with the name of the extension and a React component that renders the extension
246
246
  */
247
- declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledNode'>>): [string, (props: NodeProps<Node$1, T | T[]>) => T];
247
+ declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledNode'>>): [string, (props: NodeProps<Node, T | T[]>) => T];
248
248
  /**
249
249
  * This takes a MarkExtension and maps it to a React component
250
250
  * @param extension The mark extension to map to a React component
251
251
  * @param extensionAttributes All available extension attributes
252
252
  * @returns A tuple with the name of the extension and a React component that renders the extension
253
253
  */
254
- declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledMark'>>): [string, (props: MarkProps<Mark, T | T[]>) => T];
254
+ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledMark'>>): [string, (props: MarkProps<Mark$1, T | T[]>) => T];
255
255
  /**
256
256
  * This function will statically render a Prosemirror Node to a target element type using the given extensions
257
257
  * @param renderer The renderer to use to render the Prosemirror Node to the target element type
@@ -263,17 +263,17 @@ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutpu
263
263
  * @returns The rendered target element type
264
264
  */
265
265
  declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefinedTypes, content, extensions, options, }: {
266
- renderer: (options: TiptapStaticRendererOptions<T, Mark, Node$1>) => (ctx: {
267
- content: Node$1;
266
+ renderer: (options: TiptapStaticRendererOptions<T, Mark$1, Node>) => (ctx: {
267
+ content: Node;
268
268
  }) => T;
269
269
  domOutputSpecToElement: DomOutputSpecToElement<T>;
270
270
  mapDefinedTypes: {
271
- doc: (props: NodeProps<Node$1, T | T[]>) => T;
272
- text: (props: NodeProps<Node$1, T | T[]>) => T;
271
+ doc: (props: NodeProps<Node, T | T[]>) => T;
272
+ text: (props: NodeProps<Node, T | T[]>) => T;
273
273
  };
274
- content: Node$1 | JSONContent;
274
+ content: Node | JSONContent;
275
275
  extensions: Extensions;
276
- options?: Partial<TiptapStaticRendererOptions<T, Mark, Node$1>>;
276
+ options?: Partial<TiptapStaticRendererOptions<T, Mark$1, Node>>;
277
277
  }): T;
278
278
 
279
279
  /**
@@ -290,9 +290,9 @@ declare function domOutputSpecToHTMLString(content: DOMOutputSpec): (children?:
290
290
  * @returns The rendered HTML string
291
291
  */
292
292
  declare function renderToHTMLString({ content, extensions, options, }: {
293
- content: Node$1 | JSONContent;
293
+ content: Node | JSONContent;
294
294
  extensions: Extensions;
295
- options?: Partial<TiptapStaticRendererOptions<string, Mark, Node$1>>;
295
+ options?: Partial<TiptapStaticRendererOptions<string, Mark$1, Node>>;
296
296
  }): string;
297
297
 
298
298
  /**
@@ -300,9 +300,9 @@ declare function renderToHTMLString({ content, extensions, options, }: {
300
300
  * This is a simple example of how we can render content to markdown. This is not a full implementation of a markdown renderer.
301
301
  */
302
302
  declare function renderToMarkdown({ content, extensions, options, }: {
303
- content: Node$1 | JSONContent;
303
+ content: Node | JSONContent;
304
304
  extensions: Extensions;
305
- options?: Partial<TiptapStaticRendererOptions<string, Mark, Node$1>>;
305
+ options?: Partial<TiptapStaticRendererOptions<string, Mark$1, Node>>;
306
306
  }): string;
307
307
 
308
308
  /**
@@ -326,9 +326,9 @@ declare function domOutputSpecToReactElement(content: DOMOutputSpec, key?: numbe
326
326
  * @returns The React element that represents the rendered content
327
327
  */
328
328
  declare function renderToReactElement({ content, extensions, options, }: {
329
- content: Node$1 | JSONContent;
329
+ content: Node | JSONContent;
330
330
  extensions: Extensions;
331
- options?: Partial<TiptapStaticRendererOptions<React.ReactNode, Mark, Node$1>>;
331
+ options?: Partial<TiptapStaticRendererOptions<React.ReactNode, Mark$1, Node>>;
332
332
  }): React.ReactNode;
333
333
 
334
334
  export { type DomOutputSpecToElement, type MarkProps, type NodeProps, TiptapStaticRenderer, type TiptapStaticRendererOptions, domOutputSpecToHTMLString, domOutputSpecToReactElement, getAttributes, getHTMLAttributes, mapAttrsToHTMLAttributes, mapMarkExtensionToReactNode, mapNodeExtensionToReactNode, renderJSONContentToReactElement, renderJSONContentToString, renderToElement, renderToHTMLString, renderToMarkdown, renderToReactElement, serializeAttrsToHTMLString, serializeChildrenToHTMLString };
@@ -1,5 +1,5 @@
1
- import { MarkType, NodeType, Node, ExtensionAttribute, Mark as Mark$1, JSONContent, Extensions } from '@tiptap/core';
2
- import { DOMOutputSpec, Mark, Node as Node$1 } from '@tiptap/pm/model';
1
+ import { MarkType, NodeType, Mark, ExtensionAttribute, Node as Node$1, JSONContent, Extensions } from '@tiptap/core';
2
+ import { DOMOutputSpec, Mark as Mark$1, Node } from '@tiptap/pm/model';
3
3
 
4
4
  /**
5
5
  * Props for a node renderer
@@ -108,14 +108,14 @@ type DomOutputSpecToElement<T> = (content: DOMOutputSpec) => (children?: T | T[]
108
108
  * @param extensionAttributes All available extension attributes
109
109
  * @returns A tuple with the name of the extension and a React component that renders the extension
110
110
  */
111
- declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledNode'>>): [string, (props: NodeProps<Node$1, T | T[]>) => T];
111
+ declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledNode'>>): [string, (props: NodeProps<Node, T | T[]>) => T];
112
112
  /**
113
113
  * This takes a MarkExtension and maps it to a React component
114
114
  * @param extension The mark extension to map to a React component
115
115
  * @param extensionAttributes All available extension attributes
116
116
  * @returns A tuple with the name of the extension and a React component that renders the extension
117
117
  */
118
- declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledMark'>>): [string, (props: MarkProps<Mark, T | T[]>) => T];
118
+ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledMark'>>): [string, (props: MarkProps<Mark$1, T | T[]>) => T];
119
119
  /**
120
120
  * This function will statically render a Prosemirror Node to a target element type using the given extensions
121
121
  * @param renderer The renderer to use to render the Prosemirror Node to the target element type
@@ -127,17 +127,17 @@ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutpu
127
127
  * @returns The rendered target element type
128
128
  */
129
129
  declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefinedTypes, content, extensions, options, }: {
130
- renderer: (options: TiptapStaticRendererOptions<T, Mark, Node$1>) => (ctx: {
131
- content: Node$1;
130
+ renderer: (options: TiptapStaticRendererOptions<T, Mark$1, Node>) => (ctx: {
131
+ content: Node;
132
132
  }) => T;
133
133
  domOutputSpecToElement: DomOutputSpecToElement<T>;
134
134
  mapDefinedTypes: {
135
- doc: (props: NodeProps<Node$1, T | T[]>) => T;
136
- text: (props: NodeProps<Node$1, T | T[]>) => T;
135
+ doc: (props: NodeProps<Node, T | T[]>) => T;
136
+ text: (props: NodeProps<Node, T | T[]>) => T;
137
137
  };
138
- content: Node$1 | JSONContent;
138
+ content: Node | JSONContent;
139
139
  extensions: Extensions;
140
- options?: Partial<TiptapStaticRendererOptions<T, Mark, Node$1>>;
140
+ options?: Partial<TiptapStaticRendererOptions<T, Mark$1, Node>>;
141
141
  }): T;
142
142
 
143
143
  /**
@@ -167,9 +167,9 @@ declare function domOutputSpecToHTMLString(content: DOMOutputSpec): (children?:
167
167
  * @returns The rendered HTML string
168
168
  */
169
169
  declare function renderToHTMLString({ content, extensions, options, }: {
170
- content: Node$1 | JSONContent;
170
+ content: Node | JSONContent;
171
171
  extensions: Extensions;
172
- options?: Partial<TiptapStaticRendererOptions<string, Mark, Node$1>>;
172
+ options?: Partial<TiptapStaticRendererOptions<string, Mark$1, Node>>;
173
173
  }): string;
174
174
 
175
175
  export { type DomOutputSpecToElement, domOutputSpecToHTMLString, mapMarkExtensionToReactNode, mapNodeExtensionToReactNode, renderToElement, renderToHTMLString, serializeAttrsToHTMLString, serializeChildrenToHTMLString };
@@ -1,5 +1,5 @@
1
- import { MarkType, NodeType, Node, ExtensionAttribute, Mark as Mark$1, JSONContent, Extensions } from '@tiptap/core';
2
- import { DOMOutputSpec, Mark, Node as Node$1 } from '@tiptap/pm/model';
1
+ import { MarkType, NodeType, Mark, ExtensionAttribute, Node as Node$1, JSONContent, Extensions } from '@tiptap/core';
2
+ import { DOMOutputSpec, Mark as Mark$1, Node } from '@tiptap/pm/model';
3
3
 
4
4
  /**
5
5
  * Props for a node renderer
@@ -108,14 +108,14 @@ type DomOutputSpecToElement<T> = (content: DOMOutputSpec) => (children?: T | T[]
108
108
  * @param extensionAttributes All available extension attributes
109
109
  * @returns A tuple with the name of the extension and a React component that renders the extension
110
110
  */
111
- declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledNode'>>): [string, (props: NodeProps<Node$1, T | T[]>) => T];
111
+ declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledNode'>>): [string, (props: NodeProps<Node, T | T[]>) => T];
112
112
  /**
113
113
  * This takes a MarkExtension and maps it to a React component
114
114
  * @param extension The mark extension to map to a React component
115
115
  * @param extensionAttributes All available extension attributes
116
116
  * @returns A tuple with the name of the extension and a React component that renders the extension
117
117
  */
118
- declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledMark'>>): [string, (props: MarkProps<Mark, T | T[]>) => T];
118
+ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledMark'>>): [string, (props: MarkProps<Mark$1, T | T[]>) => T];
119
119
  /**
120
120
  * This function will statically render a Prosemirror Node to a target element type using the given extensions
121
121
  * @param renderer The renderer to use to render the Prosemirror Node to the target element type
@@ -127,17 +127,17 @@ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutpu
127
127
  * @returns The rendered target element type
128
128
  */
129
129
  declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefinedTypes, content, extensions, options, }: {
130
- renderer: (options: TiptapStaticRendererOptions<T, Mark, Node$1>) => (ctx: {
131
- content: Node$1;
130
+ renderer: (options: TiptapStaticRendererOptions<T, Mark$1, Node>) => (ctx: {
131
+ content: Node;
132
132
  }) => T;
133
133
  domOutputSpecToElement: DomOutputSpecToElement<T>;
134
134
  mapDefinedTypes: {
135
- doc: (props: NodeProps<Node$1, T | T[]>) => T;
136
- text: (props: NodeProps<Node$1, T | T[]>) => T;
135
+ doc: (props: NodeProps<Node, T | T[]>) => T;
136
+ text: (props: NodeProps<Node, T | T[]>) => T;
137
137
  };
138
- content: Node$1 | JSONContent;
138
+ content: Node | JSONContent;
139
139
  extensions: Extensions;
140
- options?: Partial<TiptapStaticRendererOptions<T, Mark, Node$1>>;
140
+ options?: Partial<TiptapStaticRendererOptions<T, Mark$1, Node>>;
141
141
  }): T;
142
142
 
143
143
  /**
@@ -167,9 +167,9 @@ declare function domOutputSpecToHTMLString(content: DOMOutputSpec): (children?:
167
167
  * @returns The rendered HTML string
168
168
  */
169
169
  declare function renderToHTMLString({ content, extensions, options, }: {
170
- content: Node$1 | JSONContent;
170
+ content: Node | JSONContent;
171
171
  extensions: Extensions;
172
- options?: Partial<TiptapStaticRendererOptions<string, Mark, Node$1>>;
172
+ options?: Partial<TiptapStaticRendererOptions<string, Mark$1, Node>>;
173
173
  }): string;
174
174
 
175
175
  export { type DomOutputSpecToElement, domOutputSpecToHTMLString, mapMarkExtensionToReactNode, mapNodeExtensionToReactNode, renderToElement, renderToHTMLString, serializeAttrsToHTMLString, serializeChildrenToHTMLString };
@@ -1,5 +1,5 @@
1
- import { MarkType, NodeType, Node, ExtensionAttribute, Mark as Mark$1, JSONContent, Extensions } from '@tiptap/core';
2
- import { DOMOutputSpec, Mark, Node as Node$1 } from '@tiptap/pm/model';
1
+ import { MarkType, NodeType, Mark, ExtensionAttribute, Node as Node$1, JSONContent, Extensions } from '@tiptap/core';
2
+ import { DOMOutputSpec, Mark as Mark$1, Node } from '@tiptap/pm/model';
3
3
 
4
4
  /**
5
5
  * Props for a node renderer
@@ -108,14 +108,14 @@ type DomOutputSpecToElement<T> = (content: DOMOutputSpec) => (children?: T | T[]
108
108
  * @param extensionAttributes All available extension attributes
109
109
  * @returns A tuple with the name of the extension and a React component that renders the extension
110
110
  */
111
- declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledNode'>>): [string, (props: NodeProps<Node$1, T | T[]>) => T];
111
+ declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledNode'>>): [string, (props: NodeProps<Node, T | T[]>) => T];
112
112
  /**
113
113
  * This takes a MarkExtension and maps it to a React component
114
114
  * @param extension The mark extension to map to a React component
115
115
  * @param extensionAttributes All available extension attributes
116
116
  * @returns A tuple with the name of the extension and a React component that renders the extension
117
117
  */
118
- declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledMark'>>): [string, (props: MarkProps<Mark, T | T[]>) => T];
118
+ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledMark'>>): [string, (props: MarkProps<Mark$1, T | T[]>) => T];
119
119
  /**
120
120
  * This function will statically render a Prosemirror Node to a target element type using the given extensions
121
121
  * @param renderer The renderer to use to render the Prosemirror Node to the target element type
@@ -127,17 +127,17 @@ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutpu
127
127
  * @returns The rendered target element type
128
128
  */
129
129
  declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefinedTypes, content, extensions, options, }: {
130
- renderer: (options: TiptapStaticRendererOptions<T, Mark, Node$1>) => (ctx: {
131
- content: Node$1;
130
+ renderer: (options: TiptapStaticRendererOptions<T, Mark$1, Node>) => (ctx: {
131
+ content: Node;
132
132
  }) => T;
133
133
  domOutputSpecToElement: DomOutputSpecToElement<T>;
134
134
  mapDefinedTypes: {
135
- doc: (props: NodeProps<Node$1, T | T[]>) => T;
136
- text: (props: NodeProps<Node$1, T | T[]>) => T;
135
+ doc: (props: NodeProps<Node, T | T[]>) => T;
136
+ text: (props: NodeProps<Node, T | T[]>) => T;
137
137
  };
138
- content: Node$1 | JSONContent;
138
+ content: Node | JSONContent;
139
139
  extensions: Extensions;
140
- options?: Partial<TiptapStaticRendererOptions<T, Mark, Node$1>>;
140
+ options?: Partial<TiptapStaticRendererOptions<T, Mark$1, Node>>;
141
141
  }): T;
142
142
 
143
143
  /**
@@ -145,9 +145,9 @@ declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefin
145
145
  * This is a simple example of how we can render content to markdown. This is not a full implementation of a markdown renderer.
146
146
  */
147
147
  declare function renderToMarkdown({ content, extensions, options, }: {
148
- content: Node$1 | JSONContent;
148
+ content: Node | JSONContent;
149
149
  extensions: Extensions;
150
- options?: Partial<TiptapStaticRendererOptions<string, Mark, Node$1>>;
150
+ options?: Partial<TiptapStaticRendererOptions<string, Mark$1, Node>>;
151
151
  }): string;
152
152
 
153
153
  export { type DomOutputSpecToElement, mapMarkExtensionToReactNode, mapNodeExtensionToReactNode, renderToElement, renderToMarkdown };
@@ -1,5 +1,5 @@
1
- import { MarkType, NodeType, Node, ExtensionAttribute, Mark as Mark$1, JSONContent, Extensions } from '@tiptap/core';
2
- import { DOMOutputSpec, Mark, Node as Node$1 } from '@tiptap/pm/model';
1
+ import { MarkType, NodeType, Mark, ExtensionAttribute, Node as Node$1, JSONContent, Extensions } from '@tiptap/core';
2
+ import { DOMOutputSpec, Mark as Mark$1, Node } from '@tiptap/pm/model';
3
3
 
4
4
  /**
5
5
  * Props for a node renderer
@@ -108,14 +108,14 @@ type DomOutputSpecToElement<T> = (content: DOMOutputSpec) => (children?: T | T[]
108
108
  * @param extensionAttributes All available extension attributes
109
109
  * @returns A tuple with the name of the extension and a React component that renders the extension
110
110
  */
111
- declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledNode'>>): [string, (props: NodeProps<Node$1, T | T[]>) => T];
111
+ declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledNode'>>): [string, (props: NodeProps<Node, T | T[]>) => T];
112
112
  /**
113
113
  * This takes a MarkExtension and maps it to a React component
114
114
  * @param extension The mark extension to map to a React component
115
115
  * @param extensionAttributes All available extension attributes
116
116
  * @returns A tuple with the name of the extension and a React component that renders the extension
117
117
  */
118
- declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledMark'>>): [string, (props: MarkProps<Mark, T | T[]>) => T];
118
+ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledMark'>>): [string, (props: MarkProps<Mark$1, T | T[]>) => T];
119
119
  /**
120
120
  * This function will statically render a Prosemirror Node to a target element type using the given extensions
121
121
  * @param renderer The renderer to use to render the Prosemirror Node to the target element type
@@ -127,17 +127,17 @@ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutpu
127
127
  * @returns The rendered target element type
128
128
  */
129
129
  declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefinedTypes, content, extensions, options, }: {
130
- renderer: (options: TiptapStaticRendererOptions<T, Mark, Node$1>) => (ctx: {
131
- content: Node$1;
130
+ renderer: (options: TiptapStaticRendererOptions<T, Mark$1, Node>) => (ctx: {
131
+ content: Node;
132
132
  }) => T;
133
133
  domOutputSpecToElement: DomOutputSpecToElement<T>;
134
134
  mapDefinedTypes: {
135
- doc: (props: NodeProps<Node$1, T | T[]>) => T;
136
- text: (props: NodeProps<Node$1, T | T[]>) => T;
135
+ doc: (props: NodeProps<Node, T | T[]>) => T;
136
+ text: (props: NodeProps<Node, T | T[]>) => T;
137
137
  };
138
- content: Node$1 | JSONContent;
138
+ content: Node | JSONContent;
139
139
  extensions: Extensions;
140
- options?: Partial<TiptapStaticRendererOptions<T, Mark, Node$1>>;
140
+ options?: Partial<TiptapStaticRendererOptions<T, Mark$1, Node>>;
141
141
  }): T;
142
142
 
143
143
  /**
@@ -145,9 +145,9 @@ declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefin
145
145
  * This is a simple example of how we can render content to markdown. This is not a full implementation of a markdown renderer.
146
146
  */
147
147
  declare function renderToMarkdown({ content, extensions, options, }: {
148
- content: Node$1 | JSONContent;
148
+ content: Node | JSONContent;
149
149
  extensions: Extensions;
150
- options?: Partial<TiptapStaticRendererOptions<string, Mark, Node$1>>;
150
+ options?: Partial<TiptapStaticRendererOptions<string, Mark$1, Node>>;
151
151
  }): string;
152
152
 
153
153
  export { type DomOutputSpecToElement, mapMarkExtensionToReactNode, mapNodeExtensionToReactNode, renderToElement, renderToMarkdown };
@@ -1,5 +1,5 @@
1
- import { MarkType, NodeType, Node, ExtensionAttribute, Mark as Mark$1, JSONContent, Extensions } from '@tiptap/core';
2
- import { DOMOutputSpec, Mark, Node as Node$1 } from '@tiptap/pm/model';
1
+ import { MarkType, NodeType, Mark, ExtensionAttribute, Node as Node$1, JSONContent, Extensions } from '@tiptap/core';
2
+ import { DOMOutputSpec, Mark as Mark$1, Node } from '@tiptap/pm/model';
3
3
  import React from 'react';
4
4
 
5
5
  /**
@@ -109,14 +109,14 @@ type DomOutputSpecToElement<T> = (content: DOMOutputSpec) => (children?: T | T[]
109
109
  * @param extensionAttributes All available extension attributes
110
110
  * @returns A tuple with the name of the extension and a React component that renders the extension
111
111
  */
112
- declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledNode'>>): [string, (props: NodeProps<Node$1, T | T[]>) => T];
112
+ declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledNode'>>): [string, (props: NodeProps<Node, T | T[]>) => T];
113
113
  /**
114
114
  * This takes a MarkExtension and maps it to a React component
115
115
  * @param extension The mark extension to map to a React component
116
116
  * @param extensionAttributes All available extension attributes
117
117
  * @returns A tuple with the name of the extension and a React component that renders the extension
118
118
  */
119
- declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledMark'>>): [string, (props: MarkProps<Mark, T | T[]>) => T];
119
+ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledMark'>>): [string, (props: MarkProps<Mark$1, T | T[]>) => T];
120
120
  /**
121
121
  * This function will statically render a Prosemirror Node to a target element type using the given extensions
122
122
  * @param renderer The renderer to use to render the Prosemirror Node to the target element type
@@ -128,17 +128,17 @@ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutpu
128
128
  * @returns The rendered target element type
129
129
  */
130
130
  declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefinedTypes, content, extensions, options, }: {
131
- renderer: (options: TiptapStaticRendererOptions<T, Mark, Node$1>) => (ctx: {
132
- content: Node$1;
131
+ renderer: (options: TiptapStaticRendererOptions<T, Mark$1, Node>) => (ctx: {
132
+ content: Node;
133
133
  }) => T;
134
134
  domOutputSpecToElement: DomOutputSpecToElement<T>;
135
135
  mapDefinedTypes: {
136
- doc: (props: NodeProps<Node$1, T | T[]>) => T;
137
- text: (props: NodeProps<Node$1, T | T[]>) => T;
136
+ doc: (props: NodeProps<Node, T | T[]>) => T;
137
+ text: (props: NodeProps<Node, T | T[]>) => T;
138
138
  };
139
- content: Node$1 | JSONContent;
139
+ content: Node | JSONContent;
140
140
  extensions: Extensions;
141
- options?: Partial<TiptapStaticRendererOptions<T, Mark, Node$1>>;
141
+ options?: Partial<TiptapStaticRendererOptions<T, Mark$1, Node>>;
142
142
  }): T;
143
143
 
144
144
  /**
@@ -162,9 +162,9 @@ declare function domOutputSpecToReactElement(content: DOMOutputSpec, key?: numbe
162
162
  * @returns The React element that represents the rendered content
163
163
  */
164
164
  declare function renderToReactElement({ content, extensions, options, }: {
165
- content: Node$1 | JSONContent;
165
+ content: Node | JSONContent;
166
166
  extensions: Extensions;
167
- options?: Partial<TiptapStaticRendererOptions<React.ReactNode, Mark, Node$1>>;
167
+ options?: Partial<TiptapStaticRendererOptions<React.ReactNode, Mark$1, Node>>;
168
168
  }): React.ReactNode;
169
169
 
170
170
  export { type DomOutputSpecToElement, domOutputSpecToReactElement, mapAttrsToHTMLAttributes, mapMarkExtensionToReactNode, mapNodeExtensionToReactNode, renderToElement, renderToReactElement };
@@ -1,5 +1,5 @@
1
- import { MarkType, NodeType, Node, ExtensionAttribute, Mark as Mark$1, JSONContent, Extensions } from '@tiptap/core';
2
- import { DOMOutputSpec, Mark, Node as Node$1 } from '@tiptap/pm/model';
1
+ import { MarkType, NodeType, Mark, ExtensionAttribute, Node as Node$1, JSONContent, Extensions } from '@tiptap/core';
2
+ import { DOMOutputSpec, Mark as Mark$1, Node } from '@tiptap/pm/model';
3
3
  import React from 'react';
4
4
 
5
5
  /**
@@ -109,14 +109,14 @@ type DomOutputSpecToElement<T> = (content: DOMOutputSpec) => (children?: T | T[]
109
109
  * @param extensionAttributes All available extension attributes
110
110
  * @returns A tuple with the name of the extension and a React component that renders the extension
111
111
  */
112
- declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledNode'>>): [string, (props: NodeProps<Node$1, T | T[]>) => T];
112
+ declare function mapNodeExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Node$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledNode'>>): [string, (props: NodeProps<Node, T | T[]>) => T];
113
113
  /**
114
114
  * This takes a MarkExtension and maps it to a React component
115
115
  * @param extension The mark extension to map to a React component
116
116
  * @param extensionAttributes All available extension attributes
117
117
  * @returns A tuple with the name of the extension and a React component that renders the extension
118
118
  */
119
- declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark$1, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark, Node$1>, 'unhandledMark'>>): [string, (props: MarkProps<Mark, T | T[]>) => T];
119
+ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutputSpecToElement<T>, extension: Mark, extensionAttributes: ExtensionAttribute[], options?: Partial<Pick<TiptapStaticRendererOptions<T, Mark$1, Node>, 'unhandledMark'>>): [string, (props: MarkProps<Mark$1, T | T[]>) => T];
120
120
  /**
121
121
  * This function will statically render a Prosemirror Node to a target element type using the given extensions
122
122
  * @param renderer The renderer to use to render the Prosemirror Node to the target element type
@@ -128,17 +128,17 @@ declare function mapMarkExtensionToReactNode<T>(domOutputSpecToElement: DomOutpu
128
128
  * @returns The rendered target element type
129
129
  */
130
130
  declare function renderToElement<T>({ renderer, domOutputSpecToElement, mapDefinedTypes, content, extensions, options, }: {
131
- renderer: (options: TiptapStaticRendererOptions<T, Mark, Node$1>) => (ctx: {
132
- content: Node$1;
131
+ renderer: (options: TiptapStaticRendererOptions<T, Mark$1, Node>) => (ctx: {
132
+ content: Node;
133
133
  }) => T;
134
134
  domOutputSpecToElement: DomOutputSpecToElement<T>;
135
135
  mapDefinedTypes: {
136
- doc: (props: NodeProps<Node$1, T | T[]>) => T;
137
- text: (props: NodeProps<Node$1, T | T[]>) => T;
136
+ doc: (props: NodeProps<Node, T | T[]>) => T;
137
+ text: (props: NodeProps<Node, T | T[]>) => T;
138
138
  };
139
- content: Node$1 | JSONContent;
139
+ content: Node | JSONContent;
140
140
  extensions: Extensions;
141
- options?: Partial<TiptapStaticRendererOptions<T, Mark, Node$1>>;
141
+ options?: Partial<TiptapStaticRendererOptions<T, Mark$1, Node>>;
142
142
  }): T;
143
143
 
144
144
  /**
@@ -162,9 +162,9 @@ declare function domOutputSpecToReactElement(content: DOMOutputSpec, key?: numbe
162
162
  * @returns The React element that represents the rendered content
163
163
  */
164
164
  declare function renderToReactElement({ content, extensions, options, }: {
165
- content: Node$1 | JSONContent;
165
+ content: Node | JSONContent;
166
166
  extensions: Extensions;
167
- options?: Partial<TiptapStaticRendererOptions<React.ReactNode, Mark, Node$1>>;
167
+ options?: Partial<TiptapStaticRendererOptions<React.ReactNode, Mark$1, Node>>;
168
168
  }): React.ReactNode;
169
169
 
170
170
  export { type DomOutputSpecToElement, domOutputSpecToReactElement, mapAttrsToHTMLAttributes, mapMarkExtensionToReactNode, mapNodeExtensionToReactNode, renderToElement, renderToReactElement };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/static-renderer",
3
3
  "description": "statically render Tiptap JSON",
4
- "version": "3.21.0",
4
+ "version": "3.22.0",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -76,14 +76,14 @@
76
76
  "@types/react-dom": "^19.0.0",
77
77
  "react": "^19.0.0",
78
78
  "react-dom": "^19.0.0",
79
- "@tiptap/core": "^3.21.0",
80
- "@tiptap/pm": "^3.21.0"
79
+ "@tiptap/core": "^3.22.0",
80
+ "@tiptap/pm": "^3.22.0"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
84
84
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
85
- "@tiptap/core": "^3.21.0",
86
- "@tiptap/pm": "^3.21.0"
85
+ "@tiptap/core": "^3.22.0",
86
+ "@tiptap/pm": "^3.22.0"
87
87
  },
88
88
  "repository": {
89
89
  "type": "git",