@fraczled/sdk 1.0.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/index.d.ts ADDED
@@ -0,0 +1,368 @@
1
+ // @fraczled/sdk Type Declarations
2
+
3
+ export type Unit = 'px' | 'in' | 'mm' | 'pt';
4
+
5
+ export interface DocumentSettings {
6
+ width: number;
7
+ height: number;
8
+ unit: Unit;
9
+ dpi: number;
10
+ bleed: number;
11
+ safeArea: number;
12
+ backgroundColor: string;
13
+ showBleed: boolean;
14
+ showSafeArea: boolean;
15
+ }
16
+
17
+ export type EffectStyleType =
18
+ | 'none'
19
+ | 'shadow'
20
+ | 'lift'
21
+ | 'hollow'
22
+ | 'splice'
23
+ | 'outline'
24
+ | 'echo'
25
+ | 'glitch'
26
+ | 'neon'
27
+ | 'background'
28
+ | 'blur'
29
+ | 'gradient_overlay'
30
+ | 'duotone'
31
+ | 'reflection';
32
+ export type EffectShapeType = 'none' | 'curve';
33
+
34
+ export interface EffectStyle {
35
+ type: EffectStyleType;
36
+ params: {
37
+ offset?: number;
38
+ direction?: number;
39
+ blur?: number;
40
+ transparency?: number;
41
+ thickness?: number;
42
+ color?: string;
43
+ intensity?: number;
44
+ roundness?: number;
45
+ spread?: number;
46
+ blurAmount?: number;
47
+ gradientColor1?: string;
48
+ gradientColor2?: string;
49
+ gradientAngle?: number;
50
+ duotoneLight?: string;
51
+ duotoneDark?: string;
52
+ reflectionOpacity?: number;
53
+ reflectionDistance?: number;
54
+ };
55
+ }
56
+
57
+ export interface EffectShape {
58
+ type: EffectShapeType;
59
+ params: {
60
+ curve: number;
61
+ };
62
+ }
63
+
64
+ export interface EffectAdjustments {
65
+ hue?: number;
66
+ saturation?: number;
67
+ brightness?: number;
68
+ contrast?: number;
69
+ }
70
+
71
+ export interface EffectSettings {
72
+ style: EffectStyle;
73
+ shape: EffectShape;
74
+ adjustments?: EffectAdjustments;
75
+ }
76
+
77
+ export type QRDotsType = 'square' | 'dots' | 'rounded' | 'classy' | 'classy-rounded' | 'extra-rounded';
78
+ export type QRCornerSquareType = 'square' | 'dot' | 'extra-rounded';
79
+ export type QRCornerDotType = 'square' | 'dot';
80
+
81
+ export type CornerRadius = number | { tl: number; tr: number; bl: number; br: number };
82
+
83
+ export interface Point {
84
+ x: number;
85
+ y: number;
86
+ }
87
+
88
+ export interface Handle {
89
+ x: number;
90
+ y: number;
91
+ }
92
+
93
+ export type AnchorType = 'corner' | 'smooth' | 'symmetric';
94
+
95
+ export interface AnchorPoint {
96
+ id: string;
97
+ position: Point;
98
+ handleIn: Handle | null;
99
+ handleOut: Handle | null;
100
+ type: AnchorType;
101
+ }
102
+
103
+ export interface VectorPath {
104
+ id: string;
105
+ anchors: AnchorPoint[];
106
+ closed: boolean;
107
+ strokeColor: string;
108
+ strokeWidth: number;
109
+ fillColor: string | null;
110
+ lineCap: 'butt' | 'round' | 'square';
111
+ lineJoin: 'miter' | 'round' | 'bevel';
112
+ }
113
+
114
+ export interface CanvasElement {
115
+ id: string;
116
+ name: string;
117
+ type: 'text' | 'shape' | 'image' | 'qrcode' | 'path';
118
+ content: string;
119
+ x: number;
120
+ y: number;
121
+ width: number;
122
+ height: number;
123
+ rotation: number;
124
+ opacity: number;
125
+ visible: boolean;
126
+ color?: string;
127
+ backgroundColor?: string;
128
+ groupId?: string;
129
+ flipX?: boolean;
130
+ flipY?: boolean;
131
+ fontSize?: number;
132
+ fontWeight?: string;
133
+ fontFamily?: string;
134
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
135
+ textTransform?: 'uppercase' | 'lowercase' | 'capitalize' | 'none';
136
+ letterSpacing?: number;
137
+ lineHeight?: number;
138
+ autoWidth?: boolean;
139
+ strokeWidth?: number;
140
+ strokeColor?: string;
141
+ strokeStyle?: 'solid' | 'dashed' | 'dotted' | 'none';
142
+ textStrokeWidth?: number;
143
+ textStrokeColor?: string;
144
+ textStrokePosition?: 'behind' | 'front';
145
+ textStrokeStyle?: 'round' | 'flat';
146
+ cornerRadius?: CornerRadius;
147
+ clipShape?: string;
148
+ crop?: {
149
+ x: number;
150
+ y: number;
151
+ scale: number;
152
+ };
153
+ qrMargin?: number;
154
+ qrCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
155
+ qrDotsType?: QRDotsType;
156
+ qrCornerSquareType?: QRCornerSquareType;
157
+ qrCornerDotType?: QRCornerDotType;
158
+ qrCornerSquareColor?: string;
159
+ qrCornerDotColor?: string;
160
+ qrLogo?: string;
161
+ qrTransparent?: boolean;
162
+ path?: VectorPath;
163
+ effect: EffectSettings;
164
+ zIndex: number;
165
+ locked: boolean;
166
+ }
167
+
168
+ export interface CustomFont {
169
+ name: string;
170
+ url: string;
171
+ }
172
+
173
+ export interface UploadedAsset {
174
+ id: string;
175
+ type: 'image';
176
+ content: string;
177
+ name: string;
178
+ width: number;
179
+ height: number;
180
+ }
181
+
182
+ export interface SavedAsset {
183
+ id: string;
184
+ name: string;
185
+ elements: CanvasElement[];
186
+ groups: Record<string, GroupMetadata>;
187
+ }
188
+
189
+ export interface SavedDesign {
190
+ id: string;
191
+ name: string;
192
+ thumbnail: string;
193
+ createdAt: number;
194
+ updatedAt: number;
195
+ designState: string;
196
+ }
197
+
198
+ export interface BrandKit {
199
+ id: string;
200
+ name: string;
201
+ colors: string[];
202
+ fonts: {
203
+ heading: string;
204
+ subheading: string;
205
+ body: string;
206
+ };
207
+ customFonts: CustomFont[];
208
+ logos: string[];
209
+ }
210
+
211
+ export interface GroupMetadata {
212
+ id: string;
213
+ name: string;
214
+ collapsed: boolean;
215
+ }
216
+
217
+ export interface Page {
218
+ id: string;
219
+ name: string;
220
+ elements: CanvasElement[];
221
+ groups: Record<string, GroupMetadata>;
222
+ width?: number;
223
+ height?: number;
224
+ unit?: Unit;
225
+ }
226
+
227
+ export interface DesignState {
228
+ pages: Page[];
229
+ activePageId: string;
230
+ zoom: number;
231
+ title: string;
232
+ settings: DocumentSettings;
233
+ selection: string[];
234
+ activeGroupId: string | null;
235
+ savedColors: string[];
236
+ savedGradients: string[];
237
+ uploads: UploadedAsset[];
238
+ assets: SavedAsset[];
239
+ savedDesigns: SavedDesign[];
240
+ brandKits: BrandKit[];
241
+ activeBrandKitId: string | null;
242
+ }
243
+
244
+ export type LicensePlan = 'free' | 'team' | 'business' | 'pro' | 'enterprise';
245
+
246
+ export interface LicenseEntitlements {
247
+ ai: boolean;
248
+ export: {
249
+ web: boolean;
250
+ print: boolean;
251
+ };
252
+ features?: Record<string, boolean>;
253
+ limits?: {
254
+ maxPages?: number;
255
+ maxExportsPerDay?: number;
256
+ };
257
+ }
258
+
259
+ export interface LicenseStatus {
260
+ isValid: boolean;
261
+ plan: LicensePlan;
262
+ showWatermark: boolean;
263
+ entitlements: LicenseEntitlements;
264
+ expiresAt?: string;
265
+ message?: string;
266
+ upgradeUrl?: string;
267
+ }
268
+
269
+ export type DeepPartial<T> = {
270
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
271
+ };
272
+
273
+ export interface LicenseValidationRequest {
274
+ origin?: string;
275
+ projectId: string;
276
+ sdkVersion?: string;
277
+ customerId?: string;
278
+ }
279
+
280
+ export interface SDKServicesConfig {
281
+ geminiApiKey?: string;
282
+ unsplashProxyBaseUrl?: string;
283
+ licenseEndpoint?: string;
284
+ licenseRequest?: LicenseValidationRequest;
285
+ licenseTimeoutMs?: number;
286
+ aiEndpoint?: string;
287
+ }
288
+
289
+ export interface SDKAssetsConfig {
290
+ injectTailwind?: boolean;
291
+ tailwindCdnUrl?: string;
292
+ injectFont?: boolean;
293
+ fontHref?: string;
294
+ injectBaseStyles?: boolean;
295
+ showLoader?: boolean;
296
+ }
297
+
298
+ export interface EditorConfig {
299
+ apiKey: string;
300
+ projectId: string;
301
+ showCredit?: boolean;
302
+ container?: HTMLElement;
303
+ initialState?: {
304
+ pages: Page[];
305
+ settings: DocumentSettings;
306
+ };
307
+ services?: SDKServicesConfig;
308
+ assets?: SDKAssetsConfig;
309
+ }
310
+
311
+ export interface EmbedConfig extends EditorConfig {
312
+ container: HTMLElement;
313
+ className?: string;
314
+ }
315
+
316
+ export type EventType = 'change' | 'save' | 'select' | 'export';
317
+
318
+ export interface Store {
319
+ state: DesignState;
320
+
321
+ subscribe(listener: () => void): () => void;
322
+ subscribeLicense(listener: () => void): () => void;
323
+
324
+ getLicenseStatus(): LicenseStatus;
325
+ getEntitlements(): LicenseEntitlements;
326
+
327
+ addPage(afterId?: string): void;
328
+ setActivePage(pageId: string): void;
329
+ duplicatePage(pageId: string): void;
330
+ deletePage(pageId: string): void;
331
+ renamePage(pageId: string, name: string): void;
332
+
333
+ addElement(element: Partial<CanvasElement>): void;
334
+ updateElement(id: string, updates: Partial<CanvasElement>, recordHistory?: boolean): void;
335
+ deleteElement(id: string): void;
336
+ duplicateElement(id: string): void;
337
+
338
+ setSelection(ids: string[], expandGroups?: boolean): void;
339
+ selectAll(): void;
340
+ deselectAll(): void;
341
+ deleteSelection(): void;
342
+
343
+ undo(): void;
344
+ redo(): void;
345
+ canUndo(): boolean;
346
+ canRedo(): boolean;
347
+
348
+ updateSettings(settings: Partial<DocumentSettings>): void;
349
+ toJSON(): string;
350
+ exportJSON(): string;
351
+ loadJSON(json: string): void;
352
+ reset(options?: { transparent?: boolean }): void;
353
+
354
+ on(event: EventType, callback: (data: any) => void): () => void;
355
+ }
356
+
357
+ export interface EditorInstance {
358
+ store: Store;
359
+ on(event: EventType, callback: (data: any) => void): () => void;
360
+ save(): string;
361
+ destroy(): void;
362
+ }
363
+
364
+ export function createFraczledEditor(config: EmbedConfig): EditorInstance;
365
+ export function createOurEditorApp(config: EmbedConfig): EditorInstance;
366
+ export function createStore(config: EditorConfig): Store;
367
+
368
+ export { Store };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@fraczled/sdk",
3
+ "version": "1.0.1",
4
+ "description": "Fraczled Design Studio SDK - Embed a powerful design editor in your application",
5
+ "scripts": {
6
+ "build": "vite build --config ../vite.sdk.config.ts && vite build --config ../vite.sdk.umd.config.ts",
7
+ "prepublishOnly": "npm run build"
8
+ },
9
+ "main": "dist/fraczled-sdk.umd.js",
10
+ "module": "dist/fraczled-sdk.es.js",
11
+ "types": "index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/fraczled-sdk.es.js",
15
+ "require": "./dist/fraczled-sdk.umd.js",
16
+ "types": "./index.d.ts"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "index.d.ts",
22
+ "README.md"
23
+ ],
24
+ "peerDependencies": {
25
+ "react": "^18.0.0 || ^19.0.0",
26
+ "react-dom": "^18.0.0 || ^19.0.0"
27
+ },
28
+ "keywords": [
29
+ "design",
30
+ "editor",
31
+ "canvas",
32
+ "sdk",
33
+ "embed",
34
+ "graphic-design",
35
+ "flyer",
36
+ "poster"
37
+ ],
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "author": "Fraczled",
42
+ "license": "MIT"
43
+ }