@1urso/generic-editor 0.1.35 → 0.1.37

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 CHANGED
@@ -79,6 +79,20 @@ import "@radix-ui/themes/styles.css";
79
79
 
80
80
  This section describes the features available to the **end user** who will use the editor on your platform.
81
81
 
82
+ ### Grouping and Layers Panel
83
+
84
+ - **Group Elements**:
85
+ - Select multiple elements and use the context menu option **Agrupar Seleção**.
86
+ - Groups act as a bounding box; moving the group moves all children.
87
+ - Clicking a child selects its parent group for consistent interactions.
88
+ - **Rename Layers**:
89
+ - Right-click any element or group and choose **Renomear...**.
90
+ - **Layers Panel (Left Sidebar)**:
91
+ - Shows a tree of Groups and their children.
92
+ - Drag any element in the list onto a Group to add it.
93
+ - Drop an element onto the “Soltar aqui para remover do grupo” area to ungroup it.
94
+ - Collapse/expand groups to focus on what matters.
95
+
82
96
  ### Basic Manipulation
83
97
 
84
98
  The editor offers an experience similar to design tools like Canva or Figma:
@@ -158,6 +172,18 @@ When right-clicking on an **Image** element:
158
172
  - _Stretch (Fill)_: The image fills the entire box, potentially being cropped or distorted depending on the aspect ratio.
159
173
  - **Bind Data**: Connects the image to a dynamic variable (e.g., Product Photo).
160
174
 
175
+ ### Export and Import
176
+
177
+ - **Export**: Saves the full layout (elements, list settings, mock data, canvas height).
178
+ - **Import**: Loads a previously exported JSON to restore the editor state.
179
+ - Images are serialized as **Base64** inside the layout to avoid external dependencies.
180
+
181
+ ### Preview and Simulation
182
+
183
+ - **Preview Panel**: See a live rendering of your layout.
184
+ - **Simulation Mode (Lists)**: Visualize entry animations and list behavior for incoming items.
185
+ - **Animations**: Configure entry animations (fade, slide, zoom, etc.) for list items.
186
+
161
187
  ---
162
188
 
163
189
  ## Developer Guide (Integration)
@@ -25,7 +25,9 @@ export interface IElementAnimation {
25
25
  }
26
26
  export interface IElement {
27
27
  id: string;
28
- type: 'text' | 'image' | 'box';
28
+ type: 'text' | 'image' | 'box' | 'group';
29
+ name?: string;
30
+ groupId?: string;
29
31
  content: string;
30
32
  x: number;
31
33
  y: number;
@@ -38,6 +40,7 @@ export interface IElement {
38
40
  conditions?: IElementCondition[];
39
41
  autoGrow?: boolean;
40
42
  animation?: IElementAnimation;
43
+ styleBindings?: Record<string, string>;
41
44
  }
42
45
  export interface IListSettings {
43
46
  sortProp?: string;
@@ -81,6 +84,12 @@ interface IEditorContext {
81
84
  id: string;
82
85
  changes: Partial<IElement>;
83
86
  }[], addToHistory?: boolean) => void;
87
+ groupElements: (ids: string[]) => void;
88
+ ungroupElements: (groupId: string) => void;
89
+ renameElement: (id: string, name: string) => void;
90
+ addToGroup: (elementId: string, groupId: string) => void;
91
+ removeFromGroup: (elementId: string) => void;
92
+ resizeGroup: (groupId: string, newWidth: number, newHeight: number) => void;
84
93
  setMockData: (data: any[], singleData: Record<string, any>) => void;
85
94
  updateListSettings: (settings: Partial<IListSettings>) => void;
86
95
  setCanvasHeight: (height: number) => void;
@@ -2,7 +2,7 @@ import { default as React } from 'react';
2
2
  import { ILayout } from './types';
3
3
  interface EditorProps {
4
4
  layout: ILayout;
5
- initialState?: any;
5
+ initialState?: unknown;
6
6
  onSave?: (json: string) => void;
7
7
  theme?: 'light' | 'dark';
8
8
  }
@@ -0,0 +1,5 @@
1
+ import { IElement } from '../context';
2
+ export declare const processLayout: (elements: IElement[], dataContext: any) => {
3
+ elements: IElement[];
4
+ totalHeight: number;
5
+ };