@prismicio/editor-fields 0.1.0-rc.3 → 0.1.0-rc.4

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.
Files changed (88) hide show
  1. package/dist/domain/Field.d.ts +4 -4
  2. package/dist/domain/Group.d.ts +4 -4
  3. package/dist/domain/__tests__/Document.test.d.ts +1 -0
  4. package/dist/domain/zones/RepeatableZone.d.ts +2 -3
  5. package/dist/fields/BooleanField.d.ts +12 -0
  6. package/dist/fields/NestableField.d.ts +12 -0
  7. package/dist/fields/NumberField.d.ts +12 -0
  8. package/dist/fields/RichTextField/MenuBar/MenuBar.d.ts +9 -0
  9. package/dist/fields/RichTextField/MenuBar/MenuItem.d.ts +10 -0
  10. package/dist/fields/RichTextField/MenuBar/index.d.ts +2 -0
  11. package/dist/fields/RichTextField/core-extensions/Document.d.ts +3 -0
  12. package/dist/fields/RichTextField/core-extensions/HardBreak.d.ts +11 -0
  13. package/dist/fields/RichTextField/core-extensions/ListItem.d.ts +44 -0
  14. package/dist/fields/RichTextField/core-extensions/Text.d.ts +15 -0
  15. package/dist/fields/RichTextField/core-extensions/index.d.ts +95 -0
  16. package/dist/fields/RichTextField/coreExtensions/HardBreak.d.ts +1 -1
  17. package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +2 -2
  18. package/dist/fields/RichTextField/coreExtensions/Text.d.ts +2 -2
  19. package/dist/fields/RichTextField/coreExtensions/index.d.ts +1 -1
  20. package/dist/fields/RichTextField/extensions/Heading.d.ts +3 -3
  21. package/dist/fields/RichTextField/extensions/index.d.ts +1 -1
  22. package/dist/fields/RichTextField/global-extensions/TextDirection.d.ts +38 -0
  23. package/dist/fields/RichTextField/global-extensions/index.d.ts +3 -0
  24. package/dist/fields/RichTextField/globalExtensions/TextDirection.d.ts +2 -2
  25. package/dist/fields/RichTextField/models/Block.d.ts +5 -0
  26. package/dist/fields/RichTextField/models/EditorExtension.d.ts +8 -8
  27. package/dist/fields/RichTextField/models/Span.d.ts +3 -3
  28. package/dist/fields/RichTextField/models/helpers/Arrays.d.ts +1 -0
  29. package/dist/fields/RichTextField/models/helpers/DOMParser.d.ts +1 -0
  30. package/dist/fields/RichTextField/models/helpers/NodeUtils.d.ts +2 -2
  31. package/dist/fields/RichTextField/models/helpers/Objects.d.ts +3 -0
  32. package/dist/fields/index.d.ts +182 -0
  33. package/dist/fields/nestable/BooleanField.d.ts +12 -0
  34. package/dist/fields/nestable/ColorField.d.ts +11 -0
  35. package/dist/fields/nestable/DateField.d.ts +12 -0
  36. package/dist/fields/nestable/Field.d.ts +40 -0
  37. package/dist/fields/nestable/GeoField.d.ts +16 -0
  38. package/dist/fields/nestable/ImageField/ImageEditor.d.ts +11 -0
  39. package/dist/fields/nestable/ImageField/ImageField.d.ts +70 -0
  40. package/dist/fields/nestable/ImageField/ImageSelector.d.ts +5 -0
  41. package/dist/fields/nestable/ImageField/config.d.ts +1 -0
  42. package/dist/fields/nestable/ImageField/models/EditImage.d.ts +27 -0
  43. package/dist/fields/nestable/ImageField/models/ExternalImage.d.ts +32 -0
  44. package/dist/fields/nestable/ImageField/models/providers/UnsplashProvider.d.ts +6 -0
  45. package/dist/fields/nestable/KeyTextField.d.ts +12 -0
  46. package/dist/fields/nestable/NumberField.d.ts +14 -0
  47. package/dist/fields/nestable/RangeField.d.ts +14 -0
  48. package/dist/fields/nestable/RichTextField/MenuBar/MenuBar.d.ts +9 -0
  49. package/dist/fields/nestable/RichTextField/MenuBar/MenuItem.d.ts +10 -0
  50. package/dist/fields/nestable/RichTextField/MenuBar/index.d.ts +2 -0
  51. package/dist/fields/nestable/RichTextField/RichTextField.d.ts +21 -0
  52. package/dist/fields/nestable/RichTextField/coreExtensions/Document.d.ts +3 -0
  53. package/dist/fields/nestable/RichTextField/coreExtensions/HardBreak.d.ts +12 -0
  54. package/dist/fields/nestable/RichTextField/coreExtensions/ListItem.d.ts +43 -0
  55. package/dist/fields/nestable/RichTextField/coreExtensions/Text.d.ts +15 -0
  56. package/dist/fields/nestable/RichTextField/coreExtensions/index.d.ts +8 -0
  57. package/dist/fields/nestable/RichTextField/extensions/Bold.d.ts +3 -0
  58. package/dist/fields/nestable/RichTextField/extensions/BulletList.d.ts +3 -0
  59. package/dist/fields/nestable/RichTextField/extensions/CodeBlock.d.ts +3 -0
  60. package/dist/fields/nestable/RichTextField/extensions/Embed/EmbedView.d.ts +3 -0
  61. package/dist/fields/nestable/RichTextField/extensions/Embed/index.d.ts +10 -0
  62. package/dist/fields/nestable/RichTextField/extensions/Heading.d.ts +18 -0
  63. package/dist/fields/nestable/RichTextField/extensions/Italic.d.ts +3 -0
  64. package/dist/fields/nestable/RichTextField/extensions/Link.d.ts +4 -0
  65. package/dist/fields/nestable/RichTextField/extensions/OrderedList.d.ts +3 -0
  66. package/dist/fields/nestable/RichTextField/extensions/Paragraph.d.ts +3 -0
  67. package/dist/fields/nestable/RichTextField/extensions/index.d.ts +14 -0
  68. package/dist/fields/nestable/RichTextField/globalExtensions/TextDirection.d.ts +39 -0
  69. package/dist/fields/nestable/RichTextField/globalExtensions/index.d.ts +1 -0
  70. package/dist/fields/nestable/RichTextField/index.d.ts +1 -0
  71. package/dist/fields/nestable/RichTextField/models/EditorExtension.d.ts +105 -0
  72. package/dist/fields/nestable/RichTextField/models/RichTextConfig.d.ts +10 -0
  73. package/dist/fields/nestable/RichTextField/models/Span.d.ts +12 -0
  74. package/dist/fields/nestable/RichTextField/models/helpers/DOMParser.d.ts +1 -0
  75. package/dist/fields/nestable/RichTextField/models/helpers/NodeUtils.d.ts +14 -0
  76. package/dist/fields/nestable/RichTextField/models/helpers/index.d.ts +2 -0
  77. package/dist/fields/nestable/RichTextField/models/index.d.ts +3 -0
  78. package/dist/fields/nestable/SelectField.d.ts +13 -0
  79. package/dist/fields/nestable/SeparatorField.d.ts +9 -0
  80. package/dist/fields/nestable/TimestampField.d.ts +12 -0
  81. package/dist/fields/nestable/index.d.ts +182 -0
  82. package/dist/index.es.js +31883 -42345
  83. package/dist/index.umd.js +65 -39
  84. package/dist/style.css +1 -0
  85. package/dist/utils/HttpClient.d.ts +18 -0
  86. package/dist/utils/useDebounceState.d.ts +1 -0
  87. package/dist/zones/RepeatableZoneEditor.d.ts +5 -3
  88. package/package.json +46 -44
@@ -1,5 +1,5 @@
1
+ import { Group } from "@prismicio/types-internal/lib/customtypes/widgets";
1
2
  import type { BooleanField, NestableWidget, Separator } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
2
- declare type Field = Exclude<NestableWidget, Separator>;
3
- export declare function getFieldLabel(field: Field | Separator): string;
4
- export declare function getFieldPlaceholder(field: Exclude<Field, BooleanField>): string;
5
- export {};
3
+ export declare function getFieldLabel(field: NestableWidget | Group): string;
4
+ export declare function getFieldPlaceholder(field: Exclude<NestableWidget, Separator | BooleanField>): string;
5
+ export declare function getFieldPlaceholder(field: BooleanField, value: boolean): string;
@@ -1,6 +1,6 @@
1
1
  import type { Group } from "@prismicio/types-internal/lib/customtypes/widgets";
2
- import type { GroupContent } from "@prismicio/types-internal/lib/documents/widgets";
3
- import type { RepeatableZone, RepeatableZoneContent } from "./zones/RepeatableZone";
4
- export declare function getGroupLabel(group: Group): string;
2
+ import { GroupContent, GroupItemContent } from "@prismicio/types-internal/lib/documents/widgets";
3
+ import type { RepeatableZone } from "./zones/RepeatableZone";
5
4
  export declare function getRepeatableZone(group: Group): RepeatableZone;
6
- export declare function updateRepeatableZoneContent(groupContent: GroupContent | undefined, repeatableZoneContent: RepeatableZoneContent): GroupContent;
5
+ export declare function updateRepeatableZoneContent(groupContent: GroupContent | undefined, repeatableZoneContent: GroupItemContent[]): GroupContent;
6
+ export declare const emptyGroupItemContent: () => GroupItemContent;
@@ -0,0 +1 @@
1
+ export {};
@@ -2,7 +2,6 @@ import type { NestableWidget } from "@prismicio/types-internal/lib/customtypes/w
2
2
  import type { GroupItemContent, SimpleWidgetContent } from "@prismicio/types-internal/lib/documents/widgets";
3
3
  import type { NestableWidgetContent } from "../NestableWidget";
4
4
  export declare type RepeatableZone = Readonly<Partial<Record<string, NestableWidget>>>;
5
- export declare type RepeatableZoneContent = GroupItemContent[];
6
- export declare function defaultRepeatableZoneContentIfUndefined(repeatableZoneContent: RepeatableZoneContent | undefined): RepeatableZoneContent;
5
+ export declare function defaultRepeatableZoneContentIfUndefined(repeatableZoneContent: GroupItemContent[] | undefined): GroupItemContent[];
7
6
  export declare function getGroupItemContentValue(groupItemContent: GroupItemContent): Readonly<Partial<Record<string, SimpleWidgetContent>>>;
8
- export declare function updateRepeatableWidgetContent(repeatableZoneContent: RepeatableZoneContent, groupItemContentIndex: number, repeatableWidgetIndex: number, repeatableWidgetId: string, repeatableWidgetContent: NestableWidgetContent | undefined): RepeatableZoneContent;
7
+ export declare function updateRepeatableWidgetContent(repeatableZoneContent: GroupItemContent[], groupItemContentIndex: number, repeatableWidgetIndex: number, repeatableWidgetId: string, repeatableWidgetContent: NestableWidgetContent | undefined): GroupItemContent[];
@@ -0,0 +1,12 @@
1
+ import type { BooleanField as BooleanT } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
2
+ import type { BooleanContent } from "@prismicio/types-internal/lib/documents/widgets/nestable";
3
+ import type { FC } from "react";
4
+ declare type BooleanFieldProps = Readonly<{
5
+ content: BooleanContent | undefined;
6
+ field: BooleanT;
7
+ id: string;
8
+ onContentChange: (content: BooleanContent) => void;
9
+ readOnly: boolean;
10
+ }>;
11
+ export declare const BooleanField: FC<BooleanFieldProps>;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { NestableWidget } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
2
+ import type { FC } from "react";
3
+ import type { NestableWidgetContent } from "../domain/NestableWidget";
4
+ declare type NestableFieldProps = Readonly<{
5
+ content: NestableWidgetContent | undefined;
6
+ id: string;
7
+ nestableWidget: NestableWidget;
8
+ onContentChange: (content: NestableWidgetContent | undefined) => void;
9
+ readOnly: boolean;
10
+ }>;
11
+ export declare const NestableField: FC<NestableFieldProps>;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { Number as NumberT } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
2
+ import type { FieldContent as NumberContent } from "@prismicio/types-internal/lib/documents/widgets/nestable";
3
+ import type { FC } from "react";
4
+ declare type NumberFieldProps = Readonly<{
5
+ content: NumberContent | undefined;
6
+ field: NumberT;
7
+ id: string;
8
+ onContentChange: (content: NumberContent | undefined) => void;
9
+ readOnly: boolean;
10
+ }>;
11
+ export declare const NumberField: FC<NumberFieldProps>;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ import "./MenuBar.css";
2
+ import type { Editor } from "@tiptap/react";
3
+ import { type FC } from "react";
4
+ declare type MenuBarProps = Readonly<{
5
+ editor: Editor;
6
+ extensions: ReadonlyArray<string>;
7
+ }>;
8
+ declare const MenuBar: FC<MenuBarProps>;
9
+ export default MenuBar;
@@ -0,0 +1,10 @@
1
+ import "./MenuItem.css";
2
+ import type { FC } from "react";
3
+ export declare type MenuItemProps = Readonly<{
4
+ action: () => boolean;
5
+ icon: string;
6
+ isActive?: () => boolean;
7
+ title: string;
8
+ }>;
9
+ declare const MenuItem: FC<MenuItemProps>;
10
+ export default MenuItem;
@@ -0,0 +1,2 @@
1
+ import MenuBar from "./MenuBar";
2
+ export default MenuBar;
@@ -0,0 +1,3 @@
1
+ import { DocumentExtension } from "../models";
2
+ declare const EditorDocument: DocumentExtension;
3
+ export default EditorDocument;
@@ -0,0 +1,11 @@
1
+ import type { Node as ProsemirrorNode, Schema } from "prosemirror-model";
2
+ export declare const HARD_BREAK_STR = "\n";
3
+ declare const EditorHardBreak: {
4
+ name: string;
5
+ Component: import("@tiptap/core").Node<import("@tiptap/extension-hard-break").HardBreakOptions, any>;
6
+ Converter: {
7
+ fromPrismic(schema: Schema): (text: string) => ProsemirrorNode | undefined;
8
+ toPrismic(node: ProsemirrorNode): string | undefined;
9
+ };
10
+ };
11
+ export default EditorHardBreak;
@@ -0,0 +1,44 @@
1
+ import type { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
2
+ import type { ReadonlyNonEmptyArray } from "fp-ts/lib/ReadonlyNonEmptyArray";
3
+ import type { Node as ProsemirrorNode, Schema } from "prosemirror-model";
4
+ declare const _default: {
5
+ Component: import("@tiptap/core").Node<import("@tiptap/extension-list-item").ListItemOptions, any>;
6
+ Converter: {
7
+ fromPrismic(schema: Schema<any, any>): (list: {
8
+ type: RichTextNodeType;
9
+ content: {
10
+ text: string;
11
+ } & {
12
+ spans?: ({
13
+ data?: unknown;
14
+ } & {
15
+ start: number;
16
+ end: number;
17
+ type: RichTextNodeType;
18
+ })[];
19
+ };
20
+ } & {
21
+ label?: string;
22
+ direction?: string;
23
+ }) => ProsemirrorNode<any> | undefined;
24
+ toPrismic(node: ProsemirrorNode<any>, nodeType: RichTextNodeType.list | RichTextNodeType.orderedList): readonly ({
25
+ type: RichTextNodeType;
26
+ content: {
27
+ text: string;
28
+ } & {
29
+ spans?: ({
30
+ data?: unknown;
31
+ } & {
32
+ start: number;
33
+ end: number;
34
+ type: RichTextNodeType;
35
+ })[];
36
+ };
37
+ } & {
38
+ label?: string;
39
+ direction?: string;
40
+ })[];
41
+ };
42
+ };
43
+ export default _default;
44
+ export declare function mergeLists(lists: ReadonlyNonEmptyArray<ProsemirrorNode>): ProsemirrorNode | undefined;
@@ -0,0 +1,15 @@
1
+ import type { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
2
+ import type { TextBlock } from "@prismicio/types-internal/lib/documents/widgets/nestable/StructuredTextContent/Block";
3
+ import type { Node as ProsemirrorNode, Schema } from "prosemirror-model";
4
+ import type { Direction } from "../global-extensions/TextDirection";
5
+ declare const EditorText: {
6
+ name: string;
7
+ Component: import("@tiptap/core").Node<any, any>;
8
+ Converter: {
9
+ fromPrismic(schema: Schema): (extensionName: string, textBlock: TextBlock, preventHardbreaks?: boolean) => Array<ProsemirrorNode>;
10
+ toPrismic(node: ProsemirrorNode, nodeType: RichTextNodeType, attributes?: {
11
+ direction?: Direction;
12
+ } | undefined): TextBlock;
13
+ };
14
+ };
15
+ export default EditorText;
@@ -0,0 +1,95 @@
1
+ import D from "./Document";
2
+ import HB from "./HardBreak";
3
+ import LI from "./ListItem";
4
+ import T from "./Text";
5
+ export declare const Document: import("../models").DocumentExtension;
6
+ export declare const HardBreak: {
7
+ name: string;
8
+ Component: import("@tiptap/core").Node<import("@tiptap/extension-hard-break").HardBreakOptions, any>;
9
+ Converter: {
10
+ fromPrismic(schema: import("prosemirror-model").Schema<any, any>): (text: string) => import("prosemirror-model").Node<any> | undefined;
11
+ toPrismic(node: import("prosemirror-model").Node<any>): string | undefined;
12
+ };
13
+ };
14
+ export declare const Text: {
15
+ name: string;
16
+ Component: import("@tiptap/core").Node<any, any>;
17
+ Converter: {
18
+ fromPrismic(schema: import("prosemirror-model").Schema<any, any>): (extensionName: string, textBlock: {
19
+ type: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType;
20
+ content: {
21
+ text: string;
22
+ } & {
23
+ spans?: ({
24
+ data?: unknown;
25
+ } & {
26
+ start: number;
27
+ end: number;
28
+ type: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType;
29
+ })[];
30
+ };
31
+ } & {
32
+ label?: string;
33
+ direction?: string;
34
+ }, preventHardbreaks?: boolean) => import("prosemirror-model").Node<any>[];
35
+ toPrismic(node: import("prosemirror-model").Node<any>, nodeType: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType, attributes?: {
36
+ direction?: import("../global-extensions/TextDirection").Direction;
37
+ } | undefined): {
38
+ type: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType;
39
+ content: {
40
+ text: string;
41
+ } & {
42
+ spans?: ({
43
+ data?: unknown;
44
+ } & {
45
+ start: number;
46
+ end: number;
47
+ type: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType;
48
+ })[];
49
+ };
50
+ } & {
51
+ label?: string;
52
+ direction?: string;
53
+ };
54
+ };
55
+ };
56
+ export declare const ListItem: {
57
+ Component: import("@tiptap/core").Node<import("@tiptap/extension-list-item").ListItemOptions, any>;
58
+ Converter: {
59
+ fromPrismic(schema: import("prosemirror-model").Schema<any, any>): (list: {
60
+ type: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType;
61
+ content: {
62
+ text: string;
63
+ } & {
64
+ spans?: ({
65
+ data?: unknown;
66
+ } & {
67
+ start: number;
68
+ end: number;
69
+ type: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType;
70
+ })[];
71
+ };
72
+ } & {
73
+ label?: string;
74
+ direction?: string;
75
+ }) => import("prosemirror-model").Node<any> | undefined;
76
+ toPrismic(node: import("prosemirror-model").Node<any>, nodeType: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType.list | import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType.orderedList): readonly ({
77
+ type: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType;
78
+ content: {
79
+ text: string;
80
+ } & {
81
+ spans?: ({
82
+ data?: unknown;
83
+ } & {
84
+ start: number;
85
+ end: number;
86
+ type: import("@prismicio/types-internal/lib/customtypes/widgets/nestable").RichTextNodeType;
87
+ })[];
88
+ };
89
+ } & {
90
+ label?: string;
91
+ direction?: string;
92
+ })[];
93
+ };
94
+ };
95
+ export declare type CoreExtension = typeof D | typeof HB | typeof T | typeof LI;
@@ -1,5 +1,5 @@
1
1
  import type { Node as ProsemirrorNode, Schema } from "prosemirror-model";
2
- declare function splitTextToNodes(schema: Schema, text: string): (textToNode: (strText: string) => ProsemirrorNode) => Array<ProsemirrorNode>;
2
+ declare function splitTextToNodes(schema: Schema, text: string): (textToNode: (strText: string) => ProsemirrorNode) => ProsemirrorNode[];
3
3
  declare const EditorHardBreak: {
4
4
  name: string;
5
5
  component: import("@tiptap/core").Node<import("@tiptap/extension-hard-break").HardBreakOptions, any>;
@@ -19,8 +19,8 @@ declare const _default: {
19
19
  } & {
20
20
  label?: string;
21
21
  direction?: string;
22
- }) => ProsemirrorNode<any> | undefined;
23
- toPrismic(node: ProsemirrorNode<any>, nodeType: "list-item" | "o-list-item"): readonly ({
22
+ }) => ProsemirrorNode | undefined;
23
+ toPrismic(node: ProsemirrorNode, nodeType: "list-item" | "o-list-item"): readonly ({
24
24
  type: "em" | "embed" | "strong" | "image" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
25
25
  content: {
26
26
  text: string;
@@ -6,10 +6,10 @@ declare const EditorText: {
6
6
  name: string;
7
7
  component: import("@tiptap/core").Node<any, any>;
8
8
  converter: {
9
- fromPrismic(schema: Schema): (extensionName: string, textBlock: TextBlock, preventHardbreaks?: boolean) => Array<ProsemirrorNode>;
9
+ fromPrismic(schema: Schema): (extensionName: string, textBlock: TextBlock, preventHardbreaks?: boolean) => ProsemirrorNode[];
10
10
  toPrismic(node: ProsemirrorNode, nodeType: RichTextNodeType, attributes?: {
11
11
  direction?: Direction;
12
- } | undefined): TextBlock;
12
+ }): TextBlock;
13
13
  };
14
14
  };
15
15
  export default EditorText;
@@ -5,5 +5,5 @@ import { default as Document } from "./Document";
5
5
  import { default as HardBreak } from "./HardBreak";
6
6
  import { default as ListItem } from "./ListItem";
7
7
  import { default as Text } from "./Text";
8
- export declare function CoreComponents(field: RichText, nodeExtensions: ReadonlyArray<NodeExtension>): ReadonlyArray<Node>;
8
+ export declare function CoreComponents(field: RichText, nodeExtensions: readonly NodeExtension[]): readonly Node[];
9
9
  export { Document, HardBreak, ListItem, Text };
@@ -4,10 +4,10 @@ import { type ReadonlyNonEmptyArray } from "fp-ts/ReadonlyNonEmptyArray";
4
4
  import type { Node as ProsemirrorNode } from "prosemirror-model";
5
5
  import { HeadingTextExtension } from "../models";
6
6
  export declare type Level = TTLevel;
7
- declare type HeadingName = {
7
+ interface HeadingName {
8
8
  fullName: RichTextNodeType;
9
9
  level: Level;
10
- };
10
+ }
11
11
  export declare const HeadingName: {
12
12
  byLevel(level: Level): RichTextNodeType;
13
13
  default(level: Level): HeadingName;
@@ -16,6 +16,6 @@ export declare const HeadingName: {
16
16
  };
17
17
  declare const _default: {
18
18
  name: string;
19
- build: (nodeTypes?: Set<RichTextNodeType> | undefined) => HeadingTextExtension | undefined;
19
+ build: (nodeTypes?: Set<RichTextNodeType>) => HeadingTextExtension | undefined;
20
20
  };
21
21
  export default _default;
@@ -10,5 +10,5 @@ import { default as OrderedList } from "./OrderedList";
10
10
  import { default as Paragraph } from "./Paragraph";
11
11
  export declare const DefaultExtension: import("../models").TextExtension;
12
12
  export declare const MarkExtensions: import("../models").MarkExtension<unknown>[];
13
- export declare const Extensions: (nodeTypes?: Set<RichTextNodeType> | undefined) => ReadonlyArray<WidgetExtension>;
13
+ export declare const Extensions: (nodeTypes?: Set<RichTextNodeType>) => readonly WidgetExtension[];
14
14
  export { Bold, BulletList, CodeBlock, Embed, Heading, Italic, OrderedList, Paragraph, };
@@ -0,0 +1,38 @@
1
+ import type { TextBlock } from "@prismicio/types-internal/lib/documents/widgets/nestable/StructuredTextContent/Block";
2
+ import { Extension } from "@tiptap/core";
3
+ import type { Node as ProsemirrorNode } from "prosemirror-model";
4
+ export declare enum Direction {
5
+ LeftToRight = "ltr",
6
+ RightToLeft = "rtl"
7
+ }
8
+ export interface TextDirectionOptions {
9
+ supportedExtensionNames: ReadonlyArray<string>;
10
+ }
11
+ export declare const TEXT_DIRECTION_ATTR_NAME = "text-direction";
12
+ declare module "@tiptap/core" {
13
+ interface Commands<ReturnType> {
14
+ [TEXT_DIRECTION_ATTR_NAME]: {
15
+ setDirection: (direction: Direction) => ReturnType;
16
+ toggleDirection: (direction: Direction) => ReturnType;
17
+ /**
18
+ * Set the text direction attribute
19
+ */
20
+ setRightToLeft: () => ReturnType;
21
+ /**
22
+ * Unset the text direction attribute
23
+ */
24
+ setLeftToRight: () => ReturnType;
25
+ };
26
+ }
27
+ }
28
+ export declare const name = "textDirection";
29
+ export declare const Component: Extension<TextDirectionOptions, any>;
30
+ export declare const Converter: {
31
+ parseNodeAttrsDirection(attributes: Partial<Record<string, unknown>>): Direction;
32
+ fromPrismic(textBlock: TextBlock): {
33
+ [TEXT_DIRECTION_ATTR_NAME]: Direction;
34
+ };
35
+ toPrismic(node: ProsemirrorNode): {
36
+ direction: Direction;
37
+ } | Record<string, never>;
38
+ };
@@ -0,0 +1,3 @@
1
+ import * as TD from "./TextDirection";
2
+ export declare const TextDirection: typeof TD;
3
+ export declare type GlobalExtension = typeof TD;
@@ -6,7 +6,7 @@ export declare enum Direction {
6
6
  RightToLeft = "rtl"
7
7
  }
8
8
  interface TextDirectionOptions {
9
- supportedExtensionNames: ReadonlyArray<string>;
9
+ supportedExtensionNames: readonly string[];
10
10
  }
11
11
  export declare const TEXT_DIRECTION_ATTR_NAME = "text-direction";
12
12
  declare module "@tiptap/core" {
@@ -34,6 +34,6 @@ export declare const converter: {
34
34
  };
35
35
  toPrismic(node: ProsemirrorNode): {
36
36
  direction: Direction;
37
- } | Record<string, never>;
37
+ };
38
38
  };
39
39
  export {};
@@ -0,0 +1,5 @@
1
+ import type { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
2
+ import type { TextBlock } from "@prismicio/types-internal/lib/documents/widgets/nestable/StructuredTextContent/Block";
3
+ export declare type TextBlockWithNodeType = TextBlock & {
4
+ type: RichTextNodeType;
5
+ };
@@ -2,8 +2,8 @@ import type { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes
2
2
  import type { StructuredTextContent as RichTextContent } from "@prismicio/types-internal/lib/documents/widgets/nestable";
3
3
  import type { EmbedBlock, ImageBlock, TextBlock } from "@prismicio/types-internal/lib/documents/widgets/nestable/StructuredTextContent/Block";
4
4
  import type { Mark, Node } from "@tiptap/core";
5
- import type { ReadonlyNonEmptyArray } from "fp-ts/lib/ReadonlyNonEmptyArray";
6
5
  import type { NonEmptyArray } from "fp-ts/NonEmptyArray";
6
+ import type { ReadonlyNonEmptyArray } from "fp-ts/ReadonlyNonEmptyArray";
7
7
  import type { Mark as ProsemirrorMark, Node as ProsemirrorNode, Schema } from "prosemirror-model";
8
8
  import type { Level } from "../extensions/Heading";
9
9
  export declare enum ExtensionType {
@@ -22,12 +22,12 @@ export declare type ExtensionPlaceholder = string | ((nodeAttrs: ProsemirrorNode
22
22
  export declare class DocumentExtension {
23
23
  readonly name: string;
24
24
  readonly component: (multiLines: boolean) => Node;
25
- readonly converter: (extensions: ReadonlyArray<NodeExtension>) => {
25
+ readonly converter: (extensions: readonly NodeExtension[]) => {
26
26
  fromPrismic(schema: Schema, defaultTextConverter?: (block: TextBlock) => ProsemirrorNode | undefined): (elmt: RichTextContent) => ProsemirrorNode | undefined;
27
27
  toPrismic(elmt: ProsemirrorNode): RichTextContent | undefined;
28
28
  };
29
29
  extType: ExtensionType.Document;
30
- constructor(name: string, component: (multiLines: boolean) => Node, converter: (extensions: ReadonlyArray<NodeExtension>) => {
30
+ constructor(name: string, component: (multiLines: boolean) => Node, converter: (extensions: readonly NodeExtension[]) => {
31
31
  fromPrismic(schema: Schema, defaultTextConverter?: (block: TextBlock) => ProsemirrorNode | undefined): (elmt: RichTextContent) => ProsemirrorNode | undefined;
32
32
  toPrismic(elmt: ProsemirrorNode): RichTextContent | undefined;
33
33
  });
@@ -53,7 +53,7 @@ export declare class TextExtension {
53
53
  readonly component: Node;
54
54
  readonly converter: {
55
55
  fromPrismic(schema: Schema): (elmt: TextBlock) => ProsemirrorNode | undefined;
56
- toPrismic(elmt: ProsemirrorNode): TextBlock | ReadonlyArray<TextBlock> | undefined;
56
+ toPrismic(elmt: ProsemirrorNode): TextBlock | readonly TextBlock[] | undefined;
57
57
  };
58
58
  readonly placeholder?: ExtensionPlaceholder;
59
59
  readonly lockedFormat: boolean;
@@ -61,7 +61,7 @@ export declare class TextExtension {
61
61
  nodeType: NodeType.Text;
62
62
  constructor(richTextNodeTypes: ReadonlyNonEmptyArray<RichTextNodeType>, name: string, component: Node, converter: {
63
63
  fromPrismic(schema: Schema): (elmt: TextBlock) => ProsemirrorNode | undefined;
64
- toPrismic(elmt: ProsemirrorNode): TextBlock | ReadonlyArray<TextBlock> | undefined;
64
+ toPrismic(elmt: ProsemirrorNode): TextBlock | readonly TextBlock[] | undefined;
65
65
  }, placeholder?: ExtensionPlaceholder, lockedFormat?: boolean);
66
66
  }
67
67
  export declare class EmbedExtension {
@@ -95,8 +95,8 @@ export declare class ImageExtension {
95
95
  });
96
96
  }
97
97
  export declare class HeadingTextExtension extends TextExtension {
98
- readonly levels: ReadonlyArray<Level>;
99
- constructor(richTextNodeTypes: ReadonlyNonEmptyArray<RichTextNodeType>, Component: Node, levels: ReadonlyArray<Level>, Converter: {
98
+ readonly levels: readonly Level[];
99
+ constructor(richTextNodeTypes: ReadonlyNonEmptyArray<RichTextNodeType>, Component: Node, levels: readonly Level[], Converter: {
100
100
  fromPrismic(schema: Schema): (elmt: TextBlock) => ProsemirrorNode | undefined;
101
101
  toPrismic(elmt: ProsemirrorNode): TextBlock | undefined;
102
102
  }, placeholder?: ExtensionPlaceholder);
@@ -104,6 +104,6 @@ export declare class HeadingTextExtension extends TextExtension {
104
104
  export declare class ListExtension extends TextExtension {
105
105
  constructor(richTextNodeTypes: NonEmptyArray<RichTextNodeType>, name: string, Component: Node, Converter: {
106
106
  fromPrismic(schema: Schema): (elmt: TextBlock) => ProsemirrorNode | undefined;
107
- toPrismic(elmt: ProsemirrorNode): ReadonlyArray<TextBlock>;
107
+ toPrismic(elmt: ProsemirrorNode): readonly TextBlock[];
108
108
  });
109
109
  }
@@ -1,12 +1,12 @@
1
1
  import type { Span } from "@prismicio/types-internal/lib/documents/widgets/nestable/StructuredTextContent/Block";
2
2
  export declare const SpanUtils: {
3
- groupBy<K extends unknown>(spans: ReadonlyArray<Span>, f: (span: Span) => K): Map<K, readonly ({
3
+ groupBy<K extends unknown>(spans: readonly Span[], f: (span: Span) => K): Map<K, readonly ({
4
4
  data?: unknown;
5
5
  } & {
6
6
  start: number;
7
7
  end: number;
8
8
  type: "label" | "em" | "embed" | "strong" | "image" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
9
9
  })[]>;
10
- sort(spans: ReadonlyArray<Span>): ReadonlyArray<Span>;
11
- mergeOverlap(spans: ReadonlyArray<Span>): ReadonlyArray<Span>;
10
+ sort(spans: readonly Span[]): readonly Span[];
11
+ mergeOverlap(spans: readonly Span[]): readonly Span[];
12
12
  };
@@ -0,0 +1 @@
1
+ export declare function filterTyped<I, O>(array: Array<I>, transformOrFilter: (elmt: I) => O | undefined): Array<O>;
@@ -0,0 +1 @@
1
+ export declare function getAttributes<T>(processor: (elmt: globalThis.Element) => T): (dom: string | globalThis.Node) => false | T;
@@ -5,11 +5,11 @@ export declare const NodeUtils: {
5
5
  reduce<T>(node: ProsemirrorNode, f: (acc: T, child: ProsemirrorNode, index: number) => T, defaultValue: T): T;
6
6
  map<T_1>(node: ProsemirrorNode, f: (child: ProsemirrorNode) => T_1): readonly T_1[];
7
7
  exists(node: ProsemirrorNode, f: (child: ProsemirrorNode) => boolean): boolean;
8
- filter(node: ProsemirrorNode, predicate: (child: ProsemirrorNode) => boolean): ReadonlyArray<ProsemirrorNode>;
8
+ filter(node: ProsemirrorNode, predicate: (child: ProsemirrorNode) => boolean): readonly ProsemirrorNode[];
9
9
  };
10
10
  marks: {
11
11
  reduce<T_2>(node: ProsemirrorNode, f: (acc: T_2, child: ProsemirrorMark, index: number) => T_2, defaultValue: T_2): T_2;
12
12
  map<T_3>(node: ProsemirrorNode, f: (mark: ProsemirrorMark) => T_3): readonly T_3[];
13
- filter(node: ProsemirrorNode, predicate: (mark: ProsemirrorMark) => boolean): ReadonlyArray<ProsemirrorMark>;
13
+ filter(node: ProsemirrorNode, predicate: (mark: ProsemirrorMark) => boolean): readonly ProsemirrorMark[];
14
14
  };
15
15
  };
@@ -0,0 +1,3 @@
1
+ export declare function filterTyped<Input, Output>(obj: {
2
+ [key: string]: Input;
3
+ }, transformOrFilter: (elmt: [string, Input]) => [string, Output] | undefined): Partial<Record<string, Output>>;