@refactico/pages 0.2.0 → 0.2.2
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/index.cjs +944 -5
- package/dist/index.d.ts +87 -0
- package/dist/index.js +938 -7
- package/dist/style.css +292 -8
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
3
|
import { RefObject } from 'react';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -11,6 +12,23 @@ export declare const ALIGNMENT_CLASSES: {
|
|
|
11
12
|
readonly justify: "text-justify";
|
|
12
13
|
};
|
|
13
14
|
|
|
15
|
+
export declare interface BlockDiff {
|
|
16
|
+
type: DiffType;
|
|
17
|
+
oldBlock?: EditorBlock;
|
|
18
|
+
newBlock?: EditorBlock;
|
|
19
|
+
changes?: PropertyChange[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Renders an EditorBlock in read-only mode for diff visualization
|
|
24
|
+
*/
|
|
25
|
+
export declare function BlockRenderer({ block, theme }: BlockRendererProps): JSX.Element | null;
|
|
26
|
+
|
|
27
|
+
declare interface BlockRendererProps {
|
|
28
|
+
block: EditorBlock;
|
|
29
|
+
theme: Theme;
|
|
30
|
+
}
|
|
31
|
+
|
|
14
32
|
export declare type BlockType = 'text' | 'heading' | 'image' | 'code' | 'table' | 'divider' | 'quote' | 'list' | 'callout';
|
|
15
33
|
|
|
16
34
|
export declare const CALLOUT_ICONS: {
|
|
@@ -134,6 +152,11 @@ export declare interface CodeBlock {
|
|
|
134
152
|
filename?: string;
|
|
135
153
|
}
|
|
136
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Compare two EditorData objects and return diff result
|
|
157
|
+
*/
|
|
158
|
+
export declare function compareEditorData(oldData: EditorData, newData: EditorData): DiffResult;
|
|
159
|
+
|
|
137
160
|
export declare const createCalloutBlock: (variant?: "info" | "warning" | "success" | "error" | "tip") => EditorBlock;
|
|
138
161
|
|
|
139
162
|
export declare const createCodeBlock: (code?: string, language?: string) => EditorBlock;
|
|
@@ -154,6 +177,25 @@ export declare const createTableBlock: (rows?: number, cols?: number) => EditorB
|
|
|
154
177
|
|
|
155
178
|
export declare const createTextBlock: (content?: string) => EditorBlock;
|
|
156
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Deep compare two values and return if they are equal
|
|
182
|
+
*/
|
|
183
|
+
export declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
184
|
+
|
|
185
|
+
export declare interface DiffResult {
|
|
186
|
+
blocks: BlockDiff[];
|
|
187
|
+
summary: DiffSummary;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export declare interface DiffSummary {
|
|
191
|
+
added: number;
|
|
192
|
+
removed: number;
|
|
193
|
+
modified: number;
|
|
194
|
+
unchanged: number;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export declare type DiffType = 'added' | 'removed' | 'modified' | 'unchanged';
|
|
198
|
+
|
|
157
199
|
/**
|
|
158
200
|
* Divider style mapping
|
|
159
201
|
*/
|
|
@@ -190,6 +232,11 @@ export declare const FONT_SIZE_CLASSES: {
|
|
|
190
232
|
readonly xl: "text-xl leading-relaxed";
|
|
191
233
|
};
|
|
192
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Format a value for display
|
|
237
|
+
*/
|
|
238
|
+
export declare function formatValue(value: unknown): string;
|
|
239
|
+
|
|
193
240
|
/**
|
|
194
241
|
* Generate a unique ID for blocks.
|
|
195
242
|
* Uses crypto.randomUUID() when available (modern browsers & Node 19+),
|
|
@@ -197,6 +244,16 @@ export declare const FONT_SIZE_CLASSES: {
|
|
|
197
244
|
*/
|
|
198
245
|
export declare const generateId: () => string;
|
|
199
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Get a preview of block content
|
|
249
|
+
*/
|
|
250
|
+
export declare function getBlockPreview(block: EditorBlock, maxLength?: number): string;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Get a human-readable label for a block type
|
|
254
|
+
*/
|
|
255
|
+
export declare function getBlockTypeLabel(block: EditorBlock): string;
|
|
256
|
+
|
|
200
257
|
/**
|
|
201
258
|
* Get muted text class
|
|
202
259
|
*/
|
|
@@ -212,6 +269,11 @@ export declare const getPlaceholderClass: (isDark: boolean) => string;
|
|
|
212
269
|
*/
|
|
213
270
|
export declare const getPrimaryTextClass: (isDark: boolean) => string;
|
|
214
271
|
|
|
272
|
+
/**
|
|
273
|
+
* Get property changes between two blocks
|
|
274
|
+
*/
|
|
275
|
+
export declare function getPropertyChanges(oldBlock: EditorBlock, newBlock: EditorBlock): PropertyChange[];
|
|
276
|
+
|
|
215
277
|
/**
|
|
216
278
|
* Get secondary text class
|
|
217
279
|
*/
|
|
@@ -260,6 +322,23 @@ export declare interface ImageBlock {
|
|
|
260
322
|
*/
|
|
261
323
|
export declare const isDarkTheme: (theme: Theme) => boolean;
|
|
262
324
|
|
|
325
|
+
export declare function JsonDiff({ oldData, newData, onChange, theme, className, initialSplitPosition, minPanelWidth, allowRevert, }: JsonDiffProps): JSX.Element;
|
|
326
|
+
|
|
327
|
+
export declare interface JsonDiffProps {
|
|
328
|
+
oldData: EditorData;
|
|
329
|
+
newData: EditorData;
|
|
330
|
+
/** Callback when user reverts changes. Receives the updated EditorData. */
|
|
331
|
+
onChange?: (data: EditorData) => void;
|
|
332
|
+
theme?: Theme;
|
|
333
|
+
className?: string;
|
|
334
|
+
/** Initial split position as percentage (0-100). Default: 50 */
|
|
335
|
+
initialSplitPosition?: number;
|
|
336
|
+
/** Minimum panel width as percentage. Default: 20 */
|
|
337
|
+
minPanelWidth?: number;
|
|
338
|
+
/** Allow reverting individual changes. Default: true */
|
|
339
|
+
allowRevert?: boolean;
|
|
340
|
+
}
|
|
341
|
+
|
|
263
342
|
export declare interface ListBlock {
|
|
264
343
|
type: 'list';
|
|
265
344
|
id: string;
|
|
@@ -283,6 +362,12 @@ export declare interface PagesEditorProps {
|
|
|
283
362
|
theme?: Theme;
|
|
284
363
|
}
|
|
285
364
|
|
|
365
|
+
export declare interface PropertyChange {
|
|
366
|
+
path: string;
|
|
367
|
+
oldValue: unknown;
|
|
368
|
+
newValue: unknown;
|
|
369
|
+
}
|
|
370
|
+
|
|
286
371
|
/**
|
|
287
372
|
* Quote style mapping
|
|
288
373
|
*/
|
|
@@ -373,4 +458,6 @@ export declare function useClickOutside<T extends HTMLElement>(ref: RefObject<T
|
|
|
373
458
|
|
|
374
459
|
export declare const validateEditorData: (data: unknown) => data is EditorData;
|
|
375
460
|
|
|
461
|
+
export declare type ViewMode = 'split' | 'unified';
|
|
462
|
+
|
|
376
463
|
export { }
|