@1urso/generic-editor 0.1.26 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/context.d.ts +24 -3
- package/dist/generic-editor.js +6539 -5594
- package/dist/generic-editor.umd.cjs +75 -20
- package/package.json +1 -1
package/dist/editor/context.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ export interface IElementFormatting {
|
|
|
16
16
|
falseLabel?: string;
|
|
17
17
|
mapping?: Record<string, string>;
|
|
18
18
|
}
|
|
19
|
+
export interface IElementAnimation {
|
|
20
|
+
type: 'none' | 'fadeIn' | 'slideInLeft' | 'slideInRight' | 'slideInUp' | 'slideInDown' | 'zoomIn' | 'bounceIn' | 'pulse' | 'shake' | 'spin';
|
|
21
|
+
duration: number;
|
|
22
|
+
delay: number;
|
|
23
|
+
iterationCount?: number | 'infinite';
|
|
24
|
+
timingFunction?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
25
|
+
}
|
|
19
26
|
export interface IElement {
|
|
20
27
|
id: string;
|
|
21
28
|
type: 'text' | 'image' | 'box';
|
|
@@ -30,6 +37,7 @@ export interface IElement {
|
|
|
30
37
|
formatting?: IElementFormatting;
|
|
31
38
|
conditions?: IElementCondition[];
|
|
32
39
|
autoGrow?: boolean;
|
|
40
|
+
animation?: IElementAnimation;
|
|
33
41
|
}
|
|
34
42
|
export interface IListSettings {
|
|
35
43
|
sortProp?: string;
|
|
@@ -37,6 +45,7 @@ export interface IListSettings {
|
|
|
37
45
|
newestPosition?: 'top' | 'bottom';
|
|
38
46
|
scrollDirection?: 'up' | 'down';
|
|
39
47
|
containerHeight?: number;
|
|
48
|
+
entryAnimation?: IElementAnimation;
|
|
40
49
|
}
|
|
41
50
|
export interface IProp {
|
|
42
51
|
name: string;
|
|
@@ -44,7 +53,7 @@ export interface IProp {
|
|
|
44
53
|
}
|
|
45
54
|
interface IEditorState {
|
|
46
55
|
elements: IElement[];
|
|
47
|
-
|
|
56
|
+
selectedElementIds: string[];
|
|
48
57
|
isList: boolean;
|
|
49
58
|
mockData: any[];
|
|
50
59
|
singleMockData: Record<string, any>;
|
|
@@ -53,18 +62,30 @@ interface IEditorState {
|
|
|
53
62
|
availableProps: IProp[];
|
|
54
63
|
availableFonts: string[];
|
|
55
64
|
theme: 'light' | 'dark';
|
|
65
|
+
history: IElement[][];
|
|
66
|
+
historyIndex: number;
|
|
67
|
+
clipboard: IElement[];
|
|
56
68
|
}
|
|
57
69
|
interface IEditorContext {
|
|
58
70
|
state: IEditorState;
|
|
59
71
|
addElement: (element: Omit<IElement, 'id' | 'x' | 'y' | 'width' | 'height'> & Partial<Pick<IElement, 'x' | 'y' | 'width' | 'height'>>) => void;
|
|
60
72
|
removeElement: (id: string) => void;
|
|
61
|
-
|
|
73
|
+
removeSelected: () => void;
|
|
74
|
+
selectElement: (id: string | null, multi?: boolean) => void;
|
|
62
75
|
moveElement: (dragIndex: number, hoverIndex: number) => void;
|
|
63
|
-
updateElement: (id: string, updates: Partial<IElement
|
|
76
|
+
updateElement: (id: string, updates: Partial<IElement>, addToHistory?: boolean) => void;
|
|
77
|
+
updateElements: (updates: {
|
|
78
|
+
id: string;
|
|
79
|
+
changes: Partial<IElement>;
|
|
80
|
+
}[], addToHistory?: boolean) => void;
|
|
64
81
|
setMockData: (data: any[], singleData: Record<string, any>) => void;
|
|
65
82
|
updateListSettings: (settings: Partial<IListSettings>) => void;
|
|
66
83
|
setCanvasHeight: (height: number) => void;
|
|
67
84
|
loadState: (savedState: Partial<IEditorState>) => void;
|
|
85
|
+
undo: () => void;
|
|
86
|
+
redo: () => void;
|
|
87
|
+
copy: () => void;
|
|
88
|
+
paste: () => void;
|
|
68
89
|
}
|
|
69
90
|
export declare const EditorProvider: React.FC<{
|
|
70
91
|
children: ReactNode;
|