@trycourier/react-designer 0.2.0 → 0.4.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/README.md +254 -41
- package/dist/cjs/index.js +70 -47
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/styles.css +1609 -480
- package/dist/components/BrandEditor/BrandEditor.d.ts +1 -0
- package/dist/components/BrandEditor/Editor/BrandFooter/BrandFooter.d.ts +1 -1
- package/dist/components/BrandEditor/Editor/Editor.d.ts +16 -0
- package/dist/components/Providers/api/template.d.ts +33 -1
- package/dist/components/Providers/store.d.ts +6 -0
- package/dist/components/Providers/useBrandActions.d.ts +1 -1
- package/dist/components/Providers/useTemplateActions.d.ts +4 -2
- package/dist/components/TemplateEditor/Channels/Email/Email.d.ts +5 -6
- package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +2 -1
- package/dist/components/TemplateEditor/Channels/Email/EmailLayout.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/Email/SideBar/SideBar.d.ts +9 -3
- package/dist/components/TemplateEditor/Channels/Email/SideBar/SideBarSortableItemWrapper/SideBarSortableItemWrapper.d.ts +4 -18
- package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/Inbox/InboxLayout.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/MSTeams.d.ts +5 -3
- package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsEditor.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsLayout.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/SideBar/SideBar.d.ts +5 -3
- package/dist/components/TemplateEditor/Channels/Push/Push.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/Push/PushLayout.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/SMS/SMS.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/SMS/SMSLayout.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/Slack/SideBar/SideBar.d.ts +5 -3
- package/dist/components/TemplateEditor/Channels/Slack/Slack.d.ts +5 -3
- package/dist/components/TemplateEditor/Channels/Slack/SlackEditor.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/Slack/SlackLayout.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/useChannels.d.ts +9 -1
- package/dist/components/TemplateEditor/TemplateEditor.d.ts +17 -1
- package/dist/components/TemplateEditor/hooks/index.d.ts +1 -0
- package/dist/components/TemplateEditor/hooks/useDebouncedFlush.d.ts +10 -0
- package/dist/components/TemplateEditor/hooks/useDndRef.d.ts +18 -0
- package/dist/components/TemplateEditor/hooks/useEditorDnd.d.ts +12 -16
- package/dist/components/TemplateEditor/hooks/usePragmaticDnd.d.ts +22 -0
- package/dist/components/TemplateEditor/hooks/useSyncEditorItems.d.ts +3 -2
- package/dist/components/TemplateEditor/index.d.ts +5 -2
- package/dist/components/TemplateEditor/store.d.ts +150 -0
- package/dist/components/extensions/Blockquote/Blockquote.types.d.ts +2 -2
- package/dist/components/extensions/Button/Button.types.d.ts +18 -24
- package/dist/components/extensions/Button/ButtonComponent.d.ts +1 -0
- package/dist/components/extensions/ButtonRow/ButtonRowComponent.d.ts +5 -1
- package/dist/components/extensions/Column/Column.d.ts +11 -0
- package/dist/components/extensions/Column/Column.types.d.ts +44 -0
- package/dist/components/extensions/Column/ColumnComponent.d.ts +9 -0
- package/dist/components/extensions/Column/ColumnForm.d.ts +8 -0
- package/dist/components/extensions/Column/index.d.ts +5 -0
- package/dist/components/extensions/ColumnCell/ColumnCell.d.ts +10 -0
- package/dist/components/extensions/ColumnCell/ColumnCellComponent.d.ts +2 -0
- package/dist/components/extensions/ColumnCell/index.d.ts +2 -0
- package/dist/components/extensions/ColumnRow/ColumnRow.d.ts +10 -0
- package/dist/components/extensions/ColumnRow/ColumnRowComponent.d.ts +2 -0
- package/dist/components/extensions/ColumnRow/index.d.ts +2 -0
- package/dist/components/extensions/ImageBlock/ImageBlock.types.d.ts +2 -6
- package/dist/components/extensions/Selection/Selection.d.ts +1 -0
- package/dist/components/extensions/TextBlock/TextBlock.types.d.ts +4 -12
- package/dist/components/extensions/Variable/Variable.d.ts +16 -0
- package/dist/components/extensions/Variable/Variable.types.d.ts +22 -18
- package/dist/components/extensions/Variable/VariableIcon.d.ts +5 -1
- package/dist/components/extensions/Variable/index.d.ts +1 -0
- package/dist/components/extensions/extension-kit.d.ts +8 -3
- package/dist/components/extensions/index.d.ts +4 -1
- package/dist/components/hooks/index.d.ts +2 -0
- package/dist/components/hooks/useBlockConfig.d.ts +110 -0
- package/dist/components/hooks/useVariables.d.ts +40 -0
- package/dist/components/ui/Blocks/ColumnBlock/ColumnBlock.d.ts +3 -0
- package/dist/components/ui/Blocks/ColumnBlock/index.d.ts +1 -0
- package/dist/components/ui/Blocks/CustomCodeBlock/index.d.ts +1 -1
- package/dist/components/ui/Blocks/index.d.ts +1 -0
- package/dist/components/ui/ContentIcon/ContentIcon.d.ts +1 -0
- package/dist/components/ui/DraggableItem/DraggableItem.d.ts +16 -0
- package/dist/components/ui/DraggableItem/index.d.ts +1 -0
- package/dist/components/ui/DropIndicatorPlaceholder/DropIndicatorPlaceholder.d.ts +5 -0
- package/dist/components/ui/DropIndicatorPlaceholder/index.d.ts +1 -0
- package/dist/components/ui/FormHeader/FormHeader.d.ts +2 -1
- package/dist/components/ui/MainLayout/MainLayout.d.ts +1 -1
- package/dist/components/ui/SortableItemWrapper/SortableItemWrapper.d.ts +11 -8
- package/dist/components/ui/TextInput/TextInput.d.ts +0 -1
- package/dist/components/ui/TextMenu/config.d.ts +16 -0
- package/dist/components/ui/TextMenu/hooks/useConditionalRules.d.ts +18 -0
- package/dist/components/ui/TextMenu/hooks/useTextmenuCommands.d.ts +15 -1
- package/dist/components/ui/VariableEditor/VariableAutocomplete.d.ts +16 -0
- package/dist/components/ui/VariableEditor/VariableChipBase.d.ts +35 -0
- package/dist/components/ui/VariableEditor/VariableEditorToolbar.d.ts +15 -0
- package/dist/components/ui/VariableEditor/VariableInput.d.ts +13 -0
- package/dist/components/ui/VariableEditor/VariableTextarea.d.ts +11 -0
- package/dist/components/ui/VariableEditor/index.d.ts +8 -0
- package/dist/components/ui/VariableEditor/shared.d.ts +47 -0
- package/dist/components/ui-kit/Icon/EmailIcon.d.ts +3 -0
- package/dist/components/ui-kit/Icon/MSTeamsIcon.d.ts +1 -1
- package/dist/components/ui-kit/Icon/PushIcon.d.ts +1 -1
- package/dist/components/ui-kit/Icon/VariableIcon.d.ts +1 -1
- package/dist/components/ui-kit/Icon/index.d.ts +1 -0
- package/dist/components/ui-kit/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/components/ui-kit/Toggle/Toggle.d.ts +2 -2
- package/dist/components/ui-kit/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/dist/components/utils/extractVariablesFromContent.d.ts +13 -0
- package/dist/components/utils/index.d.ts +1 -0
- package/dist/components/utils/multipleContainersKeyboardCoordinates.d.ts +1 -2
- package/dist/components/utils/validateVariableName.d.ts +9 -0
- package/dist/esm/index.js +70 -47
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/styles.css +1609 -480
- package/dist/hooks/useAutoSave.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/lib/utils/image.d.ts +5 -0
- package/dist/styles.css +1609 -480
- package/dist/types/elemental.schema.d.ts +3 -3
- package/dist/types/elemental.types.d.ts +48 -4
- package/dist/types/index.d.ts +1 -0
- package/dist/types/validation.types.d.ts +53 -0
- package/package.json +7 -6
- package/dist/cjs/index.css +0 -2
- package/dist/cjs/index.css.map +0 -7
- package/dist/esm/index.css +0 -2
- package/dist/esm/index.css.map +0 -7
|
@@ -2,8 +2,9 @@ export { BrandFooter } from "@/components/BrandEditor/Editor/BrandFooter";
|
|
|
2
2
|
export { PreviewPanel } from "@/components/ui/PreviewPanel";
|
|
3
3
|
export { TextMenu } from "@/components/ui/TextMenu";
|
|
4
4
|
export { cn, convertElementalToTiptap, convertTiptapToElemental } from "@/lib/utils";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { VariableInput, VariableTextarea } from "@/components/ui/VariableEditor";
|
|
6
|
+
export { getFlattenedVariables } from "@/components/utils/getFlattenedVariables";
|
|
7
|
+
export { useChannels, getChannelDefaults } from "./Channels";
|
|
7
8
|
export { default as EmailEditor } from "./Channels/Email/EmailEditor";
|
|
8
9
|
export * from "./TemplateEditor";
|
|
9
10
|
export { SideBar as EmailSideBar, SideBarItemDetails as EmailSideBarItemDetails, } from "./Channels/Email/SideBar";
|
|
@@ -17,11 +18,13 @@ export declare const InboxChannel: import("react").MemoExoticComponent<import("r
|
|
|
17
18
|
export declare const MSTeamsChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").MSTeamsProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
18
19
|
export declare const SlackChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").SlackProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
19
20
|
export { EmailEditorContainer, EmailEditorMain, type EmailEditorProps, type InboxEditorProps, type MSTeamsEditorProps, type PushEditorProps, type SlackEditorProps, type SMSEditorProps, } from "./Channels";
|
|
21
|
+
export { CHANNELS } from "@/channels";
|
|
20
22
|
export type { ChannelType } from "@/store";
|
|
21
23
|
export type { ElementalContent } from "@/types";
|
|
22
24
|
export { ChannelRootContainer, EditorSidebar } from "./Layout";
|
|
23
25
|
export { InboxEditor, MSTeamsEditor, PushEditor, SlackEditor, SMSEditor } from "./Channels";
|
|
24
26
|
export { useAutoSave } from "@/hooks/useAutoSave";
|
|
27
|
+
export { useDebouncedFlush } from "./hooks/useDebouncedFlush";
|
|
25
28
|
export { Status as TemplateStatus } from "@/components/ui/Status";
|
|
26
29
|
export { MonacoCodeEditor } from "@/components/extensions/CustomCode/MonacoCodeEditor";
|
|
27
30
|
export { ToggleGroup } from "@/components/ui-kit";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ElementalContent } from "@/types/elemental.types";
|
|
2
|
+
import type { VariableValidationConfig } from "@/types/validation.types";
|
|
2
3
|
import type { Editor } from "@tiptap/react";
|
|
3
4
|
export declare const subjectAtom: import("jotai").PrimitiveAtom<string | null> & {
|
|
4
5
|
init: string | null;
|
|
@@ -26,3 +27,152 @@ export declare const isTemplateTransitioningAtom: import("jotai").PrimitiveAtom<
|
|
|
26
27
|
export declare const isSidebarExpandedAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
27
28
|
init: boolean;
|
|
28
29
|
};
|
|
30
|
+
export declare const variableValuesAtom: import("jotai").PrimitiveAtom<Record<string, string>> & {
|
|
31
|
+
init: Record<string, string>;
|
|
32
|
+
};
|
|
33
|
+
export declare const availableVariablesAtom: import("jotai").PrimitiveAtom<Record<string, unknown>> & {
|
|
34
|
+
init: Record<string, unknown>;
|
|
35
|
+
};
|
|
36
|
+
export declare const disableVariablesAutocompleteAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
37
|
+
init: boolean;
|
|
38
|
+
};
|
|
39
|
+
export declare const variableValidationAtom: import("jotai").PrimitiveAtom<VariableValidationConfig | undefined> & {
|
|
40
|
+
init: VariableValidationConfig | undefined;
|
|
41
|
+
};
|
|
42
|
+
export declare const isDraggingAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
43
|
+
init: boolean;
|
|
44
|
+
};
|
|
45
|
+
export declare const pendingAutoSaveAtom: import("jotai").PrimitiveAtom<ElementalContent | null> & {
|
|
46
|
+
init: ElementalContent | null;
|
|
47
|
+
};
|
|
48
|
+
export declare const lastSavedContentAtom: import("jotai").PrimitiveAtom<string | null> & {
|
|
49
|
+
init: string | null;
|
|
50
|
+
};
|
|
51
|
+
export type FlushFunction = () => void;
|
|
52
|
+
export declare const flushFunctionsAtom: import("jotai").WritableAtom<Map<string, FlushFunction>, [update: {
|
|
53
|
+
action: "register" | "unregister";
|
|
54
|
+
id: string;
|
|
55
|
+
fn?: FlushFunction;
|
|
56
|
+
}], void>;
|
|
57
|
+
export declare const flushAllPendingUpdates: (flushFunctions: Map<string, FlushFunction>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Available block element types that can be used in the sidebar
|
|
60
|
+
*/
|
|
61
|
+
export type BlockElementType = "heading" | "text" | "image" | "spacer" | "divider" | "button" | "customCode" | "column" | "blockquote";
|
|
62
|
+
/**
|
|
63
|
+
* Attributes that can be set as defaults or in presets for blocks.
|
|
64
|
+
* Types match the actual TipTap node attribute types for each extension.
|
|
65
|
+
*/
|
|
66
|
+
export interface BlockAttributes {
|
|
67
|
+
/** Background color (string, e.g., "#ffffff" or "transparent") */
|
|
68
|
+
backgroundColor?: string;
|
|
69
|
+
/** Border color */
|
|
70
|
+
borderColor?: string;
|
|
71
|
+
/** Border width in pixels */
|
|
72
|
+
borderWidth?: number;
|
|
73
|
+
/** Border radius in pixels */
|
|
74
|
+
borderRadius?: number;
|
|
75
|
+
/** Vertical padding in pixels */
|
|
76
|
+
paddingVertical?: number;
|
|
77
|
+
/** Horizontal padding in pixels */
|
|
78
|
+
paddingHorizontal?: number;
|
|
79
|
+
/** Text alignment */
|
|
80
|
+
textAlign?: "left" | "center" | "right" | "justify";
|
|
81
|
+
/** Button label text */
|
|
82
|
+
label?: string;
|
|
83
|
+
/** Button link URL */
|
|
84
|
+
link?: string;
|
|
85
|
+
/** Button alignment */
|
|
86
|
+
alignment?: "left" | "center" | "right";
|
|
87
|
+
/** Button padding in pixels */
|
|
88
|
+
padding?: number;
|
|
89
|
+
/** Font weight */
|
|
90
|
+
fontWeight?: "normal" | "bold";
|
|
91
|
+
/** Font style */
|
|
92
|
+
fontStyle?: "normal" | "italic";
|
|
93
|
+
/** Underline text */
|
|
94
|
+
isUnderline?: boolean;
|
|
95
|
+
/** Strikethrough text */
|
|
96
|
+
isStrike?: boolean;
|
|
97
|
+
/** @deprecated Text color - legacy property */
|
|
98
|
+
textColor?: string;
|
|
99
|
+
/** Divider color */
|
|
100
|
+
color?: string;
|
|
101
|
+
/** Divider line thickness in pixels */
|
|
102
|
+
size?: number;
|
|
103
|
+
/** Divider corner radius */
|
|
104
|
+
radius?: number;
|
|
105
|
+
/** Divider variant type */
|
|
106
|
+
variant?: "divider" | "spacer";
|
|
107
|
+
/** Image source path/URL */
|
|
108
|
+
sourcePath?: string;
|
|
109
|
+
/** Image alt text */
|
|
110
|
+
alt?: string;
|
|
111
|
+
/** Image width as ratio (0-1, where 1 = 100%) */
|
|
112
|
+
width?: number;
|
|
113
|
+
/** HTML code content */
|
|
114
|
+
code?: string;
|
|
115
|
+
/** Number of columns (1-4) */
|
|
116
|
+
columnsCount?: number;
|
|
117
|
+
/** Left border width for blockquote */
|
|
118
|
+
borderLeftWidth?: number;
|
|
119
|
+
[key: string]: unknown;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A block preset is a pre-configured variant of an existing block type.
|
|
123
|
+
* For example, a "Portal Button" preset is a button with specific href and label.
|
|
124
|
+
*/
|
|
125
|
+
export interface BlockPreset {
|
|
126
|
+
/** The base block type this preset is built on */
|
|
127
|
+
type: BlockElementType;
|
|
128
|
+
/** Unique identifier for this preset */
|
|
129
|
+
key: string;
|
|
130
|
+
/** Display label in the sidebar */
|
|
131
|
+
label: string;
|
|
132
|
+
/** Optional custom icon (React node) */
|
|
133
|
+
icon?: React.ReactNode;
|
|
134
|
+
/** Pre-configured attributes for this preset */
|
|
135
|
+
attributes: BlockAttributes;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A reference to a preset in the visible blocks list
|
|
139
|
+
*/
|
|
140
|
+
export interface PresetReference {
|
|
141
|
+
/** The base block type */
|
|
142
|
+
type: BlockElementType;
|
|
143
|
+
/** The preset key */
|
|
144
|
+
preset: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A visible block item can be either:
|
|
148
|
+
* - A built-in block type string (e.g., "text", "button")
|
|
149
|
+
* - A preset reference (e.g., { type: "button", preset: "portal" })
|
|
150
|
+
*/
|
|
151
|
+
export type VisibleBlockItem = BlockElementType | PresetReference;
|
|
152
|
+
/**
|
|
153
|
+
* Type guard to check if a VisibleBlockItem is a PresetReference
|
|
154
|
+
*/
|
|
155
|
+
export declare const isPresetReference: (item: VisibleBlockItem) => item is PresetReference;
|
|
156
|
+
/**
|
|
157
|
+
* Default block elements available in the sidebar
|
|
158
|
+
*/
|
|
159
|
+
export declare const DEFAULT_VISIBLE_BLOCKS: VisibleBlockItem[];
|
|
160
|
+
/**
|
|
161
|
+
* Atom to store visible blocks in the sidebar (and their order)
|
|
162
|
+
*/
|
|
163
|
+
export declare const visibleBlocksAtom: import("jotai").PrimitiveAtom<VisibleBlockItem[]> & {
|
|
164
|
+
init: VisibleBlockItem[];
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Atom to store default attributes for each block type
|
|
168
|
+
* When a new block is created, these defaults are applied
|
|
169
|
+
*/
|
|
170
|
+
export declare const blockDefaultsAtom: import("jotai").PrimitiveAtom<Partial<Record<BlockElementType, BlockAttributes>>> & {
|
|
171
|
+
init: Partial<Record<BlockElementType, BlockAttributes>>;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Atom to store registered block presets
|
|
175
|
+
*/
|
|
176
|
+
export declare const blockPresetsAtom: import("jotai").PrimitiveAtom<BlockPreset[]> & {
|
|
177
|
+
init: BlockPreset[];
|
|
178
|
+
};
|
|
@@ -8,16 +8,16 @@ export declare const blockquoteSchema: z.ZodObject<{
|
|
|
8
8
|
id: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
backgroundColor: string;
|
|
11
|
+
borderColor: string;
|
|
11
12
|
paddingVertical: number;
|
|
12
13
|
paddingHorizontal: number;
|
|
13
|
-
borderColor: string;
|
|
14
14
|
borderLeftWidth: number;
|
|
15
15
|
id?: string | undefined;
|
|
16
16
|
}, {
|
|
17
17
|
backgroundColor: string;
|
|
18
|
+
borderColor: string;
|
|
18
19
|
paddingVertical: number;
|
|
19
20
|
paddingHorizontal: number;
|
|
20
|
-
borderColor: string;
|
|
21
21
|
borderLeftWidth: number;
|
|
22
22
|
id?: string | undefined;
|
|
23
23
|
}>;
|
|
@@ -3,61 +3,55 @@ export declare const buttonSchema: z.ZodObject<{
|
|
|
3
3
|
label: z.ZodString;
|
|
4
4
|
link: z.ZodOptional<z.ZodString>;
|
|
5
5
|
alignment: z.ZodEnum<["left", "center", "right"]>;
|
|
6
|
-
size: z.ZodEnum<["default", "full"]>;
|
|
7
6
|
backgroundColor: z.ZodString;
|
|
8
|
-
textColor: z.ZodString;
|
|
9
|
-
borderWidth: z.ZodNumber;
|
|
10
7
|
borderRadius: z.ZodNumber;
|
|
11
|
-
borderColor: z.ZodString;
|
|
12
8
|
padding: z.ZodNumber;
|
|
13
9
|
fontWeight: z.ZodEnum<["normal", "bold"]>;
|
|
14
10
|
fontStyle: z.ZodEnum<["normal", "italic"]>;
|
|
15
11
|
isUnderline: z.ZodBoolean;
|
|
16
12
|
isStrike: z.ZodBoolean;
|
|
13
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
14
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
17
15
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
padding: number;
|
|
19
|
-
label: string;
|
|
20
16
|
backgroundColor: string;
|
|
21
|
-
textColor: string;
|
|
22
|
-
borderColor: string;
|
|
23
|
-
size: "full" | "default";
|
|
24
|
-
borderWidth: number;
|
|
25
17
|
borderRadius: number;
|
|
18
|
+
label: string;
|
|
26
19
|
alignment: "left" | "center" | "right";
|
|
27
|
-
|
|
28
|
-
fontWeight: "
|
|
20
|
+
padding: number;
|
|
21
|
+
fontWeight: "normal" | "bold";
|
|
22
|
+
fontStyle: "normal" | "italic";
|
|
29
23
|
isUnderline: boolean;
|
|
30
24
|
isStrike: boolean;
|
|
31
25
|
link?: string | undefined;
|
|
26
|
+
borderColor?: string | undefined;
|
|
27
|
+
textColor?: string | undefined;
|
|
32
28
|
}, {
|
|
33
|
-
padding: number;
|
|
34
|
-
label: string;
|
|
35
29
|
backgroundColor: string;
|
|
36
|
-
textColor: string;
|
|
37
|
-
borderColor: string;
|
|
38
|
-
size: "full" | "default";
|
|
39
|
-
borderWidth: number;
|
|
40
30
|
borderRadius: number;
|
|
31
|
+
label: string;
|
|
41
32
|
alignment: "left" | "center" | "right";
|
|
42
|
-
|
|
43
|
-
fontWeight: "
|
|
33
|
+
padding: number;
|
|
34
|
+
fontWeight: "normal" | "bold";
|
|
35
|
+
fontStyle: "normal" | "italic";
|
|
44
36
|
isUnderline: boolean;
|
|
45
37
|
isStrike: boolean;
|
|
46
38
|
link?: string | undefined;
|
|
39
|
+
borderColor?: string | undefined;
|
|
40
|
+
textColor?: string | undefined;
|
|
47
41
|
}>;
|
|
48
42
|
export interface ButtonProps {
|
|
49
43
|
label: string;
|
|
50
44
|
link?: string;
|
|
51
45
|
alignment: "left" | "center" | "right";
|
|
52
|
-
size: "default" | "full";
|
|
53
46
|
backgroundColor: string;
|
|
54
|
-
textColor: string;
|
|
55
|
-
borderWidth: number;
|
|
56
47
|
borderRadius: number;
|
|
57
|
-
borderColor: string;
|
|
58
48
|
padding: number;
|
|
59
49
|
fontWeight: "normal" | "bold";
|
|
60
50
|
fontStyle: "normal" | "italic";
|
|
61
51
|
isUnderline: boolean;
|
|
62
52
|
isStrike: boolean;
|
|
53
|
+
/** @deprecated Legacy property - not supported by Elemental */
|
|
54
|
+
textColor?: string;
|
|
55
|
+
/** @deprecated Legacy property - not supported by Elemental */
|
|
56
|
+
borderColor?: string;
|
|
63
57
|
}
|
|
@@ -7,5 +7,6 @@ export declare const ButtonComponent: React.FC<ButtonProps & {
|
|
|
7
7
|
fontWeight?: string;
|
|
8
8
|
isUnderline?: boolean;
|
|
9
9
|
isStrike?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
10
11
|
}>;
|
|
11
12
|
export declare const ButtonComponentNode: (props: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type NodeViewProps } from "@tiptap/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ButtonRowProps } from "./ButtonRow.types";
|
|
4
|
-
export declare const ButtonRowComponent: React.FC<ButtonRowProps
|
|
4
|
+
export declare const ButtonRowComponent: React.FC<ButtonRowProps & {
|
|
5
|
+
onButton1LabelChange?: (label: string) => void;
|
|
6
|
+
onButton2LabelChange?: (label: string) => void;
|
|
7
|
+
editable?: boolean;
|
|
8
|
+
}>;
|
|
5
9
|
export declare const ButtonRowComponentNode: (props: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
import type { ColumnProps } from "./Column.types";
|
|
3
|
+
declare module "@tiptap/core" {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
column: {
|
|
6
|
+
setColumn: (props: Partial<ColumnProps>) => ReturnType;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare const defaultColumnProps: ColumnProps;
|
|
11
|
+
export declare const Column: Node<any, any>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { JSONContent } from "@tiptap/core";
|
|
3
|
+
export interface CellContent {
|
|
4
|
+
elements: JSONContent[];
|
|
5
|
+
}
|
|
6
|
+
export declare const columnSchema: z.ZodObject<{
|
|
7
|
+
columnsCount: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
paddingHorizontal: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
paddingVertical: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
backgroundColor: z.ZodDefault<z.ZodString>;
|
|
11
|
+
borderWidth: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
borderRadius: z.ZodDefault<z.ZodNumber>;
|
|
13
|
+
borderColor: z.ZodDefault<z.ZodString>;
|
|
14
|
+
cells: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
elements: z.ZodArray<z.ZodAny, "many">;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
elements: any[];
|
|
18
|
+
}, {
|
|
19
|
+
elements: any[];
|
|
20
|
+
}>, "many">>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
backgroundColor: string;
|
|
23
|
+
borderColor: string;
|
|
24
|
+
borderWidth: number;
|
|
25
|
+
borderRadius: number;
|
|
26
|
+
paddingVertical: number;
|
|
27
|
+
paddingHorizontal: number;
|
|
28
|
+
columnsCount: number;
|
|
29
|
+
cells?: {
|
|
30
|
+
elements: any[];
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
backgroundColor?: string | undefined;
|
|
34
|
+
borderColor?: string | undefined;
|
|
35
|
+
borderWidth?: number | undefined;
|
|
36
|
+
borderRadius?: number | undefined;
|
|
37
|
+
paddingVertical?: number | undefined;
|
|
38
|
+
paddingHorizontal?: number | undefined;
|
|
39
|
+
columnsCount?: number | undefined;
|
|
40
|
+
cells?: {
|
|
41
|
+
elements: any[];
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export type ColumnProps = z.infer<typeof columnSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type NodeViewProps } from "@tiptap/react";
|
|
2
|
+
import type { Node } from "@tiptap/pm/model";
|
|
3
|
+
import type { ColumnProps } from "./Column.types";
|
|
4
|
+
export declare const ColumnComponent: React.FC<ColumnProps & {
|
|
5
|
+
node: Node;
|
|
6
|
+
columnsCount: number;
|
|
7
|
+
isPreviewMode?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ColumnComponentNode: (props: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
2
|
+
import type { Editor } from "@tiptap/react";
|
|
3
|
+
interface ColumnFormProps {
|
|
4
|
+
element?: ProseMirrorNode;
|
|
5
|
+
editor: Editor | null;
|
|
6
|
+
}
|
|
7
|
+
export declare const ColumnForm: ({ element, editor }: ColumnFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Column, defaultColumnProps } from "./Column";
|
|
2
|
+
export { ColumnComponent, ColumnComponentNode } from "./ColumnComponent";
|
|
3
|
+
export { ColumnForm } from "./ColumnForm";
|
|
4
|
+
export type { ColumnProps } from "./Column.types";
|
|
5
|
+
export { columnSchema } from "./Column.types";
|
|
@@ -6,28 +6,25 @@ export declare const imageBlockSchema: z.ZodObject<{
|
|
|
6
6
|
alignment: z.ZodEnum<["left", "center", "right"]>;
|
|
7
7
|
width: z.ZodNumber;
|
|
8
8
|
borderWidth: z.ZodNumber;
|
|
9
|
-
borderRadius: z.ZodNumber;
|
|
10
9
|
borderColor: z.ZodString;
|
|
11
10
|
isUploading: z.ZodOptional<z.ZodBoolean>;
|
|
12
11
|
imageNaturalWidth: z.ZodNumber;
|
|
13
12
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
width: number;
|
|
15
13
|
borderColor: string;
|
|
16
14
|
borderWidth: number;
|
|
17
|
-
borderRadius: number;
|
|
18
15
|
alignment: "left" | "center" | "right";
|
|
19
16
|
sourcePath: string;
|
|
17
|
+
width: number;
|
|
20
18
|
imageNaturalWidth: number;
|
|
21
19
|
link?: string | undefined;
|
|
22
20
|
alt?: string | undefined;
|
|
23
21
|
isUploading?: boolean | undefined;
|
|
24
22
|
}, {
|
|
25
|
-
width: number;
|
|
26
23
|
borderColor: string;
|
|
27
24
|
borderWidth: number;
|
|
28
|
-
borderRadius: number;
|
|
29
25
|
alignment: "left" | "center" | "right";
|
|
30
26
|
sourcePath: string;
|
|
27
|
+
width: number;
|
|
31
28
|
imageNaturalWidth: number;
|
|
32
29
|
link?: string | undefined;
|
|
33
30
|
alt?: string | undefined;
|
|
@@ -40,7 +37,6 @@ export interface ImageBlockProps {
|
|
|
40
37
|
alignment: "left" | "center" | "right";
|
|
41
38
|
width: number;
|
|
42
39
|
borderWidth: number;
|
|
43
|
-
borderRadius: number;
|
|
44
40
|
borderColor: string;
|
|
45
41
|
isUploading?: boolean;
|
|
46
42
|
imageNaturalWidth: number;
|
|
@@ -4,6 +4,7 @@ import { PluginKey } from "@tiptap/pm/state";
|
|
|
4
4
|
export interface SelectionOptions {
|
|
5
5
|
HTMLAttributes: Record<string, unknown>;
|
|
6
6
|
setSelectedNode: (node: Node) => void;
|
|
7
|
+
shouldHandleClick?: () => boolean;
|
|
7
8
|
}
|
|
8
9
|
declare module "@tiptap/core" {
|
|
9
10
|
interface Commands<ReturnType> {
|
|
@@ -4,31 +4,25 @@ export declare const textBlockSchema: z.ZodObject<{
|
|
|
4
4
|
paddingHorizontal: z.ZodNumber;
|
|
5
5
|
backgroundColor: z.ZodString;
|
|
6
6
|
borderWidth: z.ZodNumber;
|
|
7
|
-
borderRadius: z.ZodNumber;
|
|
8
7
|
borderColor: z.ZodString;
|
|
9
|
-
textColor: z.ZodString;
|
|
10
8
|
textAlign: z.ZodDefault<z.ZodEnum<["left", "center", "right", "justify"]>>;
|
|
11
9
|
selected: z.ZodDefault<z.ZodBoolean>;
|
|
12
10
|
id: z.ZodOptional<z.ZodString>;
|
|
13
11
|
}, "strip", z.ZodTypeAny, {
|
|
14
12
|
backgroundColor: string;
|
|
15
|
-
textColor: string;
|
|
16
|
-
paddingVertical: number;
|
|
17
|
-
paddingHorizontal: number;
|
|
18
13
|
borderColor: string;
|
|
19
14
|
borderWidth: number;
|
|
20
|
-
|
|
15
|
+
paddingVertical: number;
|
|
16
|
+
paddingHorizontal: number;
|
|
21
17
|
textAlign: "left" | "center" | "right" | "justify";
|
|
22
18
|
selected: boolean;
|
|
23
19
|
id?: string | undefined;
|
|
24
20
|
}, {
|
|
25
21
|
backgroundColor: string;
|
|
26
|
-
textColor: string;
|
|
27
|
-
paddingVertical: number;
|
|
28
|
-
paddingHorizontal: number;
|
|
29
22
|
borderColor: string;
|
|
30
23
|
borderWidth: number;
|
|
31
|
-
|
|
24
|
+
paddingVertical: number;
|
|
25
|
+
paddingHorizontal: number;
|
|
32
26
|
id?: string | undefined;
|
|
33
27
|
textAlign?: "left" | "center" | "right" | "justify" | undefined;
|
|
34
28
|
selected?: boolean | undefined;
|
|
@@ -38,9 +32,7 @@ export interface TextBlockProps {
|
|
|
38
32
|
paddingHorizontal: number;
|
|
39
33
|
backgroundColor: string;
|
|
40
34
|
borderWidth: number;
|
|
41
|
-
borderRadius: number;
|
|
42
35
|
borderColor: string;
|
|
43
|
-
textColor: string;
|
|
44
36
|
textAlign: "left" | "center" | "right" | "justify";
|
|
45
37
|
selected: boolean;
|
|
46
38
|
id?: string;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { Extension, Node } from "@tiptap/core";
|
|
2
2
|
import type { VariableNodeOptions, VariableOptions } from "./Variable.types";
|
|
3
3
|
export declare const VariableNode: Node<VariableNodeOptions, any>;
|
|
4
|
+
/**
|
|
5
|
+
* Extension that inserts an empty variable chip when user types {{
|
|
6
|
+
* This is used when autocomplete is disabled (disableVariablesAutocomplete=true)
|
|
7
|
+
*/
|
|
8
|
+
export declare const VariableInputRule: Extension<any, any>;
|
|
9
|
+
/**
|
|
10
|
+
* Extension that provides variable autocomplete suggestions.
|
|
11
|
+
* When user types {{, shows a dropdown with available variables.
|
|
12
|
+
* Pass `variables` option to configure available variables.
|
|
13
|
+
* Pass `disableSuggestions: true` to disable autocomplete (falls back to VariableInputRule behavior).
|
|
14
|
+
*/
|
|
4
15
|
export declare const Variable: Extension<VariableOptions, any>;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated This extension has been removed. Variable conversion now happens via VariableInputRule or Variable.
|
|
18
|
+
* This is a no-op extension provided for backwards compatibility and will be removed in a future major version.
|
|
19
|
+
*/
|
|
20
|
+
export declare const VariableTypeHandler: Extension<any, any>;
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
import type { Editor, Range } from "@tiptap/core";
|
|
2
2
|
import type { SuggestionOptions, SuggestionProps } from "@tiptap/suggestion";
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
range: Range;
|
|
6
|
-
clientRect: () => DOMRect | null;
|
|
7
|
-
items: string[];
|
|
8
|
-
command: (props: {
|
|
9
|
-
editor: Editor;
|
|
10
|
-
range: Range;
|
|
11
|
-
props: string;
|
|
12
|
-
}) => void;
|
|
3
|
+
export interface VariableNodeOptions {
|
|
4
|
+
HTMLAttributes?: Record<string, unknown>;
|
|
13
5
|
}
|
|
6
|
+
export interface VariableNodeAttributes {
|
|
7
|
+
id: string;
|
|
8
|
+
isInvalid: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Options for the Variable suggestion extension that provides autocomplete.
|
|
12
|
+
*/
|
|
14
13
|
export interface VariableOptions {
|
|
15
14
|
HTMLAttributes?: Record<string, unknown>;
|
|
16
15
|
suggestion?: Partial<SuggestionOptions>;
|
|
16
|
+
/** Variables available for autocomplete suggestions */
|
|
17
17
|
variables?: Record<string, unknown>;
|
|
18
|
+
/** When true, disables the autocomplete dropdown */
|
|
19
|
+
disableSuggestions?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export interface VariableCommandProps {
|
|
20
22
|
editor: Editor;
|
|
21
23
|
range: Range;
|
|
22
24
|
props: string;
|
|
23
25
|
}
|
|
24
|
-
export interface VariableSuggestionProps
|
|
26
|
+
export interface VariableSuggestionProps {
|
|
27
|
+
editor: Editor;
|
|
28
|
+
range: Range;
|
|
29
|
+
clientRect: () => DOMRect | null;
|
|
30
|
+
items: string[];
|
|
31
|
+
command: (props: {
|
|
32
|
+
editor: Editor;
|
|
33
|
+
range: Range;
|
|
34
|
+
props: string;
|
|
35
|
+
}) => void;
|
|
25
36
|
selected: number;
|
|
26
37
|
}
|
|
27
|
-
export interface VariableNodeOptions {
|
|
28
|
-
HTMLAttributes?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
export interface VariableNodeAttributes {
|
|
31
|
-
id: string | null;
|
|
32
|
-
}
|
|
33
38
|
export interface VariableSuggestionsProps extends SuggestionProps {
|
|
34
39
|
items: string[];
|
|
35
40
|
command: (item: string) => void;
|
|
@@ -37,4 +42,3 @@ export interface VariableSuggestionsProps extends SuggestionProps {
|
|
|
37
42
|
query: string;
|
|
38
43
|
selected: number;
|
|
39
44
|
}
|
|
40
|
-
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Node } from "@tiptap/pm/model";
|
|
2
|
-
export
|
|
3
|
-
variables?: Record<string, unknown>;
|
|
2
|
+
export interface ExtensionKitOptions {
|
|
4
3
|
setSelectedNode?: (node: Node) => void;
|
|
5
|
-
|
|
4
|
+
shouldHandleClick?: () => boolean;
|
|
5
|
+
/** Variables available for autocomplete suggestions */
|
|
6
|
+
variables?: Record<string, unknown>;
|
|
7
|
+
/** When true, disables variable autocomplete and allows typing any variable */
|
|
8
|
+
disableVariablesAutocomplete?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const ExtensionKit: (options?: ExtensionKitOptions) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any>)[];
|
|
6
11
|
export default ExtensionKit;
|
|
@@ -10,6 +10,9 @@ export { StarterKit } from "@tiptap/starter-kit";
|
|
|
10
10
|
export { Blockquote } from "./Blockquote";
|
|
11
11
|
export { Button } from "./Button";
|
|
12
12
|
export { ButtonRow } from "./ButtonRow";
|
|
13
|
+
export { Column } from "./Column";
|
|
14
|
+
export { ColumnRow } from "./ColumnRow";
|
|
15
|
+
export { ColumnCell } from "./ColumnCell";
|
|
13
16
|
export { CustomCode } from "./CustomCode";
|
|
14
17
|
export { Divider } from "./Divider";
|
|
15
18
|
export { Document } from "./Document";
|
|
@@ -24,4 +27,4 @@ export { Paragraph } from "./Paragraph";
|
|
|
24
27
|
export { Selection } from "./Selection";
|
|
25
28
|
export { SlashMenu } from "./SlashMenu";
|
|
26
29
|
export { UniqueId } from "./UniqueId";
|
|
27
|
-
export {
|
|
30
|
+
export { VariableNode, VariableInputRule, VariablePaste, Variable, VariableTypeHandler, } from "./Variable";
|