@codingfactory/mediables-vue 2.3.6 → 2.4.1
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/{PixiFrameExporter-DM4yaigy.cjs → PixiFrameExporter-8_WF3thr.cjs} +2 -2
- package/dist/{PixiFrameExporter-DM4yaigy.cjs.map → PixiFrameExporter-8_WF3thr.cjs.map} +1 -1
- package/dist/{PixiFrameExporter-BAZtrvGS.js → PixiFrameExporter-vXYgP3wU.js} +2 -2
- package/dist/{PixiFrameExporter-BAZtrvGS.js.map → PixiFrameExporter-vXYgP3wU.js.map} +1 -1
- package/dist/components/ImageEditorModal.vue.d.ts +4 -2
- package/dist/composables/useImageEditorModal.d.ts +288 -16
- package/dist/composables/useRadialMenu.d.ts +1 -1
- package/dist/editor-Bl0mzqgX.cjs +42 -0
- package/dist/editor-Bl0mzqgX.cjs.map +1 -0
- package/dist/{editor-BWpslm--.js → editor-DiiyShiW.js} +419 -303
- package/dist/editor-DiiyShiW.js.map +1 -0
- package/dist/{index-CMOpozRS.js → index-B42SSGjg.js} +7717 -7554
- package/dist/index-B42SSGjg.js.map +1 -0
- package/dist/index-CT0VqMgf.cjs +342 -0
- package/dist/index-CT0VqMgf.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/mediables-vanilla.cjs +1 -1
- package/dist/mediables-vanilla.mjs +1 -1
- package/dist/mediables-vue.cjs +1 -1
- package/dist/mediables-vue.mjs +59 -52
- package/dist/style.css +1 -1
- package/dist/types/editor.d.ts +87 -2
- package/dist/utils/imageEditorState.d.ts +26 -0
- package/package.json +1 -1
- package/dist/editor-BWpslm--.js.map +0 -1
- package/dist/editor-D_dX1XkE.cjs +0 -42
- package/dist/editor-D_dX1XkE.cjs.map +0 -1
- package/dist/index-6-ArBBEQ.cjs +0 -342
- package/dist/index-6-ArBBEQ.cjs.map +0 -1
- package/dist/index-CMOpozRS.js.map +0 -1
package/dist/types/editor.d.ts
CHANGED
|
@@ -42,7 +42,9 @@ export interface VariantSavePayload {
|
|
|
42
42
|
height: number;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Event payload when saving an edited image
|
|
45
|
+
* Event payload when saving an edited image.
|
|
46
|
+
* `state` is the canonical serializable state (v3.0.0+).
|
|
47
|
+
* `metadata` is kept for backward compatibility with existing consumers.
|
|
46
48
|
*/
|
|
47
49
|
export interface SaveEventPayload {
|
|
48
50
|
imageData: string;
|
|
@@ -50,7 +52,9 @@ export interface SaveEventPayload {
|
|
|
50
52
|
width: number;
|
|
51
53
|
height: number;
|
|
52
54
|
};
|
|
53
|
-
|
|
55
|
+
state: ImageEditorSessionState;
|
|
56
|
+
/** @deprecated Use `state` instead. Kept for backward compatibility. */
|
|
57
|
+
metadata?: {
|
|
54
58
|
hasCrop: boolean;
|
|
55
59
|
cropRect: CropRect | null;
|
|
56
60
|
filters: string[];
|
|
@@ -170,3 +174,84 @@ export type EditorTool = 'crop' | 'filter' | 'adjust' | 'text' | 'draw' | 'none'
|
|
|
170
174
|
* Editor view mode
|
|
171
175
|
*/
|
|
172
176
|
export type ViewMode = 'edit' | 'preview' | 'split';
|
|
177
|
+
/**
|
|
178
|
+
* Primitive types allowed in filter parameter values.
|
|
179
|
+
*/
|
|
180
|
+
export type ImageEditorPrimitive = string | number | boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Serializable state for a single filter in the editor.
|
|
183
|
+
*/
|
|
184
|
+
export interface ImageEditorFilterState {
|
|
185
|
+
id: string;
|
|
186
|
+
enabled: boolean;
|
|
187
|
+
values: Record<string, ImageEditorPrimitive>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Canonical serializable state for the entire editor session.
|
|
191
|
+
* This is the single source of truth for editor state persistence.
|
|
192
|
+
*/
|
|
193
|
+
export interface ImageEditorSessionState {
|
|
194
|
+
version: 1;
|
|
195
|
+
crop: {
|
|
196
|
+
rect: CropRect | null;
|
|
197
|
+
aspectRatio: string;
|
|
198
|
+
shape: 'free' | 'square' | 'circle';
|
|
199
|
+
};
|
|
200
|
+
filters: ImageEditorFilterState[];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Payload emitted when saving an edited image (v3.0.0+).
|
|
204
|
+
* Uses Blob instead of base64 for better memory efficiency.
|
|
205
|
+
*/
|
|
206
|
+
export interface ImageEditorSavePayload {
|
|
207
|
+
blob: Blob;
|
|
208
|
+
mimeType: string;
|
|
209
|
+
dimensions: {
|
|
210
|
+
width: number;
|
|
211
|
+
height: number;
|
|
212
|
+
};
|
|
213
|
+
state: ImageEditorSessionState;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Options for opening the image editor.
|
|
217
|
+
*/
|
|
218
|
+
export interface ImageEditorOpenOptions {
|
|
219
|
+
image?: string | Blob | File | null;
|
|
220
|
+
state?: ImageEditorSessionState | null;
|
|
221
|
+
sessionKey?: string | number;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Response from GET /editor/{uuid}/edit.
|
|
225
|
+
*/
|
|
226
|
+
export interface ImageEditorEditSessionResponse {
|
|
227
|
+
success: true;
|
|
228
|
+
media: Media;
|
|
229
|
+
editable_source_url: string;
|
|
230
|
+
editor_source_media_uuid: string | null;
|
|
231
|
+
editor_state: ImageEditorSessionState | null;
|
|
232
|
+
urls: {
|
|
233
|
+
original: string;
|
|
234
|
+
large?: string;
|
|
235
|
+
medium?: string;
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Response from POST /editor/{uuid}/save (202 Accepted).
|
|
240
|
+
*/
|
|
241
|
+
export interface ImageEditorSaveAcceptedResponse {
|
|
242
|
+
success: true;
|
|
243
|
+
message: string;
|
|
244
|
+
job_id: string;
|
|
245
|
+
status_url: string;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Response from GET /editor/jobs/{jobId} (polling endpoint).
|
|
249
|
+
*/
|
|
250
|
+
export interface ImageEditorJobStatusResponse {
|
|
251
|
+
success: boolean;
|
|
252
|
+
id: string;
|
|
253
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
254
|
+
media?: Media;
|
|
255
|
+
media_uuid?: string;
|
|
256
|
+
error?: string;
|
|
257
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Image Editor State normalizer/serializer.
|
|
3
|
+
* Single source of truth for converting between internal editor state
|
|
4
|
+
* and the canonical ImageEditorSessionState persistence format.
|
|
5
|
+
*/
|
|
6
|
+
import type { ImageEditorSessionState } from '../types/editor';
|
|
7
|
+
/**
|
|
8
|
+
* Normalize and validate an ImageEditorSessionState object.
|
|
9
|
+
* Strips invalid data and returns a clean, safe-to-persist state.
|
|
10
|
+
* Returns null if the input is fundamentally invalid.
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeEditorState(raw: unknown): ImageEditorSessionState | null;
|
|
13
|
+
/**
|
|
14
|
+
* Serialize an ImageEditorSessionState to a JSON string.
|
|
15
|
+
* Normalizes first to ensure only valid data is serialized.
|
|
16
|
+
*/
|
|
17
|
+
export declare function serializeEditorState(state: ImageEditorSessionState): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Deserialize a JSON string to an ImageEditorSessionState.
|
|
20
|
+
* Returns null if the JSON is invalid or doesn't pass validation.
|
|
21
|
+
*/
|
|
22
|
+
export declare function deserializeEditorState(json: string): ImageEditorSessionState | null;
|
|
23
|
+
/**
|
|
24
|
+
* Create an empty default ImageEditorSessionState.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createEmptyEditorState(): ImageEditorSessionState;
|