@1urso/generic-editor 0.1.36 → 0.1.38

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,46 @@ 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
+
96
+ ### Vínculos de Estilo (Cores por Variável)
97
+
98
+ - **O que é**: vincule propriedades de estilo (cor do texto, cor de fundo, cor da borda) diretamente a variáveis de dados, sem precisar de regras condicionais.
99
+ - **Como usar**:
100
+ - Abra **Configurações Avançadas** do elemento.
101
+ - Na seção **Vínculos de Estilo (Data Binding)**, escolha uma variável para cada propriedade desejada.
102
+ - Propriedades suportadas: `color`, `backgroundColor`, `borderColor`.
103
+ - **Formato dos valores**:
104
+ - Aceita cores CSS válidas: `#RRGGBB`, `#RRGGBBAA` (convertido para `rgba`), nomes CSS (`red`, `blue`), `rgb()`, `rgba()`.
105
+ - **Exemplo (JSON)**:
106
+ ```json
107
+ {
108
+ "type": "text",
109
+ "content": "Preço: {{price}}",
110
+ "x": 50,
111
+ "y": 50,
112
+ "width": 200,
113
+ "height": 40,
114
+ "styleBindings": {
115
+ "color": "priceColor",
116
+ "backgroundColor": "tagBg"
117
+ }
118
+ }
119
+ ```
120
+ Se `data = { "price": 10, "priceColor": "#FF0000", "tagBg": "rgba(0,0,0,0.1)" }`, o texto será renderizado com `color: #FF0000` e `backgroundColor: rgba(0,0,0,0.1)`.
121
+
82
122
  ### Basic Manipulation
83
123
 
84
124
  The editor offers an experience similar to design tools like Canva or Figma:
@@ -110,7 +150,6 @@ The editor offers an experience similar to design tools like Canva or Figma:
110
150
  **Right-click** and select **Advanced Settings** to access powerful data formatting and conditional styling options.
111
151
 
112
152
  - **Data Formatting**:
113
-
114
153
  - _Type_: Choose between Text (Default), Boolean (True/False), Date, or Number/Currency.
115
154
  - _Boolean_: Define custom labels for true/false values (e.g., "Active" / "Inactive").
116
155
  - _Date_: Custom date patterns (e.g., "DD/MM/YYYY HH:mm").
@@ -158,6 +197,18 @@ When right-clicking on an **Image** element:
158
197
  - _Stretch (Fill)_: The image fills the entire box, potentially being cropped or distorted depending on the aspect ratio.
159
198
  - **Bind Data**: Connects the image to a dynamic variable (e.g., Product Photo).
160
199
 
200
+ ### Export and Import
201
+
202
+ - **Export**: Saves the full layout (elements, list settings, mock data, canvas height).
203
+ - **Import**: Loads a previously exported JSON to restore the editor state.
204
+ - Images are serialized as **Base64** inside the layout to avoid external dependencies.
205
+
206
+ ### Preview and Simulation
207
+
208
+ - **Preview Panel**: See a live rendering of your layout.
209
+ - **Simulation Mode (Lists)**: Visualize entry animations and list behavior for incoming items.
210
+ - **Animations**: Configure entry animations (fade, slide, zoom, etc.) for list items.
211
+
161
212
  ---
162
213
 
163
214
  ## Developer Guide (Integration)
@@ -87,6 +87,9 @@ interface IEditorContext {
87
87
  groupElements: (ids: string[]) => void;
88
88
  ungroupElements: (groupId: string) => void;
89
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;
90
93
  setMockData: (data: any[], singleData: Record<string, any>) => void;
91
94
  updateListSettings: (settings: Partial<IListSettings>) => void;
92
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
  }