@trycourier/react-designer 0.0.0-canary-20251210164636 → 0.0.0-canary-20251219131027

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 (63) hide show
  1. package/README.md +244 -2
  2. package/dist/cjs/index.js +70 -56
  3. package/dist/cjs/index.js.map +4 -4
  4. package/dist/cjs/styles.css +182 -37
  5. package/dist/components/BrandEditor/Editor/Editor.d.ts +16 -1
  6. package/dist/components/Providers/api/template.d.ts +28 -1
  7. package/dist/components/Providers/store.d.ts +6 -0
  8. package/dist/components/Providers/useBrandActions.d.ts +1 -1
  9. package/dist/components/Providers/useTemplateActions.d.ts +6 -4
  10. package/dist/components/TemplateEditor/Channels/Email/Email.d.ts +3 -2
  11. package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +2 -1
  12. package/dist/components/TemplateEditor/Channels/Email/EmailLayout.d.ts +1 -1
  13. package/dist/components/TemplateEditor/Channels/Email/SideBar/SideBar.d.ts +6 -3
  14. package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +1 -1
  15. package/dist/components/TemplateEditor/Channels/Inbox/InboxLayout.d.ts +1 -1
  16. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeams.d.ts +3 -2
  17. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsLayout.d.ts +1 -1
  18. package/dist/components/TemplateEditor/Channels/MSTeams/SideBar/SideBar.d.ts +2 -3
  19. package/dist/components/TemplateEditor/Channels/Push/Push.d.ts +1 -1
  20. package/dist/components/TemplateEditor/Channels/Push/PushLayout.d.ts +1 -1
  21. package/dist/components/TemplateEditor/Channels/SMS/SMS.d.ts +1 -1
  22. package/dist/components/TemplateEditor/Channels/SMS/SMSLayout.d.ts +1 -1
  23. package/dist/components/TemplateEditor/Channels/Slack/SideBar/SideBar.d.ts +2 -3
  24. package/dist/components/TemplateEditor/Channels/Slack/Slack.d.ts +3 -2
  25. package/dist/components/TemplateEditor/Channels/Slack/SlackLayout.d.ts +1 -1
  26. package/dist/components/TemplateEditor/Channels/useChannels.d.ts +8 -0
  27. package/dist/components/TemplateEditor/TemplateEditor.d.ts +16 -1
  28. package/dist/components/TemplateEditor/hooks/usePragmaticDnd.d.ts +3 -2
  29. package/dist/components/TemplateEditor/hooks/useSyncEditorItems.d.ts +2 -1
  30. package/dist/components/TemplateEditor/index.d.ts +2 -14
  31. package/dist/components/TemplateEditor/store.d.ts +131 -0
  32. package/dist/components/extensions/Blockquote/Blockquote.types.d.ts +2 -2
  33. package/dist/components/extensions/Button/Button.types.d.ts +12 -12
  34. package/dist/components/extensions/Column/Column.types.d.ts +6 -6
  35. package/dist/components/extensions/Divider/Divider.types.d.ts +1 -1
  36. package/dist/components/extensions/ImageBlock/ImageBlock.types.d.ts +4 -4
  37. package/dist/components/extensions/TextBlock/TextBlock.types.d.ts +4 -4
  38. package/dist/components/extensions/Variable/Variable.d.ts +14 -1
  39. package/dist/components/extensions/Variable/Variable.types.d.ts +37 -0
  40. package/dist/components/extensions/Variable/VariableSuggestions.d.ts +7 -0
  41. package/dist/components/extensions/Variable/index.d.ts +1 -0
  42. package/dist/components/extensions/Variable/suggestion.d.ts +2 -0
  43. package/dist/components/extensions/extension-kit.d.ts +7 -2
  44. package/dist/components/extensions/index.d.ts +1 -1
  45. package/dist/components/hooks/index.d.ts +1 -0
  46. package/dist/components/hooks/useBlockConfig.d.ts +110 -0
  47. package/dist/components/ui/Blocks/CustomCodeBlock/index.d.ts +1 -1
  48. package/dist/components/ui/VariableEditor/VariableAutocomplete.d.ts +16 -0
  49. package/dist/components/ui/VariableEditor/VariableChipBase.d.ts +1 -1
  50. package/dist/components/ui/VariableEditor/VariableEditorToolbar.d.ts +15 -0
  51. package/dist/components/ui/VariableEditor/VariableInput.d.ts +2 -0
  52. package/dist/components/ui/VariableEditor/VariableTextarea.d.ts +2 -0
  53. package/dist/components/ui/VariableEditor/index.d.ts +2 -0
  54. package/dist/esm/index.js +70 -56
  55. package/dist/esm/index.js.map +4 -4
  56. package/dist/esm/styles.css +182 -37
  57. package/dist/index.d.ts +14 -0
  58. package/dist/lib/utils/index.d.ts +1 -0
  59. package/dist/styles.css +182 -37
  60. package/dist/types/elemental.schema.d.ts +3 -3
  61. package/dist/types/index.d.ts +1 -0
  62. package/dist/types/validation.types.d.ts +53 -0
  63. package/package.json +1 -1
@@ -19,7 +19,7 @@ export interface SMSRenderProps {
19
19
  editor: Editor;
20
20
  }) => void;
21
21
  }
22
- export interface SMSProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
22
+ export interface SMSProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
23
23
  readOnly?: boolean;
24
24
  headerRenderer?: ({ hidePublish, channels, routing, }: {
25
25
  hidePublish?: boolean;
@@ -1,4 +1,4 @@
1
1
  import type { SMSProps } from "./SMS";
2
2
  export interface SMSLayoutProps extends SMSProps {
3
3
  }
4
- export declare const SMSLayout: ({ hidePublish, theme, variables, channels, routing, colorScheme, ...rest }: SMSLayoutProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const SMSLayout: ({ hidePublish, theme, variables, disableVariablesAutocomplete, channels, routing, colorScheme, ...rest }: SMSLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,8 @@
1
1
  import type { Editor } from "@tiptap/react";
2
- type UniqueIdentifier = string | number;
2
+ import { type VisibleBlockItem } from "@/components/TemplateEditor/store";
3
3
  export interface SlackSideBarProps {
4
- items: UniqueIdentifier[];
4
+ items: VisibleBlockItem[];
5
5
  label?: string;
6
6
  editor?: Editor;
7
7
  }
8
8
  export declare const SlackSideBar: ({ items, label, editor }: SlackSideBarProps) => import("react/jsx-runtime").JSX.Element;
9
- export {};
@@ -1,4 +1,5 @@
1
1
  import type { MessageRouting } from "@/components/Providers/store";
2
+ import { type VisibleBlockItem } from "@/components/TemplateEditor/store";
2
3
  import type { TextMenuConfig } from "@/components/ui/TextMenu/config";
3
4
  import type { TiptapDoc } from "@/lib/utils";
4
5
  import type { ChannelType } from "@/store";
@@ -21,13 +22,13 @@ export interface SlackRenderProps {
21
22
  editor: Editor;
22
23
  }) => void;
23
24
  items: {
24
- Sidebar: string[];
25
+ Sidebar: VisibleBlockItem[];
25
26
  Editor: UniqueIdentifier[];
26
27
  };
27
28
  selectedNode: Node | null;
28
29
  slackEditor: Editor | null;
29
30
  }
30
- export interface SlackProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
31
+ export interface SlackProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
31
32
  readOnly?: boolean;
32
33
  headerRenderer?: ({ hidePublish, channels, routing, }: {
33
34
  hidePublish?: boolean;
@@ -4,4 +4,4 @@ export interface SlackLayoutProps extends SlackProps {
4
4
  }
5
5
  export declare const SlackEditorContainer: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
6
6
  export declare const SlackEditorMain: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
7
- export declare const SlackLayout: ({ hidePublish, theme, variables, channels, routing, colorScheme, }: SlackLayoutProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const SlackLayout: ({ hidePublish, theme, variables, disableVariablesAutocomplete, channels, routing, colorScheme, }: SlackLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,13 @@
1
1
  import { type Channel, type ChannelType } from "@/store";
2
+ import type { ElementalNode } from "@/types/elemental.types";
2
3
  import type { TemplateEditorProps } from "../TemplateEditor";
4
+ export declare const getChannelDefaults: (type: ChannelType) => {
5
+ elements: ElementalNode[];
6
+ raw?: {
7
+ title?: string;
8
+ text?: string;
9
+ };
10
+ };
3
11
  export declare const useChannels: ({ channels, routing, }: {
4
12
  /** @deprecated Use routing.channels instead. Will be removed in a future version. */
5
13
  channels?: ChannelType[];
@@ -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 { HTMLAttributes } from "react";
3
4
  import type { ChannelType } from "../../store";
4
5
  import type { BrandEditorProps } from "../BrandEditor";
@@ -8,8 +9,22 @@ export interface TemplateEditorProps extends Omit<HTMLAttributes<HTMLDivElement>
8
9
  theme?: Theme | string;
9
10
  value?: ElementalContent | null;
10
11
  onChange?: (value: ElementalContent) => void;
11
- /** @deprecated The variables prop is no longer used. Users can now type any variable directly without autocomplete suggestions. */
12
+ /**
13
+ * Variables available for autocomplete suggestions.
14
+ * When provided, typing {{ will show a dropdown with matching variables.
15
+ */
12
16
  variables?: Record<string, unknown>;
17
+ /**
18
+ * When true, disables variable autocomplete and allows users to type any variable name.
19
+ * When false (default), shows autocomplete dropdown with variables from the `variables` prop.
20
+ * @default false
21
+ */
22
+ disableVariablesAutocomplete?: boolean;
23
+ /**
24
+ * Configuration for custom variable validation.
25
+ * Allows restricting which variable names are allowed and defining behavior on validation failure.
26
+ */
27
+ variableValidation?: VariableValidationConfig;
13
28
  hidePublish?: boolean;
14
29
  autoSave?: boolean;
15
30
  autoSaveDebounce?: number;
@@ -1,12 +1,13 @@
1
1
  import type { Editor } from "@tiptap/react";
2
+ import { type VisibleBlockItem } from "../store";
2
3
  type UniqueIdentifier = string | number;
3
4
  interface UsePragmaticDndProps {
4
5
  items: {
5
- Sidebar: string[];
6
+ Sidebar: VisibleBlockItem[];
6
7
  Editor: UniqueIdentifier[];
7
8
  };
8
9
  setItems: React.Dispatch<React.SetStateAction<{
9
- Sidebar: string[];
10
+ Sidebar: VisibleBlockItem[];
10
11
  Editor: UniqueIdentifier[];
11
12
  }>>;
12
13
  editor?: Editor | null;
@@ -1,8 +1,9 @@
1
1
  import type { Editor } from "@tiptap/react";
2
+ import { type VisibleBlockItem } from "../store";
2
3
  type UniqueIdentifier = string | number;
3
4
  interface UseSyncEditorItemsProps {
4
5
  setItems: React.Dispatch<React.SetStateAction<{
5
- Sidebar: string[];
6
+ Sidebar: VisibleBlockItem[];
6
7
  Editor: UniqueIdentifier[];
7
8
  }>>;
8
9
  rafId: React.MutableRefObject<number | null>;
@@ -1,30 +1,18 @@
1
1
  export { BrandFooter } from "@/components/BrandEditor/Editor/BrandFooter";
2
- export { PreviewPanel } from "@/components/ui/PreviewPanel";
3
- export { TextMenu } from "@/components/ui/TextMenu";
4
- export { cn, convertElementalToTiptap, convertTiptapToElemental } from "@/lib/utils";
5
- export { VariableInput, VariableTextarea } from "@/components/ui/VariableEditor";
6
- export { getFlattenedVariables } from "@/components/utils/getFlattenedVariables";
7
- export { useChannels } from "./Channels";
2
+ export { useChannels, getChannelDefaults } from "./Channels";
8
3
  export { default as EmailEditor } from "./Channels/Email/EmailEditor";
9
4
  export * from "./TemplateEditor";
10
5
  export { SideBar as EmailSideBar, SideBarItemDetails as EmailSideBarItemDetails, } from "./Channels/Email/SideBar";
11
6
  export { SideBar as InboxSideBar } from "./Channels/Inbox/SideBar";
12
7
  export { MSTeamsSideBar } from "./Channels/MSTeams/SideBar";
13
8
  export { SlackSideBar, SlackSideBarItemDetails } from "./Channels/Slack/SideBar";
9
+ export { EmailEditorContainer, EmailEditorMain, type EmailEditorProps, type InboxEditorProps, type MSTeamsEditorProps, type PushEditorProps, type SlackEditorProps, type SMSEditorProps, } from "./Channels";
14
10
  export declare const EmailChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").EmailProps & import("react").RefAttributes<HTMLDivElement>>>;
15
11
  export declare const SMSChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").SMSProps & import("react").RefAttributes<HTMLDivElement>>>;
16
12
  export declare const PushChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").PushProps & import("react").RefAttributes<HTMLDivElement>>>;
17
13
  export declare const InboxChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").InboxProps & import("react").RefAttributes<HTMLDivElement>>>;
18
14
  export declare const MSTeamsChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").MSTeamsProps & import("react").RefAttributes<HTMLDivElement>>>;
19
15
  export declare const SlackChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").SlackProps & import("react").RefAttributes<HTMLDivElement>>>;
20
- export { EmailEditorContainer, EmailEditorMain, type EmailEditorProps, type InboxEditorProps, type MSTeamsEditorProps, type PushEditorProps, type SlackEditorProps, type SMSEditorProps, } from "./Channels";
21
- export { CHANNELS } from "@/channels";
22
- export type { ChannelType } from "@/store";
23
- export type { ElementalContent } from "@/types";
24
16
  export { ChannelRootContainer, EditorSidebar } from "./Layout";
25
17
  export { InboxEditor, MSTeamsEditor, PushEditor, SlackEditor, SMSEditor } from "./Channels";
26
- export { useAutoSave } from "@/hooks/useAutoSave";
27
18
  export { useDebouncedFlush } from "./hooks/useDebouncedFlush";
28
- export { Status as TemplateStatus } from "@/components/ui/Status";
29
- export { MonacoCodeEditor } from "@/components/extensions/CustomCode/MonacoCodeEditor";
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;
@@ -29,6 +30,15 @@ export declare const isSidebarExpandedAtom: import("jotai").PrimitiveAtom<boolea
29
30
  export declare const variableValuesAtom: import("jotai").PrimitiveAtom<Record<string, string>> & {
30
31
  init: Record<string, string>;
31
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
+ };
32
42
  export declare const isDraggingAtom: import("jotai").PrimitiveAtom<boolean> & {
33
43
  init: boolean;
34
44
  };
@@ -45,3 +55,124 @@ export declare const flushFunctionsAtom: import("jotai").WritableAtom<Map<string
45
55
  fn?: FlushFunction;
46
56
  }], void>;
47
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
  }>;
@@ -13,31 +13,31 @@ export declare const buttonSchema: z.ZodObject<{
13
13
  textColor: z.ZodOptional<z.ZodString>;
14
14
  borderColor: z.ZodOptional<z.ZodString>;
15
15
  }, "strip", z.ZodTypeAny, {
16
- padding: number;
17
- label: string;
18
16
  backgroundColor: string;
19
- alignment: "left" | "center" | "right";
20
17
  borderRadius: number;
21
- fontStyle: "italic" | "normal";
22
- fontWeight: "bold" | "normal";
18
+ label: string;
19
+ alignment: "left" | "center" | "right";
20
+ padding: number;
21
+ fontWeight: "normal" | "bold";
22
+ fontStyle: "normal" | "italic";
23
23
  isUnderline: boolean;
24
24
  isStrike: boolean;
25
25
  link?: string | undefined;
26
- textColor?: string | undefined;
27
26
  borderColor?: string | undefined;
27
+ textColor?: string | undefined;
28
28
  }, {
29
- padding: number;
30
- label: string;
31
29
  backgroundColor: string;
32
- alignment: "left" | "center" | "right";
33
30
  borderRadius: number;
34
- fontStyle: "italic" | "normal";
35
- fontWeight: "bold" | "normal";
31
+ label: string;
32
+ alignment: "left" | "center" | "right";
33
+ padding: number;
34
+ fontWeight: "normal" | "bold";
35
+ fontStyle: "normal" | "italic";
36
36
  isUnderline: boolean;
37
37
  isStrike: boolean;
38
38
  link?: string | undefined;
39
- textColor?: string | undefined;
40
39
  borderColor?: string | undefined;
40
+ textColor?: string | undefined;
41
41
  }>;
42
42
  export interface ButtonProps {
43
43
  label: string;
@@ -20,22 +20,22 @@ export declare const columnSchema: z.ZodObject<{
20
20
  }>, "many">>;
21
21
  }, "strip", z.ZodTypeAny, {
22
22
  backgroundColor: string;
23
- paddingVertical: number;
24
- paddingHorizontal: number;
25
- borderWidth: number;
26
23
  borderColor: string;
24
+ borderWidth: number;
27
25
  borderRadius: number;
26
+ paddingVertical: number;
27
+ paddingHorizontal: number;
28
28
  columnsCount: number;
29
29
  cells?: {
30
30
  elements: any[];
31
31
  }[] | undefined;
32
32
  }, {
33
33
  backgroundColor?: string | undefined;
34
- paddingVertical?: number | undefined;
35
- paddingHorizontal?: number | undefined;
36
- borderWidth?: number | undefined;
37
34
  borderColor?: string | undefined;
35
+ borderWidth?: number | undefined;
38
36
  borderRadius?: number | undefined;
37
+ paddingVertical?: number | undefined;
38
+ paddingHorizontal?: number | undefined;
39
39
  columnsCount?: number | undefined;
40
40
  cells?: {
41
41
  elements: any[];
@@ -9,8 +9,8 @@ export declare const dividerSchema: z.ZodObject<{
9
9
  padding: number;
10
10
  color: string;
11
11
  size: number;
12
- variant: "divider" | "spacer";
13
12
  radius: number;
13
+ variant: "divider" | "spacer";
14
14
  }, {
15
15
  padding: number;
16
16
  color: string;
@@ -10,21 +10,21 @@ export declare const imageBlockSchema: z.ZodObject<{
10
10
  isUploading: z.ZodOptional<z.ZodBoolean>;
11
11
  imageNaturalWidth: z.ZodNumber;
12
12
  }, "strip", z.ZodTypeAny, {
13
- width: number;
14
- borderWidth: number;
15
13
  borderColor: string;
14
+ borderWidth: number;
16
15
  alignment: "left" | "center" | "right";
17
16
  sourcePath: string;
17
+ width: number;
18
18
  imageNaturalWidth: number;
19
19
  link?: string | undefined;
20
20
  alt?: string | undefined;
21
21
  isUploading?: boolean | undefined;
22
22
  }, {
23
- width: number;
24
- borderWidth: number;
25
23
  borderColor: string;
24
+ borderWidth: number;
26
25
  alignment: "left" | "center" | "right";
27
26
  sourcePath: string;
27
+ width: number;
28
28
  imageNaturalWidth: number;
29
29
  link?: string | undefined;
30
30
  alt?: string | undefined;
@@ -10,19 +10,19 @@ export declare const textBlockSchema: z.ZodObject<{
10
10
  id: z.ZodOptional<z.ZodString>;
11
11
  }, "strip", z.ZodTypeAny, {
12
12
  backgroundColor: string;
13
+ borderColor: string;
14
+ borderWidth: number;
13
15
  paddingVertical: number;
14
16
  paddingHorizontal: number;
15
- borderWidth: number;
16
- borderColor: string;
17
17
  textAlign: "left" | "center" | "right" | "justify";
18
18
  selected: boolean;
19
19
  id?: string | undefined;
20
20
  }, {
21
21
  backgroundColor: string;
22
+ borderColor: string;
23
+ borderWidth: number;
22
24
  paddingVertical: number;
23
25
  paddingHorizontal: number;
24
- borderWidth: number;
25
- borderColor: string;
26
26
  id?: string | undefined;
27
27
  textAlign?: "left" | "center" | "right" | "justify" | undefined;
28
28
  selected?: boolean | undefined;
@@ -1,7 +1,20 @@
1
1
  import { Extension, Node } from "@tiptap/core";
2
- import type { VariableNodeOptions } from "./Variable.types";
2
+ import type { VariableNodeOptions, VariableOptions } from "./Variable.types";
3
3
  export declare const VariableNode: Node<VariableNodeOptions, any>;
4
4
  /**
5
5
  * Extension that inserts an empty variable chip when user types {{
6
+ * This is used when autocomplete is disabled (disableVariablesAutocomplete=true)
6
7
  */
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
+ */
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,3 +1,5 @@
1
+ import type { Editor, Range } from "@tiptap/core";
2
+ import type { SuggestionOptions, SuggestionProps } from "@tiptap/suggestion";
1
3
  export interface VariableNodeOptions {
2
4
  HTMLAttributes?: Record<string, unknown>;
3
5
  }
@@ -5,3 +7,38 @@ export interface VariableNodeAttributes {
5
7
  id: string;
6
8
  isInvalid: boolean;
7
9
  }
10
+ /**
11
+ * Options for the Variable suggestion extension that provides autocomplete.
12
+ */
13
+ export interface VariableOptions {
14
+ HTMLAttributes?: Record<string, unknown>;
15
+ suggestion?: Partial<SuggestionOptions>;
16
+ /** Variables available for autocomplete suggestions */
17
+ variables?: Record<string, unknown>;
18
+ /** When true, disables the autocomplete dropdown */
19
+ disableSuggestions?: boolean;
20
+ }
21
+ export interface VariableCommandProps {
22
+ editor: Editor;
23
+ range: Range;
24
+ props: string;
25
+ }
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;
36
+ selected: number;
37
+ }
38
+ export interface VariableSuggestionsProps extends SuggestionProps {
39
+ items: string[];
40
+ command: (item: string) => void;
41
+ editor: Editor;
42
+ query: string;
43
+ selected: number;
44
+ }
@@ -0,0 +1,7 @@
1
+ interface VariableSuggestionsProps {
2
+ items: string[];
3
+ command: (item: string) => void;
4
+ selected: number;
5
+ }
6
+ export declare const VariableSuggestions: React.FC<VariableSuggestionsProps>;
7
+ export {};
@@ -1,3 +1,4 @@
1
1
  export * from "./Variable";
2
2
  export * from "./Variable.types";
3
3
  export * from "./VariablePaste";
4
+ export * from "./VariableSuggestions";
@@ -0,0 +1,2 @@
1
+ import type { SuggestionOptions } from "@tiptap/suggestion";
2
+ export declare const suggestion: Partial<SuggestionOptions>;
@@ -1,6 +1,11 @@
1
1
  import type { Node } from "@tiptap/pm/model";
2
- export declare const ExtensionKit: (options?: {
2
+ export interface ExtensionKitOptions {
3
3
  setSelectedNode?: (node: Node) => void;
4
4
  shouldHandleClick?: () => boolean;
5
- }) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any>)[];
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;
@@ -27,4 +27,4 @@ export { Paragraph } from "./Paragraph";
27
27
  export { Selection } from "./Selection";
28
28
  export { SlashMenu } from "./SlashMenu";
29
29
  export { UniqueId } from "./UniqueId";
30
- export { VariableNode, VariableInputRule, VariablePaste } from "./Variable";
30
+ export { VariableNode, VariableInputRule, VariablePaste, Variable, VariableTypeHandler, } from "./Variable";
@@ -1,2 +1,3 @@
1
1
  export * from "./useNodeAttributes";
2
2
  export * from "./useVariables";
3
+ export * from "./useBlockConfig";