@kittl/sdk 0.0.9 → 1.0.0-alpha.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.
@@ -1,19 +1,3 @@
1
- declare abstract class BatchClient<T extends Record<string, unknown>> {
2
- abstract getPatches(): PatchTree<T>[];
3
- abstract getOrigin(): Origin;
4
- abstract getHistoryOrigin(): HistoryOrigins;
5
- abstract getWorkingState(): KittlStateStore<T>;
6
- abstract commit(): void;
7
- }
8
- declare abstract class KittlStateStore<T extends Record<string, unknown>> {
9
- abstract getSnapshot(): T;
10
- abstract subscribe<U>(selector: Selector<T, U>, callback: (selected: U, meta: {
11
- patch: PatchTree<T>[];
12
- senderOrigin: Origin;
13
- }) => void, subscriberOrigin?: Origin, options?: SubscribeOptions): () => void;
14
- abstract internalPatch(args: InternalPatchArgs<T>): void;
15
- abstract resetWithState(state: T, origin?: Origin): void;
16
- }
17
1
  declare class SdkBadInputError extends Error {
18
2
  readonly name: "SdkBadInputError";
19
3
  readonly cause?: Error;
@@ -24,366 +8,6 @@ declare class SdkInternalError extends Error {
24
8
  readonly cause?: Error;
25
9
  constructor(message: string, cause?: Error);
26
10
  }
27
- declare const BASIC_SHAPE_DEFAULT_VALUES: {
28
- defaultIcon: LayerIconType | undefined;
29
- shadowOptions?: {
30
- color?: string | undefined | null;
31
- blur?: number | undefined;
32
- offset?: number;
33
- angle?: number;
34
- };
35
- gradients?: StateGradientInfo | undefined;
36
- clipPathMaskId?: string | undefined | null;
37
- childrenInfo?: {
38
- objectName?: string;
39
- id: string;
40
- fallbackObjectName: string | null;
41
- objectNameLayout?: WithObjectLayout;
42
- fallbackObjectNameLayout?: WithObjectLayout;
43
- } | undefined;
44
- hiddenColors?: Record<string, NonNullable<Color>> | undefined;
45
- inLoadingStage?: boolean | undefined;
46
- objectName: string;
47
- skewX: number | undefined;
48
- skewY: number | undefined;
49
- width: number;
50
- height: number;
51
- scaleX: number;
52
- scaleY: number;
53
- angle: number;
54
- top: number;
55
- left: number;
56
- flipX: boolean;
57
- flipY: boolean;
58
- name?: string | undefined;
59
- defaultName: string | undefined;
60
- locked?: boolean | undefined;
61
- hidden?: boolean | undefined;
62
- opacity?: number | undefined;
63
- stroke?: string | null;
64
- strokeWidth?: number;
65
- fill?: ColorInfo[] | undefined;
66
- scalingCorners?: boolean | undefined;
67
- cornerRadii?: SerializableCornerRadii | undefined;
68
- id: DesignObjectId;
69
- version: string;
70
- type: ObjectType.BasicShape;
71
- };
72
- declare const BasicShapeType: {
73
- readonly RECTANGLE: "rectangle";
74
- readonly CIRCLE: "ellipse";
75
- readonly STAR: "star";
76
- readonly TRIANGLE: "polygon";
77
- };
78
- declare const DEFAULT_VALUES$1: {
79
- globalCompositeOperation: BlendMode;
80
- stroke?: string | null;
81
- strokeWidth?: number;
82
- shadowOptions?: {
83
- color?: string | undefined | null;
84
- blur?: number | undefined;
85
- offset?: number;
86
- angle?: number;
87
- };
88
- opacity?: number | undefined;
89
- objectName: string;
90
- width: number;
91
- height: number;
92
- scaleX: number;
93
- scaleY: number;
94
- angle: number;
95
- top: number;
96
- left: number;
97
- flipX: boolean;
98
- flipY: boolean;
99
- name?: string | undefined;
100
- defaultName: string | undefined;
101
- locked?: boolean | undefined;
102
- inLoadingStage?: boolean | undefined;
103
- clipPathMaskId?: string | undefined | null;
104
- hidden?: boolean | undefined;
105
- filters: SerialisedPhotoFilter[] | undefined;
106
- fill?: ColorInfo[] | undefined;
107
- cropX?: number | undefined;
108
- cropY?: number | undefined;
109
- cropWidth?: number | undefined;
110
- cropHeight?: number | undefined;
111
- id: DesignObjectId;
112
- version: string;
113
- type: ObjectType.IllustrationImage;
114
- isGeneratedByAi?: boolean;
115
- aiArtId?: string;
116
- generatedContentId?: string;
117
- generation?: {
118
- meta?: GenerationMeta;
119
- generationId?: string;
120
- aiArtId?: string;
121
- generatorKey?: string;
122
- };
123
- };
124
- declare const DEFAULT_VALUES$2: {
125
- cropX?: number | undefined;
126
- cropY?: number | undefined;
127
- cropWidth?: number | undefined;
128
- cropHeight?: number | undefined;
129
- shadowOptions?: {
130
- color?: string | undefined | null;
131
- blur?: number | undefined;
132
- offset?: number;
133
- angle?: number;
134
- };
135
- stroke?: string | null;
136
- strokeWidth?: number;
137
- opacity?: number | undefined;
138
- width: number;
139
- height: number;
140
- scaleX: number;
141
- scaleY: number;
142
- angle: number;
143
- top: number;
144
- left: number;
145
- flipX: boolean;
146
- flipY: boolean;
147
- name?: string | undefined;
148
- defaultName: string | undefined;
149
- locked?: boolean | undefined;
150
- hidden?: boolean | undefined;
151
- id: DesignObjectId;
152
- version: string;
153
- type: ObjectType.Video;
154
- };
155
- declare const DEFAULT_VALUES: {
156
- shapes: never[];
157
- operation: ShapeBooleanOperation;
158
- clipPathMaskId?: string | undefined | null;
159
- scalingCorners?: boolean | undefined;
160
- cornerRadii?: SerializableCornerRadii | undefined;
161
- childrenInfo?: {
162
- objectName?: string;
163
- id: string;
164
- fallbackObjectName: string | null;
165
- objectNameLayout?: WithObjectLayout;
166
- fallbackObjectNameLayout?: WithObjectLayout;
167
- } | undefined;
168
- shadowOptions?: {
169
- color?: string | undefined | null;
170
- blur?: number | undefined;
171
- offset?: number;
172
- angle?: number;
173
- };
174
- gradients?: StateGradientInfo | undefined;
175
- opacity?: number | undefined;
176
- hiddenColors?: Record<string, NonNullable<Color>> | undefined;
177
- stroke?: string | null;
178
- strokeWidth?: number;
179
- fill?: ColorInfo[] | undefined;
180
- locked?: boolean | undefined;
181
- hidden?: boolean | undefined;
182
- skewX: number | undefined;
183
- skewY: number | undefined;
184
- width: number;
185
- height: number;
186
- scaleX: number;
187
- scaleY: number;
188
- angle: number;
189
- top: number;
190
- left: number;
191
- flipX: boolean;
192
- flipY: boolean;
193
- name?: string | undefined;
194
- defaultName: string | undefined;
195
- id: DesignObjectId;
196
- version: string;
197
- type: ObjectType.CombinedShape;
198
- };
199
- declare const EXPORT_MIME_TYPES: {
200
- readonly jpeg: "image/jpeg";
201
- readonly mp4: "video/mp4";
202
- readonly pdf: "application/pdf";
203
- readonly png: "image/png";
204
- readonly svg: "image/svg+xml";
205
- };
206
- declare const GUIDE_DEFAULT_VALUES: {
207
- id: DesignObjectId;
208
- version: string;
209
- type: ObjectType.Guide;
210
- };
211
- declare const GenerationStatus: {
212
- readonly CREATED: "CREATED";
213
- readonly QUEUED: "QUEUED";
214
- readonly STARTED: "STARTED";
215
- readonly COMPLETE: "COMPLETE";
216
- readonly FAILED: "FAILED";
217
- readonly CANCELLED: "CANCELLED";
218
- };
219
- declare const ILLUSTRATION_DEFAULT_VALUES: {
220
- hiddenColors?: Record<string, NonNullable<Color>> | undefined;
221
- clipPathMaskId?: string | undefined | null;
222
- isGeneratedByAi?: boolean;
223
- aiArtId?: string;
224
- generatedContentId?: string;
225
- generation?: {
226
- meta?: GenerationMeta;
227
- generationId?: string;
228
- aiArtId?: string;
229
- generatorKey?: string;
230
- };
231
- childrenInfo?: {
232
- objectName?: string;
233
- id: string;
234
- fallbackObjectName: string | null;
235
- objectNameLayout?: WithObjectLayout;
236
- fallbackObjectNameLayout?: WithObjectLayout;
237
- } | undefined;
238
- shadowOptions?: {
239
- color?: string | undefined | null;
240
- blur?: number | undefined;
241
- offset?: number;
242
- angle?: number;
243
- };
244
- gradients?: StateGradientInfo | undefined;
245
- opacity?: number | undefined;
246
- stroke?: string | null;
247
- strokeWidth?: number;
248
- fill?: ColorInfo[] | undefined;
249
- inLoadingStage?: boolean | undefined;
250
- locked?: boolean | undefined;
251
- hidden?: boolean | undefined;
252
- objectName: string;
253
- width: number;
254
- height: number;
255
- scaleX: number;
256
- scaleY: number;
257
- angle: number;
258
- top: number;
259
- left: number;
260
- flipX: boolean;
261
- flipY: boolean;
262
- name?: string | undefined;
263
- defaultName: string | undefined;
264
- id: DesignObjectId;
265
- version: string;
266
- type: ObjectType.Illustration;
267
- };
268
- declare const LOADING_CARD_DEFAULT_VALUES: {
269
- locked?: boolean | undefined;
270
- hidden?: boolean | undefined;
271
- width: number;
272
- height: number;
273
- scaleX: number;
274
- scaleY: number;
275
- angle: number;
276
- top: number;
277
- left: number;
278
- flipX: boolean;
279
- flipY: boolean;
280
- name?: string | undefined;
281
- defaultName: string | undefined;
282
- id: DesignObjectId;
283
- version: string;
284
- type: ObjectType.LoadingCard;
285
- };
286
- declare const MASK_DEFAULT_VALUES: {
287
- inLoadingStage?: boolean | undefined;
288
- opacity?: number | undefined;
289
- locked?: boolean | undefined;
290
- hidden?: boolean | undefined;
291
- objectName: string;
292
- width: number;
293
- height: number;
294
- scaleX: number;
295
- scaleY: number;
296
- angle: number;
297
- top: number;
298
- left: number;
299
- flipX: boolean;
300
- flipY: boolean;
301
- name?: string | undefined;
302
- defaultName: string | undefined;
303
- id: DesignObjectId;
304
- version: string;
305
- type: ObjectType.Mask;
306
- };
307
- declare const MOCKUP_DESIGN_DEFAULT_VALUES: {
308
- hidden?: boolean | undefined;
309
- locked?: boolean | undefined;
310
- width: number;
311
- height: number;
312
- scaleX: number;
313
- scaleY: number;
314
- angle: number;
315
- top: number;
316
- left: number;
317
- flipX: boolean;
318
- flipY: boolean;
319
- id: DesignObjectId;
320
- version: string;
321
- type: ObjectType.MockupDesign;
322
- };
323
- declare const PATH_TEXT_DEFAULT_VALUES: {
324
- fontSize: number;
325
- lineHeight: number;
326
- textAlignment: TextAlignment;
327
- letterSpacing: number;
328
- stroke: string;
329
- useLigatures: boolean;
330
- strokeWidth?: number;
331
- fill?: Color | undefined;
332
- opacity?: number | undefined;
333
- locked?: boolean | undefined;
334
- hidden?: boolean | undefined;
335
- width: number;
336
- height: number;
337
- scaleX: number;
338
- scaleY: number;
339
- angle: number;
340
- top: number;
341
- left: number;
342
- flipX: boolean;
343
- flipY: boolean;
344
- name?: string | undefined;
345
- defaultName: string | undefined;
346
- id: DesignObjectId;
347
- version: string;
348
- type: ObjectType.PathText;
349
- };
350
- declare const PendingOperation: {
351
- readonly GENERATE: "generate";
352
- readonly INPAINT: "inpaint";
353
- readonly ERASE_AND_FILL: "eraseAndFill";
354
- readonly VECTORIZE: "vectorize";
355
- readonly LAYERIZE: "layerize";
356
- readonly UPSCALE: "upscale";
357
- readonly REMOVE_BACKGROUND: "removeBackground";
358
- readonly REFRAME: "reframe";
359
- };
360
- declare const RICH_TEXT_DEFAULT_VALUES: {
361
- opacity?: number | undefined;
362
- stroke?: string | null;
363
- strokeWidth?: number;
364
- fill?: Color | undefined;
365
- locked?: boolean | undefined;
366
- hidden?: boolean | undefined;
367
- width: number;
368
- height: number;
369
- scaleX: number;
370
- scaleY: number;
371
- angle: number;
372
- top: number;
373
- left: number;
374
- flipX: boolean;
375
- flipY: boolean;
376
- name?: string | undefined;
377
- defaultName: string | undefined;
378
- id: DesignObjectId;
379
- version: string;
380
- type: ObjectType.RichText;
381
- };
382
- declare const ResultType: {
383
- readonly VIDEO: "video";
384
- readonly IMAGE: "image";
385
- readonly ERROR: "error";
386
- };
387
11
  declare const UploadType: {
388
12
  readonly EXTENSION: "EXTENSION";
389
13
  readonly AI_GENERATED: "AI_GENERATED";
@@ -395,247 +19,33 @@ declare const UploadType: {
395
19
  readonly BRAND_KIT: "BRAND_KIT";
396
20
  readonly QUICK_EDIT: "QUICK_EDIT";
397
21
  };
398
- declare const backgroundType = "background";
399
- declare const clippingMaskType = "clippingMask";
400
- declare const pathType = "path";
401
- declare const stringColorKeys: readonly [
402
- "stroke",
403
- "shadow",
404
- "decoration"
405
- ];
406
- declare const structuralGroupType = "structuralGroup";
407
- declare enum Action {
408
- MERGE = "MERGE",
409
- SET = "SET",
410
- DELETE = "DELETE"
411
- }
412
- declare enum BlendMode {
413
- Normal = "normal",
414
- SourceOver = "source-over",
415
- Multiply = "multiply",
416
- Screen = "screen",
417
- Overlay = "overlay",
418
- SoftLight = "soft-light",
419
- HardLight = "hard-light",
420
- ColorDodge = "color-dodge",
421
- ColorBurn = "color-burn",
422
- Lighten = "lighten",
423
- Darken = "darken",
424
- Difference = "difference",
425
- Exclusion = "exclusion",
426
- Lighter = "lighter",
427
- Hue = "hue",
428
- Saturation = "saturation",
429
- Color = "color",
430
- Luminosity = "luminosity",
431
- AlphaMask = "destination-out"
432
- }
433
- declare enum BoardLayout {
434
- Custom = "custom",
435
- Standard = "standard",
436
- TShirt = "tshirt",
437
- BusinessCard = "businesscard",
438
- A4 = "a4",
439
- A5 = "a5",
440
- Poster = "poster",
441
- InstagramPost = "instagramPost",
442
- InstagramPostPortrait = "instagramPostPortrait",
443
- instagramPostSquare = "instagramPostSquare",
444
- InstagramPostLandscape = "instagramPostLandscape",
445
- InstagramStory = "instagramStory",
446
- InstagramReel = "instagramReel",
447
- FacebookPost = "facebookPost",
448
- FacebookPostSquare = "facebookPostSquare",
449
- FacebookPostLandscape = "facebookPostLandscape",
450
- FacebookStory = "facebookStory",
451
- YouTubeThumbnail = "youtubeThumbnail",
452
- YouTubeProfileBanner = "youtubeProfileBanner",
453
- YouTubeAdBanner = "youtubeAdBanner",
454
- XPost = "xPost",
455
- XHeader = "xHeader",
456
- XCarouselAd = "xCarouselAd",
457
- PinterestPin = "pinterestPin",
458
- WebBannerAd = "webBannerAd",
459
- Postcard = "postcard",
460
- Letterhead = "letterhead",
461
- Flyer = "flyer",
462
- Brochure = "brochure",
463
- Logo = "logo",
464
- Presentation = "presentation",
465
- AmazonTShirt = "amazonTShirt",
466
- PrintfulTShirt = "printfulTShirt",
467
- PrintfulAop = "printfulAop",
468
- PrintfulHat = "printfulHat",
469
- RedBubbleStandard = "redBubbleStandard",
470
- RedBubbleSticker = "redBubbleSticker",
471
- TeepublicStandard = "teepublicStandard",
472
- DisplatePoster = "displatePoster",
473
- PrintifyStandard = "printifyStandard",
474
- PrintifyAop = "printifyAop",
475
- PrintifyHoodie = "printifyHoodie",
476
- PrintifyMug = "printifyMug",
477
- PrintifyNotebook = "printifyNotebook",
478
- PrintifySticker = "printifySticker",
479
- AwkwardStylesTShirt = "awkwardStylesTShirt"
480
- }
481
- declare enum GradientType {
482
- Linear = "linear",
483
- Radial = "radial"
484
- }
485
- declare enum HistoryOrigins {
486
- Tracked = "change:origin",
487
- Untracked = "untracked:origin"
488
- }
489
- declare enum ImageFilterType {
490
- Saturation = "Saturation",
491
- Contrast = "Contrast",
492
- Brightness = "Brightness",
493
- Vibrance = "Vibrance",
494
- HueRotation = "HueRotation",
495
- Noise = "Noise",
496
- Blur = "Blur",
497
- Convolute = "Convolute",
498
- Pixelate = "Pixelate",
499
- RemoveColor = "RemoveColor"
500
- }
501
- declare enum InpaintingSelectionMode {
502
- ADD = "add",
503
- SUBTRACT = "subtract"
504
- }
505
- declare enum ObjectType {
506
- Artboard = "artboard",
507
- Smartboard = "smartboard",
508
- Videoboard = "videoboard",
509
- MockupBoard = "mockupBoard",
510
- Illustration = "illustration",
511
- IllustrationImage = "illustrationImage",
512
- Video = "video",
513
- BasicShape = "basicShape",
514
- VectorPath = "vectorPath",
515
- CombinedShape = "combinedShape",
516
- PathText = "pathText",
517
- Mask = "mask",
518
- RichText = "RichText",
519
- Guide = "guide",
520
- LoadingCard = "loadingCard",
521
- MockupDesign = "mockupDesign",
522
- ActiveSelection = "activeSelection",
523
- ArtboardTitle = "artboardTitle",
524
- ArtboardTitleIcon = "artboardTitleIcon",
525
- OverlayTexture = "overlayTexture",
526
- CustomTextbox = "CustomTextbox",
527
- ClipPath = "clipPath",
528
- Path = "path",
529
- Ruler = "ruler",
530
- WarpControlRootPoint = "warpControlRootPoint",
531
- Group = "group",
532
- Circle = "circle",
533
- Rect = "rect"
534
- }
535
- declare enum Orientation {
536
- HORIZONTAL = "horizontal",
537
- VERTICAL = "vertical"
538
- }
539
- declare enum Origin {
540
- CRDT = 1,
541
- CANVAS = 2,
542
- UI = 4,
543
- VOLATILE = 8,
544
- EVENTS_SYNC = 16,
545
- API = 32,
546
- UNDO_REDO = 64
547
- }
548
- declare enum TextAlignment {
549
- right = "right",
550
- left = "left",
551
- center = "center",
552
- justify = "justify",
553
- justifyLegacy = "justify-legacy"
554
- }
555
- declare enum Unit {
556
- px = "px",
557
- in = "in",
558
- mm = "mm"
559
- }
560
22
  export declare const kittl: SharedFileBrowserKittlSDK;
23
+ /**
24
+ * Unwraps an {@link SdkResult}, returning its value on success and throwing its
25
+ * error on failure. This lets callers use regular `try`/`catch` control flow
26
+ * around direct SDK calls instead of branching on `isOk` every time — branching
27
+ * on `isOk` directly remains fully supported.
28
+ *
29
+ * @typeParam T - The success value type carried by the result.
30
+ * @param result - The {@link SdkResult} returned by an SDK call.
31
+ * @returns The success value when `result.isOk` is `true`.
32
+ * @throws The result's `error` when `result.isOk` is `false`.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * import { kittl, unwrapResult } from '@kittl/sdk/editorContentPanel';
37
+ *
38
+ * try {
39
+ * const image = unwrapResult(await kittl.project.design.api.image.addImage(params));
40
+ * console.log('Added image:', image.id);
41
+ * } catch (error) {
42
+ * console.error('Failed to add image:', error);
43
+ * }
44
+ * ```
45
+ *
46
+ * @public
47
+ */
561
48
  export declare function unwrapResult<T>(result: SdkResult<T, Error>): T;
562
- export interface AIGenerationInputSettings {
563
- prompt: string;
564
- taskType?: AIGenerationModelTaskType;
565
- promptStyleId?: number;
566
- model?: {
567
- id: string;
568
- };
569
- additionalParams?: Record<string, unknown>;
570
- actionOrigin?: AIGenerationActionOrigin;
571
- type: AIGenerationContentType;
572
- referenceImageMode?: AIGenerationReferenceImageMode;
573
- }
574
- export interface AIGenerationOutputSettings {
575
- id?: string;
576
- dimensions: {
577
- width: number;
578
- height: number;
579
- };
580
- }
581
- export interface AddFontStyleOptions {
582
- fontFamilyId: string;
583
- files: Blob[];
584
- styles: string[];
585
- }
586
- export interface AppStateAPI {
587
- getSelectedObjectsIds(): string[];
588
- setSelectedObjectsIds(ids: string[], origin?: Origin): void;
589
- getSelectedLayersIds(): string[];
590
- setSelectedLayersIds(ids: string[]): void;
591
- getSelectedArtboardIds(): string[];
592
- setSelectedArtboardIds(ids: string[]): void;
593
- getSelectedArtboardsObjectIds(): string[];
594
- setSelectedArtboardsObjectIds(ids: string[]): void;
595
- getAllSelectedObjectsIds(): string[];
596
- setAllSelectedObjectsIds(ids: string[]): void;
597
- getCanvasMode(): CanvasModeKind | string;
598
- getCanvasModeTargetId(): string | null;
599
- setCanvasMode(mode: CanvasModeKind | string, origin?: Origin): void;
600
- setCanvasModeWithTarget(mode: CanvasModeKind, options?: SetCanvasModeWithTargetOptions): void;
601
- setCustomCanvasMode<const Id extends string>(params: SetCustomCanvasModeParams<Id>, origin?: Origin): void;
602
- getActiveTool(): ActiveTool;
603
- setActiveTool(tool: ActiveTool, origin?: Origin): void;
604
- getIsDragPanning(): boolean;
605
- viewport: ViewportAPI;
606
- getHighlightedObjectId(): string | null;
607
- setHighlightedObjectId(id: string | null): void;
608
- setMany(fields: Partial<AppStateWithoutModes>, origin?: Origin): void;
609
- getIsViewOnlyMode(): boolean;
610
- setIsViewOnlyMode(isViewOnlyMode: boolean): void;
611
- setCanvasSettings: (settings: Partial<SettingsType>) => void;
612
- getCanvasSettings(): SettingsType;
613
- getPenToolSetting(): AppState["penToolSetting"];
614
- setPenToolSetting(setting: Partial<AppState["penToolSetting"]>): void;
615
- getOutlineLoading(): AppState["outlineLoading"];
616
- setOutlineLoading(id: string, loading: boolean): void;
617
- isObjectLoading(id: string): boolean;
618
- getPendingOperations(): AppState["pendingOperations"];
619
- isOperationPending(id: string, operation?: PendingOperation): boolean;
620
- setPendingOperation(id: string, operation: PendingOperation, origin?: Origin): void;
621
- clearPendingOperation(id: string, operation: PendingOperation, origin?: Origin): void;
622
- }
623
- export interface AsyncAIAPI {
624
- spendCredits: (options: SpendCreditsOptions) => SdkResultAsync<SpendCreditsResult, Error>;
625
- startGeneration: (generatorId: string, inputSettings: AIGenerationInputSettings, output: AIGenerationOutputSettings) => SdkResultAsync<StartGenerationResult, Error>;
626
- registerHandler: (generatorId: string, onStatusUpdate: OnGenerationStatusUpdate) => SdkResultAsync<() => void, Error>;
627
- unregisterHandler: (generatorId: string) => SdkResultAsync<void, Error>;
628
- }
629
- export interface AsyncAppStateAPI extends WithAsync<AppStateAPI> {
630
- setCustomCanvasMode<const Id extends string>(params: SetCustomCanvasModeParams<Id>, origin?: Origin): Promise<BridgedSdkResult<void>>;
631
- }
632
- export interface AsyncAppStateSubscriptionAPI {
633
- subscribe<T extends readonly AppStateSelectorPath[]>(paths: [
634
- ...T
635
- ], callback: (...values: {
636
- [K in keyof T]: T[K] extends string ? DeepValue<AppState, T[K]> | undefined : unknown;
637
- }) => void): Promise<() => void>;
638
- }
639
49
  export interface AsyncAuthAPI {
640
50
  startAuth: (request: AuthStartRequest) => Promise<SdkResult<AuthStartResult>>;
641
51
  exchangeCode: (request: AuthExchangeRequest) => Promise<SdkResult<AuthTokenResponse>>;
@@ -644,38 +54,6 @@ export interface AsyncAuthAPI {
644
54
  getUserToken: () => Promise<SdkResult<UserTokenResult>>;
645
55
  logout: (request: AuthLogoutRequest) => Promise<SdkResult<void>>;
646
56
  }
647
- export interface AsyncBatchDesignAPI extends AsyncDesignAPI {
648
- commit: () => Promise<void>;
649
- }
650
- export interface AsyncContextAPI extends Omit<WithAsync<ContextAPI>, "subscribe"> {
651
- subscribe(callback: ContextSubscriptionCallback): Promise<() => void>;
652
- }
653
- export interface AsyncDataAPI extends WithAsync<DataAPI> {
654
- }
655
- export interface AsyncDesignAPI extends WithAsync<WithOptsRemoved<DesignAPI>> {
656
- }
657
- export interface AsyncDesignStateAPI {
658
- subscribe<T extends readonly DesignStateSelectorPath[]>(paths: [
659
- ...T
660
- ], callback: (...values: {
661
- [K in keyof T]: T[K] extends string ? DeepValue<SelectorState, T[K]> | undefined : unknown;
662
- }) => void): Promise<() => void>;
663
- }
664
- export interface AsyncExportAPI extends Omit<WithAsync<ExportAPI>, "showExportModal"> {
665
- showExportModal<Mime extends ExportMimeType>(request: ExportRequest<Mime>): Promise<BridgedSdkResult<ExportResult>>;
666
- }
667
- export interface AsyncFontAPI extends WithAsync<FontAPI> {
668
- }
669
- export interface AsyncStatelessAPI {
670
- send: (message: {
671
- type: string;
672
- payload: Record<string, unknown>;
673
- }) => SdkResultAsync<null>;
674
- subscribe: (key: string, handler: (payload: Record<string, unknown>) => void) => SdkResultAsync<null>;
675
- unsubscribe: (key: string) => SdkResultAsync<null>;
676
- }
677
- export interface AsyncUploadAPI extends WithAsync<UploadAPI> {
678
- }
679
57
  export interface AuthExchangeRequest {
680
58
  code: string;
681
59
  code_verifier?: string;
@@ -701,1579 +79,205 @@ export interface AuthStartResult {
701
79
  code: string;
702
80
  code_verifier?: string;
703
81
  }
82
+ /**
83
+ * Token response returned by the token endpoint (code exchange or refresh).
84
+ */
704
85
  export interface AuthTokenResponse {
705
86
  access_token?: string;
706
87
  refresh_token?: string;
707
88
  expires_in?: number;
708
89
  [key: string]: unknown;
709
90
  }
710
- export interface BackgroundImageOptions extends GeneratableObject {
711
- objectName?: string;
712
- globalCompositeOperation: BlendMode;
713
- opacity: number;
714
- filters?: SerialisedPhotoFilter[];
715
- hidden?: boolean;
716
- cropX?: number;
717
- cropY?: number;
718
- scaleX?: number;
719
- scaleY?: number;
720
- width?: number;
721
- height?: number;
722
- realWidth?: number;
723
- realHeight?: number;
724
- }
725
- export interface BaseStandardArtboardOptions<T extends ArtboardLikeType = ArtboardLikeType> {
726
- type?: T;
727
- rx?: number | undefined;
728
- ry?: number | undefined;
729
- id?: string;
730
- lockMovementX?: boolean;
731
- lockMovementY?: boolean;
732
- activeLayout: BoardLayout;
733
- left: number;
734
- top: number;
735
- width: number;
736
- height: number;
737
- fill: string | GradientObject | undefined | null;
738
- opacity?: number;
739
- hidden?: boolean;
740
- unit?: Unit;
741
- dpi?: number;
742
- fullSize?: boolean;
743
- clip?: boolean;
744
- printMargins?: PrintMargins;
745
- scaleX?: number;
746
- scaleY?: number;
747
- }
748
- export interface BaseStandardBoard<T extends ArtboardOptions = ArtboardOptions> {
749
- id: string;
750
- artboard: T;
751
- title?: string;
752
- texture?: TextureOptions;
753
- backgroundImage?: BackgroundImageOptions;
754
- originTemplateId?: string;
755
- }
756
- export interface BoardAPI {
757
- createStandardBoard(params: CreateBoardParams, opts?: DesignApiOptions): NormalizedBoard;
758
- cloneArtboard(params: CloneArtboardParams, opts?: DesignApiOptions): NormalizedBoard;
759
- updateArtboardBackground(params: UpdateArtboardBackgroundParams, opts?: DesignApiOptions): NormalizedBoard;
760
- updateArtboard(params: UpdateArtboardParams, opts?: DesignApiOptions): NormalizedBoard;
761
- connectBoards(params: ConnectBoardsParams, opts?: DesignApiOptions): void;
762
- disconnectBoards(params: DisconnectBoardsParams, opts?: DesignApiOptions): void;
763
- }
764
- export interface CanvasAPI {
765
- getScreenshot(): Promise<{
766
- data: string;
767
- width: number;
768
- height: number;
769
- }>;
770
- getPreviewImage: (id: string, options?: Partial<GetPreviewImageOptions>) => Promise<string | null>;
771
- getExport: (options: GetExportOptions) => Promise<Blob | null>;
772
- }
773
- export interface CatalogItem {
774
- id: string;
775
- name: string;
776
- previewImages: string[];
777
- }
778
- export interface ConfigAPI {
779
- setConfig(config: Partial<DesignConfig>, opts?: DesignApiOptions): void;
780
- }
781
- export interface ContextAPI {
782
- get(input?: ContextGetInput): KittlContext;
783
- subscribe(callback: ContextSubscriptionCallback): () => void;
784
- }
785
- export interface ContextGetInput {
786
- iframe?: Pick<HTMLIFrameElement, "getBoundingClientRect">;
787
- }
788
- export interface CreateFontOptions {
789
- name: string;
790
- files: Blob[];
791
- styles: string[];
792
- previewImage?: Blob;
793
- }
794
- export interface CreateLoadingCardInput extends CreateElementWithPositionAndSize {
795
- imageGenerationId?: string;
796
- startedAt?: number;
797
- generatingModelKey?: string;
798
- generationAverageSpeed?: number;
799
- name?: string;
800
- }
801
- export interface CustomCanvasModeStateById {
802
- }
803
- export interface DataAPI {
804
- mockups: MockupDataAPI;
805
- fonts: FontDataAPI;
806
- }
807
- export interface DecorationOptions {
808
- type: "horizontalLines" | "colorCut" | "obliqueLines" | "fadingColorCut";
809
- color: string | null;
810
- weight: number;
811
- distance: number;
812
- cutDistance: number;
813
- }
814
- export interface DeleteFontStyleOptions {
815
- fontFamilyId: string;
816
- id: string;
817
- }
818
- export interface DesignAPI {
819
- shape: ShapeAPI;
820
- board: BoardAPI;
821
- config: ConfigAPI;
822
- text: TextAPI;
823
- object: ObjectAPI;
824
- guide: GuideAPI;
825
- loadingCard: LoadingCardAPI;
826
- image: ImageAPI;
827
- illustration: IllustrationAPI;
828
- state: StateAPI;
829
- canvas: CanvasAPI;
830
- mockupboard: MockupboardAPI;
831
- smartboard: SmartboardAPI;
832
- video: VideoAPI;
833
- videoboard: VideoboardAPI;
834
- layers: LayersAPI;
835
- group: GroupAPI;
836
- texture: TextureAPI;
837
- placement: PlacementAPI;
838
- }
839
- export interface DesignConfig {
840
- microEditor?: {
841
- mainObjectId?: DesignObjectId;
842
- layerized?: boolean;
843
- };
844
- title?: string;
845
- dpiVersion?: number;
846
- designId?: string;
847
- generationId?: string;
848
- updatedAt?: string;
849
- templateId?: number | string;
850
- folderId?: string;
851
- dpi?: number;
852
- unit?: Unit;
853
- overrideColorPalette?: string[];
854
- overrideColorKeys?: string[];
855
- overrideLuminosityRatio?: number;
856
- previewBoardId?: string;
857
- }
858
- export interface DragAndDropDropImageInput {
859
- x: number;
860
- y: number;
861
- grabOffsetX?: number;
862
- grabOffsetY?: number;
863
- src: string;
864
- imgWidth?: number;
865
- imgHeight?: number;
866
- persistImage?: boolean;
867
- }
868
- export interface DragAndDropOffset {
869
- left: number;
870
- top: number;
871
- }
872
- export interface DragAndDropStartDragImageEventInput {
873
- event: DragEvent;
874
- img: HTMLImageElement;
875
- persistImage?: boolean;
876
- }
877
- export interface ErrorGenerationResult {
878
- type: typeof ResultType.ERROR;
879
- message: string;
880
- subtitle: string;
881
- status: "warning" | "error";
882
- isRecognized?: boolean;
883
- errorKey?: string;
884
- }
91
+ /** Historical registration surface retained for existing extensions. */
885
92
  export interface FileBrowserAPI {
886
- registerUploadBrowser: (tab: Omit<FileBrowserTab, "onEvent">) => Promise<SdkResponse<void>>;
887
- }
888
- export interface FontAPI {
889
- createFont: (params: {
890
- name: string;
891
- files: Blob[];
892
- styles: string[];
893
- previewImage?: Blob;
894
- }) => SdkResultAsync<UploadedFontFamily, Error>;
895
- }
896
- export interface FontDataAPI {
897
- listUserFonts(options?: PaginationOptions): SdkResultAsync<FontListDto>;
898
- listExtensionFonts(options?: PaginationOptions): SdkResultAsync<FontListDto>;
899
- get(fontFamilyId: string): SdkResultAsync<FontFamilyDto>;
900
- find(ids: string[]): SdkResultAsync<FontFamilyDto[]>;
901
- create(options: CreateFontOptions): SdkResultAsync<FontFamilyDto>;
902
- update(options: UpdateFontFamilyOptions): SdkResultAsync<FontFamilyDto>;
903
- delete(ids: string[]): SdkResultAsync<void>;
904
- destroy(ids: string[]): SdkResultAsync<void>;
905
- addStyle(options: AddFontStyleOptions): SdkResultAsync<FontFamilyDto>;
906
- updateStyle(options: UpdateFontStyleOptions): SdkResultAsync<void>;
907
- deleteStyle(options: DeleteFontStyleOptions): SdkResultAsync<void>;
908
- }
909
- export interface FontFamilyDto extends CatalogItem {
910
- styles: FontStyleDto[];
911
- deletedAt: string | null;
912
- extension: {
913
- id: string;
914
- name?: string;
915
- } | null;
916
- }
917
- export interface FontStyleDto {
918
- id: string;
919
- name: string;
920
- style: string | null;
921
- deletedAt: string | null;
922
- }
923
- export interface FontVariation {
924
- name: string;
925
- min: number;
926
- max: number;
927
- default: number;
928
- }
929
- export interface GeneratableBoard<T extends Record<string, unknown> = never> {
930
- generationSettings?: T;
931
- }
932
- export interface GeneratableObject {
933
- generation?: {
934
- meta?: GenerationMeta;
935
- generationId?: string;
936
- aiArtId?: string;
937
- generatorKey?: string;
938
- };
939
- }
940
- export interface GenerationCreditUse {
941
- amount: number;
942
- refunded: number;
943
- }
944
- export interface GenerationInputData {
945
- prompt?: string;
946
- style?: {
947
- id: number;
948
- };
949
- model?: {
950
- id: string;
951
- };
952
- }
953
- export interface GenerationMeta {
954
- generationEndsAt?: number;
955
- generationStartedAt?: number;
956
- pendingGenerationId: string;
957
- pendingGeneratorKey?: string;
958
- operation?: PendingOperation;
959
- }
960
- export interface GenerationStartedResultCommonProps {
961
- generationEndsAt?: number;
962
- generationStartedAt?: number;
963
- scheduledStartAt?: number;
964
- }
965
- export interface GetExportOptions {
966
- format: "png" | "jpg" | "pdf" | "svg" | "mp4";
967
- target: {
968
- boardId: string;
969
- } | {
970
- nodeIds: string[];
971
- };
972
- dimensions?: {
973
- multiplier: number;
974
- } | {
975
- pixelCount: number;
976
- } | {
977
- target: {
978
- width: number;
979
- height: number;
980
- };
981
- };
982
- size?: {
983
- width: number;
984
- height: number;
985
- unit: Unit;
986
- };
987
- dpi?: number;
988
- colorModel?: "rgb" | "cmyk";
989
- removeArtboardBackground?: boolean;
990
- optimizedQuality?: boolean;
991
- renderingIntent?: "download" | "pdf";
992
- }
993
- export interface GetObjectParams {
994
- id: string;
995
- }
996
- export interface GetPreviewImageOptions {
997
- targetPixelCount: number;
998
- format: "png" | "jpg";
999
- quality: number;
1000
- }
1001
- export interface GradientColorStop {
1002
- color: string | null;
1003
- offset: number;
1004
- opacity?: number;
1005
- }
1006
- export interface GradientInfo {
1007
- count: number;
1008
- angle: number;
1009
- offsets: number[];
1010
- gradientTransform?: number[];
1011
- coords?: {
1012
- x1: number;
1013
- x2: number;
1014
- y1: number;
1015
- y2: number;
1016
- r1?: number;
1017
- r2?: number;
1018
- };
1019
- type: GradientType;
1020
- }
1021
- export interface GradientObject {
1022
- id?: string;
1023
- key?: string;
1024
- colorStops: GradientColorStop[];
1025
- coords?: {
1026
- x1: number;
1027
- x2: number;
1028
- y1: number;
1029
- y2: number;
1030
- r1?: number;
1031
- r2?: number;
1032
- };
1033
- type: GradientType;
1034
- angle?: number;
1035
- gradientTransform?: number[];
1036
- }
1037
- export interface GroupAPI {
1038
- createGroup(input: CreateGroupParams, opts?: DesignApiOptions): void;
1039
- removeGroup(input: RemoveGroupParams, opts?: DesignApiOptions): void;
1040
- addIntoGroup(input: AddIntoGroupParams, opts?: DesignApiOptions): void;
1041
- removeFromGroup(input: RemoveFromGroupParams, opts?: DesignApiOptions): void;
1042
- }
1043
- export interface GuideAPI {
1044
- createGuide(input: CreateGuideInput, opts?: DesignApiOptions): NormalizedGuideObject;
1045
- updateGuide(input: UpdateGuideInput, opts?: DesignApiOptions): NormalizedGuideObject;
1046
- }
1047
- export interface IllustrationAPI {
1048
- getPaths: (params: GetIllustrationPathsParams) => SdkResultAsync<IllustrationSerializedChildren, SdkError>;
1049
- renamePath: (params: RenameIllustrationPathParams, opts?: DesignApiOptions) => SdkResultAsync<void, SdkError>;
1050
- removePaths: (params: RemoveIllustrationPathParams, opts?: DesignApiOptions) => SdkResultAsync<void, SdkError>;
1051
- togglePathLocked: (params: ToggleLockIllustrationPathParams, opts?: DesignApiOptions) => SdkResultAsync<void, SdkError>;
1052
- togglePathHidden: (params: ToggleHideIllustrationPathParams, opts?: DesignApiOptions) => SdkResultAsync<void, SdkError>;
1053
- addIllustration(params: AddIllustrationParams, opts?: DesignApiOptions): Promise<AddedIllustration>;
1054
- updateIllustration(params: UpdateIllustrationParams, opts?: UpdateObjectApiOptions): NormalizedIllustrationObject;
1055
- }
1056
- export interface ImageAPI {
1057
- addImage(params: AddImageParams, opts?: DesignApiOptions): SdkResultAsync<NormalizedIllustrationImageObject, SdkError>;
1058
- updateImage(params: UpdateImageParams, opts?: UpdateObjectApiOptions): NormalizedIllustrationImageObject;
1059
- updateImageSource(params: UpdateImageSourceParams, opts?: UpdateObjectApiOptions): SdkResultAsync<NormalizedIllustrationImageObject, SdkError>;
1060
- resetImageCrop(params: ResetImageCropParams, opts?: DesignApiOptions): SdkResultAsync<NormalizedIllustrationImageObject, SdkError>;
1061
- resetImageBackgroundRemoval(params: ResetImageBackgroundRemovalParams, opts?: DesignApiOptions): SdkResultAsync<NormalizedIllustrationImageObject, SdkError>;
1062
- }
1063
- export interface ImageGenerationResult {
1064
- type: typeof ResultType.IMAGE;
1065
- objectName: string;
1066
- }
1067
- export interface ImageGenerationStartedResult extends GenerationStartedResultCommonProps {
1068
- type: typeof ResultType.IMAGE;
1069
- }
1070
- export interface ImageUploadAPI {
1071
- upload: (params: {
1072
- blob: Blob;
1073
- }) => SdkResultAsync<UserImageUpload[], Error>;
1074
- uploadTemp: (params: {
1075
- blob: Blob;
1076
- }) => SdkResultAsync<TempUserImageUpload[], Error>;
1077
- }
1078
- export interface KittlContext {
1079
- colorScheme: EditorColorScheme;
1080
- dragAndDrop: {
1081
- offset: DragAndDropOffset;
1082
- };
1083
- }
1084
- export interface KittlSDKEditorAPIs {
1085
- ai: AsyncAIAPI;
1086
- data: AsyncDataAPI;
1087
- design: AsyncDesignAPI;
1088
- export: AsyncExportAPI;
1089
- designStore: AsyncDesignStateAPI;
1090
- appStore: AsyncAppStateSubscriptionAPI;
1091
- context: AsyncContextAPI;
1092
- dragAndDrop: PublicDragAndDropAPI;
1093
- state: AsyncAppStateAPI;
1094
- auth: AsyncAuthAPI;
1095
- upload: AsyncUploadAPI;
1096
- stateless: AsyncStatelessAPI;
1097
- font: AsyncFontAPI;
1098
- createBatch: () => Promise<AsyncBatchDesignAPI>;
1099
- }
93
+ /** @deprecated Use context.registerUploadBrowser on the sharedFileBrowser entrypoint. */
94
+ registerUploadBrowser: UploadBrowserRegistrationAPI["registerUploadBrowser"];
95
+ }
96
+ /**
97
+ * File browser registration API exposed to content panels and shared file browsers.
98
+ *
99
+ * @public
100
+ */
1100
101
  export interface KittlSDKFileBrowserAPI {
102
+ /**
103
+ * File browser API for registering custom file browser tabs in the upload modal.
104
+ * Allows extensions to provide custom content sources that appear as tabs in the upload gallery.
105
+ */
1101
106
  fileBrowser: FileBrowserAPI;
1102
107
  }
108
+ /**
109
+ * Lifecycle fields shared by every public SDK mounting point.
110
+ *
111
+ * @public
112
+ */
1103
113
  export interface KittlSDKLifecycle {
114
+ /**
115
+ * Whether the SDK is loaded and has called the onLoadedCallback.
116
+ */
1104
117
  loaded: boolean;
118
+ /**
119
+ * Callback function called when the extension is loaded.
120
+ */
1105
121
  onLoadedCallback: (() => void) | null;
122
+ /**
123
+ * Sets a callback to be called when the extension is ready.
124
+ */
1106
125
  onReady: (cb: () => void) => void;
1107
126
  }
1108
- export interface LayersAPI {
1109
- moveTo(input: MoveToParams, opts?: DesignApiOptions): void;
1110
- sendForward(input: SendToParams, opts?: DesignApiOptions): void;
1111
- sendToFront(input: SendToParams, opts?: DesignApiOptions): void;
1112
- sendBackward(input: SendToParams, opts?: DesignApiOptions): void;
1113
- sendToBack(input: SendToParams, opts?: DesignApiOptions): void;
1114
- }
1115
- export interface LoadingCardAPI {
1116
- createLoadingCard(input: CreateLoadingCardInput, opts?: DesignApiOptions): NormalizedLoadingCardObject;
1117
- updateLoadingCard(input: UpdateLoadingCardInput, opts?: UpdateObjectApiOptions): NormalizedLoadingCardObject;
1118
- }
1119
- export interface MockupDataAPI {
1120
- get(id: number): SdkResultAsync<CatalogItem>;
1121
- getOverview(options?: Pick<PaginationOptions, "sort">): SdkResultAsync<MockupOverviewDto>;
1122
- getGroup(groupId: string, options?: PaginationOptions): SdkResultAsync<MockupGroupDto>;
1123
- search(query: string, options?: PaginationOptions): SdkResultAsync<PaginatedResult<CatalogItem>>;
1124
- getSuggestions(): SdkResultAsync<MockupSuggestions>;
1125
- }
1126
- export interface MockupGroupDto {
1127
- group: {
1128
- id: string;
1129
- name: string;
1130
- };
1131
- data: PaginatedResult<CatalogItem>;
1132
- }
1133
- export interface MockupOverviewDto {
1134
- overview: MockupOverviewGroupDto[];
1135
- }
1136
- export interface MockupOverviewGroupDto {
1137
- id: string;
1138
- name: string;
1139
- mockups: CatalogItem[];
1140
- total: number;
1141
- }
1142
- export interface MockupSuggestions {
1143
- tags: string[];
1144
- groups: string[];
1145
- }
1146
- export interface MockupboardAPI {
1147
- addMockupBoard(params: AddMockupBoardParams, opts?: DesignApiOptions): NormalizedStandardBoard<MockupBoardOptions>;
1148
- addMockupDesignObject(params: AddMockupDesignObjectParams, opts?: DesignApiOptions): NormalizedMockupDesignObject;
1149
- updateMockupBoard(params: UpdateMockupBoardParams, opts?: DesignApiOptions): NormalizedStandardBoard<MockupBoardOptions>;
1150
- }
1151
- export interface ObjectAPI {
1152
- setColors(params: SetColorsParams, opts?: DesignApiOptions): void;
1153
- getColors(params: GetColorsParams): SDKColorEntry[];
1154
- setLockedState(params: SetLockedParams, opts?: DesignApiOptions): WithLocked;
1155
- removeObject(params: RemoveObjectParams, opts?: DesignApiOptions): RemoveObjectResult | null;
1156
- setHiddenState(params: SetHiddenParams, opts?: DesignApiOptions): WithHidden;
1157
- rotateObject(params: RotateObjectParams, opts?: DesignApiOptions): WithObjectLayout;
1158
- getAllByFilter<T extends NormalizedObject>(predicate: (object: NormalizedObject) => boolean, opts?: DesignApiOptions): T[];
1159
- rename(input: RenameParams, opts?: DesignApiOptions): string;
1160
- getObject(params: GetObjectParams, opts?: DesignApiOptions): NormalizedObject;
1161
- _dangerouslyUpdate(updateParams: Partial<Omit<SerializedObject, "id">> & {
1162
- id: string;
1163
- }, opts?: DesignApiOptions): {
1164
- id: string;
1165
- };
1166
- }
1167
- export interface PaginatedResult<T> {
1168
- items: T[];
1169
- total?: number;
1170
- hasMore: boolean;
1171
- }
1172
- export interface PaginationOptions {
1173
- take?: number;
1174
- skip?: number;
1175
- sort?: string;
1176
- cursor?: string;
1177
- }
1178
- export interface PhotoFilterOptions {
1179
- [ImageFilterType.Saturation]: {
1180
- saturation: number;
1181
- };
1182
- [ImageFilterType.Contrast]: {
1183
- contrast: number;
1184
- };
1185
- [ImageFilterType.Brightness]: {
1186
- brightness: number;
1187
- };
1188
- [ImageFilterType.Vibrance]: {
1189
- vibrance: number;
1190
- };
1191
- [ImageFilterType.HueRotation]: {
1192
- rotation: number;
1193
- };
1194
- [ImageFilterType.Noise]: {
1195
- noise: number;
1196
- };
1197
- [ImageFilterType.Blur]: {
1198
- blur: number;
1199
- };
1200
- [ImageFilterType.Convolute]: {
1201
- matrix: number[];
1202
- };
1203
- [ImageFilterType.Pixelate]: {
1204
- blocksize: number;
1205
- };
1206
- [ImageFilterType.RemoveColor]: {
1207
- color: string | null;
1208
- distance: number;
1209
- };
1210
- }
1211
- export interface PlacementAPI {
1212
- getSmartPlacement(params: SmartPlacementInput, opts?: {
1213
- batchClient?: BatchClient<NormalizedDesignState>;
1214
- }): SmartPlacementOutput;
1215
- }
1216
- export interface PublicDragAndDropAPI {
1217
- startDragImageEvent(input: DragAndDropStartDragImageEventInput): void;
1218
- dropImage(input: DragAndDropDropImageInput): Promise<string | null>;
1219
- }
1220
- export interface PublicExportAPI {
1221
- bypassExportDialog: BypassExportDialog;
1222
- showExportModal: <Mime extends ExportMimeType>(request: ExportRequest<Mime>) => Promise<ExportResult>;
1223
- }
1224
- export interface RemoveObjectParams {
1225
- id: string;
1226
- skipIfMissing?: boolean;
1227
- }
1228
- export interface RemoveObjectResult {
1229
- removedObjectId: string;
1230
- }
1231
- export interface RichTextCompressedStylesV1 {
1232
- version: "v1";
1233
- [lineIndex: LineIndex]: {
1234
- charsAt: CharacterIndex[];
1235
- styles: Partial<RichTextSerializedCharacterStyle>;
1236
- }[];
1237
- }
1238
- export interface RichTextCompressedStylesV2 {
1239
- version: "v2";
1240
- customStyles: Record<string, Partial<RichTextSerializedCharacterStyle>>;
1241
- [lineIndex: LineIndex]: {
1242
- charsAt: [
1243
- CharacterIndex,
1244
- SequenceLength
1245
- ][];
1246
- styleId: string;
1247
- }[];
1248
- }
1249
- export interface RotateObjectParams {
1250
- id: string;
1251
- angle: number;
1252
- origin?: {
1253
- x: OriginX;
1254
- y: OriginY;
1255
- };
1256
- }
1257
- export interface SetHiddenParams {
1258
- id: string;
1259
- hidden: boolean;
1260
- }
1261
- export interface SetLockedParams {
1262
- id: string;
1263
- locked: boolean;
1264
- }
1265
- export interface ShadowOptions {
1266
- angle: number;
1267
- offset: number;
1268
- blur: number;
1269
- color: string | null;
1270
- }
1271
- export interface ShapeAPI {
1272
- createPredefinedShape(input: CreateShapeInput, opts?: DesignApiOptions): NormalizedBasicShapeObject;
1273
- createBasicShape(input: CreateBasicShapeInput, opts?: DesignApiOptions): Promise<NormalizedBasicShapeObject>;
1274
- updateShape(input: UpdateShapeInput, opts?: UpdateObjectApiOptions): NormalizedBasicShapeObject;
1275
- convertShapeToMask(input: ConvertShapeToMaskInput, opts?: DesignApiOptions): DesignStructureObject;
1276
- }
1277
- export interface SmartboardAPI {
1278
- addSmartboard(params: AddSmartboardParams, opts?: DesignApiOptions): NormalizedStandardBoard<SmartboardOptions>;
1279
- updateSmartboard(params: UpdateSmartboardParams, opts?: DesignApiOptions): NormalizedStandardBoard<SmartboardOptions>;
1280
- updateBackgroundImage(params: UpdateSmartboardBackgroundImageParams, opts?: DesignApiOptions): Promise<NormalizedStandardBoard<SmartboardOptions>>;
1281
- }
1282
- export interface SpendCreditsOptions {
1283
- amount: number;
1284
- message: string;
1285
- onAccept?: () => void;
1286
- onDecline?: () => void;
1287
- }
1288
- export interface SpendCreditsResult {
1289
- success: boolean;
1290
- }
1291
- export interface StandardArtboardOptions extends BaseStandardArtboardOptions<ObjectType.Artboard> {
1292
- }
1293
- export interface StartGenerationResult {
1294
- generationId: string;
1295
- }
1296
- export interface StateAPI {
1297
- implementSubState(params: Partial<NormalizedDesignState>, opts?: ImplementSubStateOptions): Partial<NormalizedDesignState>;
1298
- getState(): NormalizedDesignState;
1299
- }
1300
- export interface StructureObjectMeta {
1301
- textBadge?: {
1302
- styleId: string;
1303
- };
1304
- name?: string;
1305
- type?: LayerType;
1306
- defaultIcon?: LayerIconType;
1307
- hidden?: boolean;
1308
- locked?: boolean;
1309
- open?: boolean;
1310
- linkedBoardId?: string;
1311
- maskObjectId?: string;
1312
- maskBackgroundColor?: string | null;
1313
- }
1314
- export interface TextAPI {
1315
- addText(params: AddTextParams, opts?: DesignApiOptions): NormalizedRichTextObject;
1316
- updateText(params: UpdateTextParams, opts?: UpdateObjectApiOptions): NormalizedRichTextObject;
1317
- updateRenderPlugin(params: UpdateRenderPluginParams, opts?: DesignApiOptions): NormalizedRichTextObject;
1318
- updateDecorationPlugin(params: UpdateDecorationPluginParams, opts?: DesignApiOptions): NormalizedRichTextObject;
1319
- }
1320
- export interface TextureAPI {
1321
- setTexture(params: SetTextureParams, opts?: DesignApiOptions): SdkResult<NormalizedBoard, SdkError>;
1322
- removeTexture(params: RemoveTextureParams, opts?: DesignApiOptions): SdkResult<NormalizedBoard, SdkError>;
1323
- updateTexture(params: UpdateTextureParams, opts?: DesignApiOptions): SdkResult<NormalizedBoard, SdkError>;
1324
- releaseTexture(params: ReleaseTextureParams, opts?: DesignApiOptions): SdkResult<IllustrationImageSerializedObject, SdkError>;
1325
- }
1326
- export interface TextureOptions {
1327
- texture: string;
1328
- mode: BlendMode;
1329
- opacity: number;
1330
- hidden?: boolean;
1331
- loaded?: boolean;
1332
- isAlphaMask?: boolean;
1333
- renderClip?: boolean;
1334
- }
1335
- export interface TransformOptions {
1336
- type: "freeLine" | "freeForm" | "circle" | "angle" | "arch" | "rise" | "wave" | "flag" | null;
1337
- directionInverted?: boolean;
1338
- curve?: number;
1339
- isChanging?: boolean;
1340
- }
1341
- export interface UpdateFontFamilyOptions {
1342
- id: string;
1343
- name: string;
1344
- }
1345
- export interface UpdateFontStyleOptions {
1346
- fontFamilyId: string;
1347
- id: string;
1348
- style: string;
1349
- }
1350
- export interface UpdateGuideInput {
1351
- id: string;
1352
- top?: number;
1353
- left?: number;
1354
- }
1355
- export interface UpdateLoadingCardInput {
1356
- id: string;
1357
- position?: CreateElementWithPositionAndSize["position"];
1358
- size?: CreateElementWithPositionAndSize["size"];
1359
- imageGenerationId?: string;
1360
- startedAt?: number;
1361
- generatingModelKey?: string;
1362
- generationAverageSpeed?: number;
1363
- name?: string;
127
+ /**
128
+ * Host-agnostic APIs every mounting-point SDK entrypoint exposes.
129
+ *
130
+ * @public
131
+ */
132
+ export interface KittlSDKSharedAPIs {
133
+ /**
134
+ * Auth API for extension OAuth flows via the host page.
135
+ */
136
+ auth: AsyncAuthAPI;
1364
137
  }
1365
- export interface UploadAPI {
1366
- image: ImageUploadAPI;
138
+ /** Registers an extension-owned content source using the existing callback protocol. */
139
+ export interface UploadBrowserRegistrationAPI {
140
+ /** Registers a tab whose fetchContent callback remains inside this iframe. */
141
+ registerUploadBrowser: (tab: Omit<FileBrowserTab, "onEvent">) => Promise<SdkResponse<void>>;
1367
142
  }
1368
143
  export interface UserTokenResult {
1369
144
  success: true;
1370
145
  token: string;
1371
146
  }
1372
- export interface VideoAPI {
1373
- addVideo(params: AddVideoParams, opts?: DesignApiOptions): Promise<NormalizedVideoObject>;
1374
- updateVideo(params: UpdateVideoParams, opts?: UpdateObjectApiOptions): NormalizedVideoObject;
1375
- removePlaylistItem(params: RemoveVideoPlaylistItemParams, opts?: DesignApiOptions): NormalizedVideoObject;
1376
- reorderPlaylistItem(params: ReorderVideoPlaylistItemParams, opts?: DesignApiOptions): NormalizedVideoObject;
1377
- addPlaylistItem(params: AddVideoPlaylistItemParams, opts?: DesignApiOptions): NormalizedVideoObject;
1378
- updatePlaylistItem(params: UpdateVideoPlaylistItemParams, opts?: DesignApiOptions): Promise<NormalizedVideoObject>;
1379
- }
1380
- export interface VideoGenerationResult {
1381
- type: typeof ResultType.VIDEO;
1382
- status: "PROCESSING" | "READY" | "FAILED";
1383
- playbackId?: string;
1384
- duration?: number;
1385
- aspectRatio?: string;
1386
- hostingProvider?: "MUX";
1387
- }
1388
- export interface VideoGenerationStartedResult extends GenerationStartedResultCommonProps {
1389
- type: typeof ResultType.VIDEO;
1390
- }
1391
- export interface VideoboardAPI {
1392
- addVideoboard(params: AddVideoboardParams, opts?: DesignApiOptions): Promise<NormalizedStandardBoard<VideoboardOptions>>;
1393
- setVideoOnVideoboard(params: SetVideoOnVideoboardParams, opts?: DesignApiOptions): Promise<NormalizedStandardBoard<VideoboardOptions>>;
1394
- updateVideoboard(params: UpdateVideoboardParams, opts?: DesignApiOptions): NormalizedStandardBoard<VideoboardOptions>;
1395
- removePlaylistItem(params: RemovePlaylistItemParams, opts?: DesignApiOptions): NormalizedStandardBoard<VideoboardOptions>;
1396
- updatePlaylistItem(params: UpdatePlaylistItemParams, opts?: DesignApiOptions): Promise<NormalizedStandardBoard<VideoboardOptions>>;
1397
- }
1398
- export interface WithHidden {
1399
- hidden?: boolean | undefined;
1400
- }
1401
- export interface WithLocked {
1402
- locked?: boolean | undefined;
1403
- }
1404
- export interface WithObjectLayout {
1405
- width: number;
1406
- height: number;
1407
- scaleX: number;
1408
- scaleY: number;
1409
- angle: number;
1410
- top: number;
1411
- left: number;
1412
- flipX: boolean;
1413
- flipY: boolean;
1414
- }
1415
- export type AIGenerationActionOrigin = "COPILOT" | "RIGHT_PANEL" | "LEFT_PANEL" | "MICRO_APP" | "IMAGE_SETS" | "AI_CHAT" | "SMARTBOARD" | "AI_INPUT_GENERATE_IMAGE" | "AI_INPUT_REMIX_IMAGE" | "AI_INPUT_GENERATE_VIDEO" | "AI_INPUT_MICRO_EDITOR_REMIX" | "AI_INPUT_MICRO_EDITOR_INPAINT" | "AI_HUB_GENERATE_IMAGE" | "AI_HUB_REMIX_IMAGE" | "AI_HUB_GENERATE_VIDEO" | "VIDEOBOARD" | "AGENT" | "AI_HUB_AGENT" | "WORKFLOW" | "MCP" | "MCP_WORKFLOW" | "AI_AGENT" | "AI_AGENT_CHAT" | "AI_AGENT_CHAT_WEBSITE";
1416
- export type AIGenerationContentType = "image" | "video";
1417
- export type AIGenerationModelTaskType = "IMAGE_TO_IMAGE" | "IMAGE_INPAINT" | "IMAGE_OUTPAINT" | "TEXT_TO_IMAGE" | "IMAGE_TO_VIDEO";
1418
- export type AIGenerationReferenceImageMode = "keyframe" | "reference";
1419
- export type APIOptions<T extends Record<string, unknown>> = {
1420
- batchClient?: BatchClient<T>;
1421
- } | {
1422
- origin?: Origin;
1423
- historyOrigin?: HistoryOrigins;
1424
- } | undefined;
1425
- export type AbsolutePosition = {
1426
- absolute: LeftTopPosition;
1427
- };
1428
- export type ActiveTool = {
1429
- type: "artboard";
1430
- } | {
1431
- type: "move";
1432
- } | {
1433
- type: "hand";
1434
- } | {
1435
- type: "pen";
1436
- } | {
1437
- type: "pen-vector-editing";
1438
- } | {
1439
- type: "comment";
1440
- } | {
1441
- type: "text";
1442
- } | {
1443
- type: "shape";
1444
- shape: BasicShapeType;
1445
- };
1446
- export type AddIllustrationParams = {
1447
- src: string;
1448
- objectProperties?: IllustrationProperties;
1449
- } & CreateElementWithPositionAndSize;
1450
- export type AddImageParams = ({
1451
- src: string;
1452
- } | {
1453
- width: number;
1454
- height: number;
1455
- src?: never;
1456
- }) & GeneratableObject & {
1457
- objectProperties?: ImageProperties;
1458
- crop?: ImageCrop;
1459
- } & CreateElementWithPositionAndSize;
1460
- export type AddIntoGroupParams = {
1461
- groupId: string;
1462
- objectIds: string[];
1463
- };
1464
- export type AddMockupBoardParams = {
1465
- inputBoardIds: string[];
1466
- mockupTemplateId: number;
1467
- fill?: string;
1468
- shouldMockupColorMatchArtboard?: boolean;
1469
- initialDesigns?: AddMockupDesignObjectParams[];
1470
- } & {
1471
- position: AbsolutePosition | RelativePosition;
1472
- size: Dimensions;
1473
- };
1474
- export type AddMockupDesignObjectParams = {
1475
- mockupBoardId: string;
1476
- inputBoardId: string;
1477
- mockupTemplateId: number;
1478
- initialNormalizedUnwarpedRect: MockupDesignRect;
1479
- };
1480
- export type AddSmartboardParams = {
1481
- linkedBoardIds?: string[];
1482
- } & {
1483
- position: AbsolutePosition | RelativePosition;
1484
- size: Dimensions;
1485
- };
1486
- export type AddTextParams = {
1487
- text: string;
1488
- id?: string;
1489
- textProperties?: TextProperties;
1490
- position: CreateElementWithPositionAndSize["position"];
1491
- size: Dimensions;
1492
- };
1493
- export type AddVideoParams = {
1494
- playlist: VideoPlaylistItemInput[];
1495
- videoSize?: {
1496
- width: number;
1497
- height: number;
1498
- };
1499
- } & CreateElementWithPositionAndSize;
1500
- export type AddVideoPlaylistItemParams = {
1501
- videoId: string;
1502
- playlistItem: VideoPlaylistItemInput;
1503
- playlistItemId?: string;
1504
- previousPlaylistItemId?: string;
1505
- nextPlaylistItemId?: string;
1506
- };
1507
- export type AddVideoboardParams = {
1508
- linkedBoardIds?: string[];
1509
- video?: {
1510
- width?: number;
1511
- height?: number;
1512
- playlist: VideoPlaylistItemInput[];
1513
- };
1514
- } & {
1515
- position: AbsolutePosition | RelativePosition;
1516
- size: Dimensions;
1517
- };
1518
- export type AddedIllustration = NormalizedIllustrationObject & {
1519
- hasTextElements: boolean;
1520
- };
1521
- export type AnimateViewportParams = ViewportPatch & ViewportAnimationSettings;
1522
- export type AnimateViewportToBoundsParams = ViewportAnimationSettings & ObjectPositionRect & {
1523
- viewportPadding?: ViewportBoundsPadding;
1524
- };
1525
- export type AnimateViewportToCenterParams = ViewportAnimationSettings & ObjectPositionRect;
1526
- export type AppState = {
1527
- selectedObjectsIds: string[];
1528
- selectedLayersIds: string[];
1529
- selectedArtboardIds: string[];
1530
- selectedArtboardsObjectIds: string[];
1531
- allSelectedObjectsIds: string[];
1532
- canvasMode: CanvasMode;
1533
- activeTool: ActiveTool;
1534
- viewport: Viewport;
1535
- isDragPanning: boolean;
1536
- highlightedObjectId: string | null;
1537
- isViewOnlyMode: boolean;
1538
- hasLegacyOutOfBoundsObjects: boolean;
1539
- canvasSettings: SettingsType;
1540
- penToolSetting: {
1541
- stroke: string | null | undefined;
1542
- strokeWidth: number;
1543
- fill: Color;
1544
- };
1545
- outlineLoading: Record<string, boolean>;
1546
- objectLoading: Record<string, boolean>;
1547
- pendingOperations: Record<string, PendingOperation>;
1548
- };
1549
- export type AppStateSelectorPath = AppStateTopLevelKey | `${AppStateTopLevelKey}.${string}`;
1550
- export type AppStateTopLevelKey = keyof AppState;
1551
- export type AppStateWithoutModes = Omit<AppState, "canvasMode" | "activeTool" | "viewport" | "isDragPanning" | "highlightedObjectId" | "canvasSettings" | "objectLoading">;
1552
- export type ArtboardLikeType = ObjectType.Artboard | ObjectType.MockupBoard | ObjectType.Smartboard | ObjectType.Videoboard;
1553
- export type ArtboardOptions = StandardArtboardOptions | SmartboardOptions | MockupBoardOptions | VideoboardOptions;
1554
- export type AvailableShadowOptions = Partial<Pick<ShadowOptions, "blur">> & Omit<ShadowOptions, "blur">;
1555
- export type BaseFloatingBoard = {
1556
- id: string;
1557
- floating: true;
1558
- };
1559
- export type BasicShapeConfigurableFields = {
1560
- angle?: BasicShapeSerializedObject["angle"];
1561
- flipX?: BasicShapeSerializedObject["flipX"];
1562
- flipY?: BasicShapeSerializedObject["flipY"];
1563
- hidden?: BasicShapeSerializedObject["hidden"];
1564
- opacity?: BasicShapeSerializedObject["opacity"];
1565
- skewX?: BasicShapeSerializedObject["skewX"];
1566
- skewY?: BasicShapeSerializedObject["skewY"];
1567
- cornerRadii?: BasicShapeSerializedObject["cornerRadii"];
1568
- name?: BasicShapeSerializedObject["name"];
1569
- shadowOptions?: BasicShapeSerializedObject["shadowOptions"];
1570
- shadowColor?: NonNullable<BasicShapeSerializedObject["shadowOptions"]>["color"];
1571
- fill?: BasicShapeSerializedObject["fill"];
1572
- fillColor?: NonNullable<BasicShapeSerializedObject["fill"]>[number]["value"];
1573
- stroke?: BasicShapeSerializedObject["stroke"];
1574
- strokeWidth?: BasicShapeSerializedObject["strokeWidth"];
1575
- };
1576
- export type BasicShapeSerializedObject = typeof BASIC_SHAPE_DEFAULT_VALUES & {
1577
- nPoints?: number | undefined;
1578
- };
1579
- export type BasicShapeType = (typeof BasicShapeType)[keyof typeof BasicShapeType];
1580
- export type BoardRelinkOptions = {
1581
- relinkBoardAfterPlacement?: boolean;
1582
- };
1583
- export type BoundingBox = {
1584
- left: number;
1585
- top: number;
1586
- width: number;
1587
- height: number;
1588
- };
1589
- export type BoundingRect = {
1590
- top: number;
1591
- left: number;
1592
- bottom: number;
1593
- right: number;
1594
- };
1595
- export type BridgedSdkResult<T> = T extends SdkResult<infer _R, infer _E> ? T : SdkResult<T, Error>;
1596
- export type Builtin = Date | ((...args: never[]) => unknown) | Uint8Array | RegExp | Map<unknown, unknown> | Set<unknown>;
1597
- export type BypassExportDialog = (options: GetExportOptions) => Promise<Blob | null>;
1598
- export type CanvasMode = {
1599
- mode: "crop";
1600
- targetId: string;
1601
- } | {
1602
- mode: "erase";
1603
- targetId: string;
1604
- } | {
1605
- mode: "erase-and-fill";
1606
- targetId: string;
1607
- } | {
1608
- mode: "reframe";
1609
- targetId: string;
1610
- } | {
1611
- mode: "inpaint";
1612
- targetId: string;
1613
- } | {
1614
- mode: "custom";
1615
- id: string;
1616
- state: JSONObject;
1617
- } | null;
1618
- export type CanvasModeKind = "erase" | "erase-and-fill" | "crop" | "reframe" | "inpaint" | null;
1619
- export type CharacterIndex = number;
1620
- export type CloneArtboardParams = {
1621
- boardId: string;
1622
- position: CreateElementWithPositionAndSize["position"];
1623
- };
1624
- export type Color = GradientObject | string | null | undefined;
1625
- export type ColorInfo = StringColor | FullColor;
1626
- export type CombinedShapeSerializedObject = Omit<typeof DEFAULT_VALUES, "shapes"> & {
1627
- shapes: Shape[];
1628
- };
1629
- export type ConnectBoardsParams = {
1630
- inputBoardId: string;
1631
- targetBoardId: string;
1632
- };
1633
- export type ConnectedArtboardOptions<T extends ArtboardLikeType = ArtboardLikeType> = BaseStandardArtboardOptions<T> & {
1634
- inputBoardIds?: string[];
1635
- };
1636
- export type ContextSubscriptionCallback = (context: KittlContext) => void;
1637
- export type ConvertShapeToMaskInput = {
1638
- id: NormalizedBasicShapeObject["id"];
1639
- };
1640
- export type CreateBasicShapeInput = CreateElementWithPositionAndSize & {
1641
- objectName: string;
1642
- objectProperties?: ShapeProperties;
1643
- };
1644
- export type CreateBoardParams = Omit<CreateElementWithPositionAndSize, "size" | "boardId"> & {
1645
- title?: string;
1646
- size: {
1647
- width: number;
1648
- height: number;
1649
- };
1650
- };
1651
- export type CreateElementWithPositionAndSize = {
1652
- boardId?: string;
1653
- position: AbsolutePosition | RelativePosition;
1654
- size?: Dimensions & {
1655
- applyViewportScale?: boolean;
1656
- };
1657
- };
1658
- export type CreateGroupParams = {
1659
- structureIds: string[];
1660
- };
1661
- export type CreateGuideInput = {
1662
- boardId?: string;
1663
- } & OrientationConditional;
1664
- export type CreateShapeInput = CreateElementWithPositionAndSize & {
1665
- shapeType: BasicShapeType;
1666
- objectProperties?: ShapeProperties;
1667
- };
1668
- export type CubicBezierEasing = {
1669
- type: "cubic-bezier";
1670
- controlPoints: readonly [
1671
- x1: number,
1672
- y1: number,
1673
- x2: number,
1674
- y2: number
1675
- ];
1676
- };
1677
- export type CustomCanvasModeId<Id extends string> = Id extends Exclude<CanvasModeKind, null> ? never : Id;
1678
- export type CustomCanvasModeState<Id extends string> = Id extends keyof CustomCanvasModeStateById ? CustomCanvasModeStateById[Id] extends JSONObject ? CustomCanvasModeStateById[Id] : never : JSONObject;
1679
- export type DeepPartial<T> = {
1680
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
1681
- };
1682
- export type DeepValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? DeepValue<NonNullable<T[K]>, Rest> : T extends Record<string, infer V> ? DeepValue<NonNullable<V>, Rest> : undefined : P extends keyof T ? T[P] : T extends Record<string, infer V> ? V : undefined;
1683
- export type DesignApiOptions = APIOptions<NormalizedDesignState>;
1684
- export type DesignObjectId = string;
1685
- export type DesignStateSelectorPath = DesignStateTopLevelKey | `${DesignStateTopLevelKey}.${string}`;
1686
- export type DesignStateTopLevelKey = keyof NormalizedDesignState;
1687
- export type DesignStructureObject = {
1688
- id?: StructureObjectId | null;
1689
- meta?: StructureObjectMeta;
1690
- parentId?: ID;
1691
- };
1692
- export type Dimensions = {
1693
- width: number;
1694
- height: number;
1695
- };
1696
- export type DisconnectBoardsParams = ConnectBoardsParams;
1697
- export type EasingName = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out";
1698
- export type EditorColorScheme = "light" | "dark";
1699
- export type ElementLocation = "origin" | "center";
1700
- export type Expand<T> = T extends infer O ? {
1701
- [K in keyof O]: O[K];
1702
- } : never;
1703
- export type ExportAPI = PublicExportAPI;
1704
- export type ExportFieldValue = string | number | boolean | string[];
1705
- export type ExportFieldValues = Record<string, ExportFieldValue>;
1706
- export type ExportMimeType = (typeof EXPORT_MIME_TYPES)[keyof typeof EXPORT_MIME_TYPES];
1707
- export type ExportRequest<Mime extends ExportMimeType = ExportMimeType> = {
1708
- target: readonly string[];
1709
- title: string;
1710
- exportLabel: string;
1711
- customFields?: readonly PlainInputSetting[];
1712
- mimeTypes?: readonly Mime[];
1713
- initialFileFormat?: Mime;
1714
- };
1715
- export type ExportResult = {
1716
- blobs: readonly Blob[];
1717
- settings: ExportFieldValues;
1718
- };
147
+ /**
148
+ * Union of nodes a dynamic tab can return.
149
+ */
1719
150
  export type FileBrowserContent = FileBrowserItem | FileBrowserFolder;
151
+ export type FileBrowserContentSource = "generated" | "uploaded";
152
+ /**
153
+ * Input arguments for a file browser content request.
154
+ */
1720
155
  export type FileBrowserFetchContentParams = {
156
+ /** Folder or entry id to load. Omit to load the root content. */
1721
157
  id?: string;
158
+ /** Optional pagination cursor for fetching the next slice of content. */
1722
159
  next?: string | number;
160
+ /**
161
+ * Media kinds the current session accepts, so a tab backed by an API that
162
+ * can filter server-side does not spend a page on entries the gallery will
163
+ * hide anyway.
164
+ *
165
+ * This is an optimisation hint, not a contract: the host still drops
166
+ * entries of an unwanted kind before rendering, so a tab that ignores this
167
+ * stays correct. `undefined` means the session did not narrow its kinds.
168
+ */
1723
169
  formats?: readonly FileBrowserMediaFormat[];
1724
170
  };
171
+ /**
172
+ * Result returned from a file browser content request.
173
+ */
1725
174
  export type FileBrowserFetchContentResult = {
175
+ /** Content nodes returned for the requested folder or root view. */
1726
176
  content: FileBrowserContent[];
177
+ /** Optional cursor for loading the next page of the same folder view. */
1727
178
  next?: string | number;
1728
179
  error?: string;
1729
180
  };
181
+ /**
182
+ * Nested folder node returned by a dynamic gallery tab.
183
+ */
1730
184
  export type FileBrowserFolder = {
1731
185
  type: "folder";
1732
186
  label: string;
1733
187
  id: string;
1734
188
  preview?: string;
189
+ /**
190
+ * Optional eager-loaded children for this folder.
191
+ *
192
+ * When omitted, consumers should call the tab's
193
+ * `fetchContent({ id: folder.id })` method to load the folder contents on
194
+ * demand.
195
+ */
1735
196
  content?: Array<FileBrowserContent>;
1736
197
  };
198
+ /**
199
+ * Leaf asset returned by a dynamic gallery tab.
200
+ */
1737
201
  export type FileBrowserItem = {
1738
202
  type: "item";
1739
203
  label: string;
1740
204
  id: string;
1741
205
  preview?: string;
206
+ /**
207
+ * Optional looping preview played while the tile is hovered — e.g. an
208
+ * animated WEBP or GIF of a video's opening seconds.
209
+ *
210
+ * Only used for video items, which fall back to their static `preview` when
211
+ * this is omitted.
212
+ */
1742
213
  animatedPreview?: string;
1743
214
  content: {
1744
215
  data: string;
216
+ /** Identifies whether the content came from uploads or generated content. */
217
+ source?: FileBrowserContentSource;
218
+ /** Optional MIME type used when materializing the selected asset. */
1745
219
  mimeType?: string;
220
+ /** Persisted upload classification. */
1746
221
  uploadType?: UploadType;
1747
222
  };
1748
223
  };
224
+ /**
225
+ * Media kind a file browser session can deal in.
226
+ *
227
+ * Both kinds are browsable and selectable; only images have an upload path.
228
+ */
1749
229
  export type FileBrowserMediaFormat = "image" | "video";
230
+ /**
231
+ * Registration contract for a file browser tab in the upload panel.
232
+ */
1750
233
  export type FileBrowserTab = {
234
+ /** Unique identifier for the browser tab */
1751
235
  id: string;
236
+ /** Display label for the tab */
1752
237
  label: string;
238
+ /** Optional display order. Lower values render first. */
1753
239
  order?: number;
240
+ /** Optional product empty-state treatment. Omit for the generic state. */
1754
241
  emptyState?: FileBrowserTabEmptyState;
242
+ /**
243
+ * Media kinds this tab is able to return.
244
+ *
245
+ * Unlike the `formats` hint handed to `fetchContent` — what the session
246
+ * wants — this is what the tab has. The host hides the whole tab when the
247
+ * two sets do not intersect, so a session that only wants video never opens
248
+ * an image-only tab just to find it empty.
249
+ *
250
+ * Omit (or pass an empty array) when the tab can return any kind, or when it
251
+ * cannot know in advance; such a tab is always shown and its entries are
252
+ * filtered on render as before.
253
+ */
1755
254
  supportedFormats?: readonly FileBrowserMediaFormat[];
255
+ /**
256
+ * Loads root content, a specific folder, or a specific entry.
257
+ *
258
+ * If a returned folder has `content === undefined`, call
259
+ * `fetchContent({ id: folder.id })` to load that folder lazily.
260
+ *
261
+ * If the returned result exposes `next`, pass it back as
262
+ * `fetchContent({ id, next })` to load the next page for that folder view.
263
+ *
264
+ * The provider may also call `fetchContent({ id })` to refresh one specific
265
+ * entry when invalidation is requested.
266
+ */
1756
267
  fetchContent: (params?: FileBrowserFetchContentParams) => Promise<FileBrowserFetchContentResult>;
268
+ /** Optional lifecycle hook emitted by the host gallery. */
1757
269
  onEvent?: (event: FileBrowserTabEvent) => void;
1758
270
  };
271
+ /** Product empty-state treatment shown when a tab has no content. */
1759
272
  export type FileBrowserTabEmptyState = "aiCreations" | "uploads";
273
+ /** Lifecycle event emitted by the host gallery. */
1760
274
  export type FileBrowserTabEvent = "close" | "open" | "upload";
1761
- export type FlattenUnion<T> = UnionToIntersection<T extends unknown ? Partial<T> : never>;
1762
- export type FontListDto = PaginatedResult<FontFamilyDto>;
1763
- export type FontVariationSettings = Record<string, number> & Partial<Record<KnownFontVariationAxis, number>>;
1764
- export type FontWeight = OrAnyString<"Regular" | "Bold" | "Light" | "Medium" | "Black" | "SemiBold" | "Italic" | "ExtraLight" | "Thin" | "ExtraBold" | "LightItalic" | "MediumItalic" | "SemiBoldItalic" | "BlackItalic" | "ExtraBoldItalic" | "ThinItalic" | "ExtraLightItalic" | "BoldItalic">;
1765
- export type FullColor = {
1766
- key: "fill" | (Exclude<string, StringColorKeysType> & {});
1767
- value: Color;
1768
- visible: boolean;
1769
- };
1770
- export type FunctionType = (...args: never) => unknown;
1771
- export type GenerationStatus = (typeof GenerationStatus)[keyof typeof GenerationStatus];
1772
- export type GenerationStatusUpdate = {
1773
- generationId: string;
1774
- status: typeof GenerationStatus.CREATED;
1775
- inputData: undefined;
1776
- creditUse: undefined;
1777
- result: undefined;
1778
- } | {
1779
- generationId: string;
1780
- status: typeof GenerationStatus.QUEUED;
1781
- inputData?: GenerationInputData;
1782
- creditUse?: GenerationCreditUse;
1783
- result?: StartedGenerationResult;
1784
- } | {
1785
- generationId: string;
1786
- status: typeof GenerationStatus.STARTED;
1787
- inputData: GenerationInputData;
1788
- creditUse?: GenerationCreditUse;
1789
- result: StartedGenerationResult;
1790
- } | {
1791
- generationId: string;
1792
- status: typeof GenerationStatus.COMPLETE;
1793
- inputData: GenerationInputData;
1794
- creditUse?: GenerationCreditUse;
1795
- result: SuccessGenerationResult;
1796
- } | {
1797
- generationId: string;
1798
- status: typeof GenerationStatus.FAILED;
1799
- inputData: GenerationInputData | undefined;
1800
- creditUse?: GenerationCreditUse;
1801
- result: ErrorGenerationResult;
1802
- } | {
1803
- generationId: string;
1804
- status: typeof GenerationStatus.CANCELLED;
1805
- inputData?: GenerationInputData;
1806
- creditUse?: GenerationCreditUse;
1807
- result: undefined;
1808
- };
1809
- export type GetColorsParams = {
1810
- objectId: string;
1811
- };
1812
- export type GetIllustrationPathsParams = {
1813
- id: string;
1814
- };
1815
- export type GuideSerializedObject = typeof GUIDE_DEFAULT_VALUES & OrientationDir;
1816
- export type ID = string;
1817
- export type IllustrationImageSerializedObject = typeof DEFAULT_VALUES$1 & {
1818
- backgroundRemoved?: boolean | undefined;
1819
- objectNameWithBackground?: string;
1820
- backgroundRestorePathBoundary?: number | undefined;
1821
- realWidth?: number | undefined;
1822
- realHeight?: number | undefined;
1823
- erasePaths?: {
1824
- cacheKey: string;
1825
- objectName: string | null;
1826
- fallbackObjectName?: string;
1827
- } | undefined;
1828
- eraseStrokeWidth?: number | undefined;
1829
- inpaintingStrokeWidth?: number | undefined;
1830
- inpaintingSelectionMode?: InpaintingSelectionMode;
1831
- eraseAndFillStrokeWidth?: number | undefined;
1832
- unsplashId?: string | undefined;
1833
- };
1834
- export type IllustrationProperties = {
1835
- angle?: IllustrationSerializedObject["angle"];
1836
- defaultName?: IllustrationSerializedObject["defaultName"];
1837
- flipX?: IllustrationSerializedObject["flipX"];
1838
- flipY?: IllustrationSerializedObject["flipY"];
1839
- hidden?: IllustrationSerializedObject["hidden"];
1840
- opacity?: IllustrationSerializedObject["opacity"];
1841
- shadowOptions?: IllustrationSerializedObject["shadowOptions"];
1842
- stroke?: IllustrationSerializedObject["stroke"];
1843
- strokeWidth?: IllustrationSerializedObject["strokeWidth"];
1844
- fill?: IllustrationSerializedObject["fill"];
1845
- gradients?: IllustrationSerializedObject["gradients"];
1846
- generation?: IllustrationSerializedObject["generation"];
1847
- };
1848
- export type IllustrationSerializedChild = {
1849
- id: string;
1850
- isChild: true;
1851
- baseFill?: string | GradientObject | null;
1852
- baseStroke?: string | GradientObject | null;
1853
- name?: string | null;
1854
- defaultName: string;
1855
- width: number;
1856
- height: number;
1857
- fillRule?: CanvasFillRule;
1858
- strokeLineCap?: CanvasLineCap;
1859
- strokeLineJoin?: CanvasLineJoin;
1860
- strokeWidth?: number;
1861
- strokeUniform?: boolean;
1862
- strokeDashArray?: number[];
1863
- strokeDashOffset?: number;
1864
- strokeMiterLimit?: number;
1865
- transform: number[];
1866
- type: string;
1867
- opacity: number;
1868
- locked: boolean;
1869
- hidden: boolean;
1870
- path: (string | number)[][];
1871
- pathOffset?: {
1872
- x: number;
1873
- y: number;
1874
- };
1875
- };
1876
- export type IllustrationSerializedChildren = IllustrationSerializedChild[];
1877
- export type IllustrationSerializedObject = typeof ILLUSTRATION_DEFAULT_VALUES;
1878
- export type ImageCrop = {
1879
- x: number;
1880
- y: number;
1881
- width: number;
1882
- height: number;
1883
- };
1884
- export type ImageProperties = {
1885
- angle?: IllustrationImageSerializedObject["angle"];
1886
- flipX?: IllustrationImageSerializedObject["flipX"];
1887
- flipY?: IllustrationImageSerializedObject["flipY"];
1888
- hidden?: IllustrationImageSerializedObject["hidden"];
1889
- opacity?: IllustrationImageSerializedObject["opacity"];
1890
- shadowOptions?: IllustrationImageSerializedObject["shadowOptions"];
1891
- stroke?: IllustrationImageSerializedObject["stroke"];
1892
- strokeWidth?: IllustrationImageSerializedObject["strokeWidth"];
1893
- fill?: IllustrationImageSerializedObject["fill"];
1894
- defaultName?: IllustrationImageSerializedObject["defaultName"];
1895
- unsplashId?: IllustrationImageSerializedObject["unsplashId"];
1896
- };
1897
- export type ImplementSubStateOptions = DesignApiOptions & {
1898
- placement?: ImplementSubStatePlacement;
1899
- };
1900
- export type ImplementSubStatePlacement = {
1901
- afterExistingStandardBoards: {
1902
- gap?: number;
1903
- top?: number;
1904
- };
1905
- } | {
1906
- absolute: {
1907
- left: number;
1908
- top?: number;
1909
- gap?: number;
1910
- };
1911
- };
1912
- export type InternalPatchArgs<T> = {
1913
- patch: PatchTree<T> | PatchTree<T>[];
1914
- origin: Origin;
1915
- historyOrigin?: HistoryOrigins;
1916
- };
1917
- export type JSONObject = {
1918
- [key: string]: JSONValue;
1919
- };
1920
- export type JSONValue = null | boolean | number | string | Array<JSONValue> | JSONObject;
1921
- export type KnownFontVariationAxis = "wght" | "wdth" | "slnt" | "ital" | "opsz" | "GRAD";
1922
- export type LayerIconType = "drawIcon";
1923
- export type LayerType = Exclude<SerializableObjectType, ObjectType.Guide> | typeof structuralGroupType | typeof clippingMaskType | typeof backgroundType | typeof pathType;
1924
- export type LayersMovePosition = "before" | "after" | "into";
1925
- export type LeftTopPosition = {
1926
- left: number;
1927
- top: number;
1928
- };
1929
- export type LineHeight = {
1930
- value: number;
1931
- unit: LineHeightUnit;
1932
- };
1933
- export type LineHeightUnit = "px" | "%";
1934
- export type LineIndex = number;
1935
- export type LoadingCardSerializedObject = typeof LOADING_CARD_DEFAULT_VALUES & {
1936
- imageGenerationId?: string | undefined;
1937
- startedAt?: number | undefined;
1938
- generatingModelKey?: string | undefined;
1939
- generationAverageSpeed?: number | undefined;
1940
- };
1941
- export type MaskSerializedObject = typeof MASK_DEFAULT_VALUES & {
1942
- maskFill?: string | null | undefined;
1943
- isClipPath?: boolean | undefined;
1944
- };
1945
- export type MockupBoardOptions = ConnectedArtboardOptions<ObjectType.MockupBoard> & {
1946
- mockupTemplateId?: number;
1947
- shouldMockupColorMatchArtboard?: boolean;
1948
- };
1949
- export type MockupDesignRect = {
1950
- x: number;
1951
- y: number;
1952
- width: number;
1953
- height: number;
1954
- };
1955
- export type MockupDesignSerializedObject = typeof MOCKUP_DESIGN_DEFAULT_VALUES & {
1956
- inputBoardId: string;
1957
- mockupTemplateId: number;
1958
- initialNormalizedUnwarpedRect: MockupDesignRect;
1959
- };
1960
- export type MoveToParams = {
1961
- boardOrObjectIds: string[];
1962
- position: LayersMovePosition;
1963
- targetId: string;
1964
- };
1965
- export type NormalizeArray<T> = T extends (infer U)[] ? Record<string, Normalized<U>> : never;
1966
- export type NormalizeObject<T> = Expand<{
1967
- [K in keyof T]: NormalizeValue<T[K]>;
1968
- } & {
1969
- [K in keyof T as undefined extends T[K] ? never : NonNullable<T[K]> extends Array<unknown> ? T[K] extends null ? never : `${Extract<K, string>}Indices` : never]: Record<string, string>;
1970
- } & {
1971
- [K in keyof T as undefined extends T[K] ? NonNullable<T[K]> extends Array<unknown> ? T[K] extends null | undefined ? never : `${Extract<K, string>}Indices` : never : never]?: Record<string, string>;
1972
- }>;
1973
- export type NormalizeValue<T> = T extends null | undefined ? T : NonNullable<T> extends unknown[] | readonly unknown[] ? undefined extends T ? NormalizeArray<NonNullable<T>> | undefined : NormalizeArray<T> : T extends Builtin ? T : NonNullable<T> extends object ? Normalized<T> : T;
1974
- export type Normalized<T> = T extends null | undefined ? T : T extends Builtin ? T : T extends unknown[] | readonly unknown[] ? NormalizeArray<T> : T extends object ? NormalizeObject<T> : T;
1975
- export type NormalizedBasicShapeObject = Normalized<BasicShapeSerializedObject>;
1976
- export type NormalizedBoard = NormalizedStandardBoard | NormalizedFloatingBoard;
1977
- export type NormalizedCombinedShapeObject = Normalized<CombinedShapeSerializedObject>;
1978
- export type NormalizedDesignState = {
1979
- boards: Record<ID, NormalizedBoard>;
1980
- boardsIndices: Record<ID, string>;
1981
- objects: Record<ID, NormalizedObject>;
1982
- groupStructures: Record<ID, DesignStructureObject>;
1983
- groupStructuresIndices: Record<ID, string>;
1984
- config: DesignConfig;
1985
- };
1986
- export type NormalizedFloatingBoard = Normalized<BaseFloatingBoard>;
1987
- export type NormalizedGuideObject = Normalized<GuideSerializedObject>;
1988
- export type NormalizedIllustrationImageObject = Normalized<IllustrationImageSerializedObject>;
1989
- export type NormalizedIllustrationObject = Normalized<IllustrationSerializedObject>;
1990
- export type NormalizedLoadingCardObject = Normalized<LoadingCardSerializedObject>;
1991
- export type NormalizedMaskObject = Normalized<MaskSerializedObject>;
1992
- export type NormalizedMockupDesignObject = Normalized<MockupDesignSerializedObject>;
1993
- export type NormalizedObject = NormalizedStandardObject | NormalizedGuideObject;
1994
- export type NormalizedPathTextObject = Normalized<PathTextSerializedObject>;
1995
- export type NormalizedRichTextObject = Normalized<RichTextSerializedObject>;
1996
- export type NormalizedStandardBoard<T extends ArtboardOptions = ArtboardOptions> = Normalized<BaseStandardBoard<T>>;
1997
- export type NormalizedStandardObject = NormalizedBasicShapeObject | NormalizedCombinedShapeObject | NormalizedIllustrationImageObject | NormalizedIllustrationObject | NormalizedLoadingCardObject | NormalizedMaskObject | NormalizedMockupDesignObject | NormalizedPathTextObject | NormalizedRichTextObject | NormalizedVideoObject;
1998
- export type NormalizedVideoObject = Normalized<VideoSerializedObject>;
1999
- export type NullablePathTextShadowOptions = PathTextShadowOptions | {
2000
- type: null;
2001
- };
2002
- export type ObjectPosition = {
2003
- top: number;
2004
- left: number;
2005
- };
2006
- export type ObjectPositionRect = {
2007
- width: number;
2008
- height: number;
2009
- } & ObjectPosition;
2010
- export type OnGenerationStatusUpdate = (update: GenerationStatusUpdate) => void | Promise<void>;
2011
- export type OrAnyString<T extends string> = T | (string & {});
2012
- export type OrientationConditional = {
2013
- orientation: Orientation.HORIZONTAL;
2014
- top: number;
2015
- } | {
2016
- orientation: Orientation.VERTICAL;
2017
- left: number;
2018
- };
2019
- export type OrientationDir = {
2020
- orientation: Orientation.HORIZONTAL;
2021
- top: number;
2022
- } | {
2023
- orientation: Orientation.VERTICAL;
2024
- left: number;
2025
- };
2026
- export type OriginX = "left" | "center" | "right";
2027
- export type OriginY = "top" | "center" | "bottom";
2028
- export type PatchAction<T> = {
2029
- action: Action.MERGE;
2030
- value: DeepPartial<T>;
2031
- } | {
2032
- action: Action.SET;
2033
- value: T;
2034
- } | {
2035
- action: Action.DELETE;
2036
- };
2037
- export type PatchTree<S> = {
2038
- [K in keyof S]?: NonNullable<S[K]> extends object ? PatchAction<DeepPartial<S[K]>> | PatchTree<NonNullable<DeepPartial<S[K]>>> : PatchAction<DeepPartial<S[K]>>;
2039
- };
2040
- export type PathTextSerializedObject = typeof PATH_TEXT_DEFAULT_VALUES & {
2041
- relativeSize?: number | undefined;
2042
- overrideText?: string | undefined;
2043
- transformOptions: PathTextTransformOptions;
2044
- fontFamily?: string | undefined;
2045
- fontWeight?: string | undefined;
2046
- text: string;
2047
- shadowOptions: NullablePathTextShadowOptions;
2048
- adjustableWidth?: number | undefined;
2049
- uppercase?: boolean | undefined;
2050
- underline?: boolean | undefined;
2051
- variation?: Record<string, number> | undefined;
2052
- variationAxes?: Record<string, FontVariation> | undefined;
2053
- decorationOptions?: DecorationOptions | undefined;
2054
- isUserFont?: boolean | undefined;
2055
- };
2056
- export type PathTextShadowOptions = ShadingOptions & ShadowOptions & {
2057
- color: string;
2058
- };
2059
- export type PathTextTransformOptions = TransformOptions & {
2060
- points: {
2061
- x: number;
2062
- y: number;
2063
- }[];
2064
- };
2065
- export type PendingOperation = (typeof PendingOperation)[keyof typeof PendingOperation];
2066
- export type PlainInputSetting = {
2067
- isPremium?: boolean;
2068
- name: "combineBoards" | (string & {});
2069
- label?: string;
2070
- disabled?: true;
2071
- } & ({
2072
- type: "selection";
2073
- options: readonly SelectionOption[];
2074
- default?: string;
2075
- } | {
2076
- type: "input";
2077
- propType: "string";
2078
- unit?: string;
2079
- default?: string;
2080
- } | {
2081
- type: "input";
2082
- propType: "number";
2083
- unit?: string;
2084
- default?: number;
2085
- max?: number;
2086
- min?: number;
2087
- } | {
2088
- type: "input";
2089
- propType: "boolean";
2090
- unit?: string;
2091
- default?: boolean;
2092
- });
2093
- export type PrintMargins = {
2094
- enabled: boolean;
2095
- top: number;
2096
- right: number;
2097
- bottom: number;
2098
- left: number;
2099
- };
2100
- export type RelativePosition = {
2101
- relative: RelativeToObject | RelativeToViewport | RelativeToScreen;
2102
- };
2103
- export type RelativeToObject = {
2104
- to: Exclude<string, "viewport">;
2105
- location: ElementLocation;
2106
- offset?: LeftTopPosition;
2107
- };
2108
- export type RelativeToScreen = {
2109
- to: "screen";
2110
- coordinates: ScreenCoordinates;
2111
- offset?: LeftTopPosition;
2112
- };
2113
- export type RelativeToViewport = {
2114
- to: "viewport";
2115
- location: ElementLocation;
2116
- offset?: LeftTopPosition;
2117
- };
2118
- export type ReleaseTextureParams = {
2119
- boardId: string;
2120
- };
2121
- export type RemoveFromGroupParams = {
2122
- objectIds: string[];
2123
- };
2124
- export type RemoveGroupParams = {
2125
- groupId: string;
2126
- };
2127
- export type RemoveIllustrationPathParams = {
2128
- illustrationId: string;
2129
- pathIds: string[];
2130
- };
2131
- export type RemovePlaylistItemParams = {
2132
- videoBoardId: string;
2133
- playlistItemId: string;
2134
- };
2135
- export type RemoveTextureParams = {
2136
- boardId: string;
2137
- };
2138
- export type RemoveVideoPlaylistItemParams = {
2139
- videoId: string;
2140
- playlistItemId: string;
2141
- };
2142
- export type RenameIllustrationPathParams = {
2143
- illustrationId: string;
2144
- pathId: string;
2145
- newName: string;
2146
- };
2147
- export type RenameParams = {
2148
- objectId: string;
2149
- newName: string;
2150
- };
2151
- export type ReorderVideoPlaylistItemParams = {
2152
- videoId: string;
2153
- playlistItemId: string;
2154
- previousPlaylistItemId?: string;
2155
- nextPlaylistItemId?: string;
2156
- };
2157
- export type ResetImageBackgroundRemovalParams = {
2158
- id: IllustrationImageSerializedObject["id"];
2159
- };
2160
- export type ResetImageCropParams = {
2161
- id: IllustrationImageSerializedObject["id"];
2162
- };
2163
- export type ResultType = (typeof ResultType)[keyof typeof ResultType];
2164
- export type RichTextBasePluginSerializedObject = {
2165
- id: string;
2166
- name: string;
2167
- version: string;
2168
- };
2169
- export type RichTextCompressedColor = string | GradientObject | null;
2170
- export type RichTextCompressedStyles = RichTextCompressedStylesV1 | RichTextCompressedStylesV2;
2171
- export type RichTextDecorationPluginSerializedObject = RichTextBasePluginSerializedObject & {
2172
- fillStyle: string;
2173
- [key: string]: string | number;
2174
- };
2175
- export type RichTextHyperlinkSerializedObject = {
2176
- id: string;
2177
- url: string;
2178
- };
2179
- export type RichTextRenderPluginSerializedObject = RichTextBasePluginSerializedObject & {
2180
- color: string;
2181
- angle: number;
2182
- offset: number;
2183
- [key: string]: string | number;
2184
- };
2185
- export type RichTextResizeBehavior = "hug" | "none" | "hug-height" | "fixed-box-fit";
2186
- export type RichTextSerializedCharacterStyle = Partial<{
2187
- fontFamily: string;
2188
- fontWeight: FontWeight;
2189
- fontSize: number;
2190
- fill: RichTextCompressedColor;
2191
- underline: boolean;
2192
- linethrough: boolean;
2193
- charSpacing: number;
2194
- textCase: TextCase;
2195
- lineHeightValue: LineHeight;
2196
- hyperlinkId: string | null;
2197
- preLinkFill: RichTextCompressedColor;
2198
- fontVariationSettings: FontVariationSettings;
2199
- fontFeatureSettings: Record<string, boolean | number>;
2200
- }>;
2201
- export type RichTextSerializedObject = typeof RICH_TEXT_DEFAULT_VALUES & {
2202
- text: string;
2203
- fontFamily: string;
2204
- styles?: RichTextCompressedStyles;
2205
- activeRenderPlugins?: RichTextRenderPluginSerializedObject[];
2206
- activeDecorationPlugins?: RichTextDecorationPluginSerializedObject[];
2207
- activeTransformPlugin?: RichTextSerializedTransformPluginObject;
2208
- fontSize?: number;
2209
- fontWeight?: FontWeight;
2210
- textAlign?: TextAlign;
2211
- charSpacing?: number;
2212
- underline?: boolean;
2213
- linethrough?: boolean;
2214
- fontVariationSettings?: FontVariationSettings;
2215
- textCase?: TextCase;
2216
- lineHeightValue?: LineHeight;
2217
- untransformedWidth?: number;
2218
- widthBeforeTransform?: number;
2219
- resizeBehavior?: RichTextResizeBehavior;
2220
- hyperlinkId?: string;
2221
- preLinkFill?: string | GradientObject | null;
2222
- fontFeatureSettings?: Record<string, boolean | number>;
2223
- links?: RichTextHyperlinkSerializedObject[];
2224
- volatileData?: {
2225
- top: number;
2226
- left: number;
2227
- width: number;
2228
- height: number;
2229
- activeTransformPlugin: RichTextSerializedTransformPluginObject;
2230
- key: string;
2231
- };
2232
- };
2233
- export type RichTextSerializedTransformPluginObject = RichTextBasePluginSerializedObject & {
2234
- type?: string;
2235
- points: {
2236
- x: number;
2237
- y: number;
2238
- }[];
2239
- curveHeight?: number;
2240
- directionInverted?: boolean;
2241
- };
2242
- export type SDKColor = string | SDKGradient;
2243
- export type SDKColorEntry = {
2244
- key: string;
2245
- color: SDKColor | null;
2246
- };
2247
- export type SDKColorStop = {
2248
- offset: number;
2249
- color: string | null;
2250
- };
2251
- export type SDKGradient = SDKLinearGradient | SDKRadialGradient;
2252
- export type SDKLinearGradient = {
2253
- type: GradientType.Linear;
2254
- colorStops: SDKColorStop[];
2255
- angle: number;
2256
- coords: SDKLinearGradientCoords;
2257
- };
2258
- export type SDKLinearGradientCoords = {
2259
- x1: number;
2260
- y1: number;
2261
- x2: number;
2262
- y2: number;
2263
- };
2264
- export type SDKRadialGradient = {
2265
- type: GradientType.Radial;
2266
- colorStops: SDKColorStop[];
2267
- angle: number;
2268
- coords: SDKRadialGradientCoords;
2269
- };
2270
- export type SDKRadialGradientCoords = SDKLinearGradientCoords & {
2271
- r2: number;
2272
- };
2273
- export type ScreenCoordinates = {
2274
- x: number;
2275
- y: number;
2276
- };
275
+ /**
276
+ * Unified SDK error type that encompasses all possible SDK errors.
277
+ * Use the `name` property to discriminate between error types.
278
+ *
279
+ * @public
280
+ */
2277
281
  export type SdkError = SdkBadInputError | SdkInternalError;
2278
282
  export type SdkResponse<T> = {
2279
283
  isOk: true;
@@ -2282,6 +286,28 @@ export type SdkResponse<T> = {
2282
286
  isOk: false;
2283
287
  error: Error;
2284
288
  };
289
+ /**
290
+ * A result type that represents the result of a synchronous operation.
291
+ *
292
+ * This is the standard return type for sync SDK methods that can fail.
293
+ * It provides a type-safe way to handle both success and error cases without throwing.
294
+ *
295
+ * @typeParam T - The success value type
296
+ * @typeParam E - The error type
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * const result = someApi.syncOperation({ ... });
301
+ *
302
+ * if (result.isOk) {
303
+ * console.log('Success:', result.result);
304
+ * } else {
305
+ * console.error('Failed:', result.error.message);
306
+ * }
307
+ * ```
308
+ *
309
+ * @public
310
+ */
2285
311
  export type SdkResult<T, E = SdkError> = {
2286
312
  isOk: true;
2287
313
  result: T;
@@ -2291,459 +317,12 @@ export type SdkResult<T, E = SdkError> = {
2291
317
  result?: never;
2292
318
  error: E;
2293
319
  };
2294
- export type SdkResultAsync<T, E = SdkError> = Promise<{
2295
- isOk: true;
2296
- result: T;
2297
- error?: never;
2298
- } | {
2299
- isOk: false;
2300
- result?: never;
2301
- error: E;
2302
- }>;
2303
- export type SelectionOption = {
2304
- value: string;
2305
- label: string;
2306
- disabled?: true;
2307
- isPremium?: true;
2308
- };
2309
- export type Selector<T, U = unknown> = (state: T) => U;
2310
- export type SelectorState = Omit<NormalizedDesignState, "objects"> & {
2311
- objects: Record<string, FlattenUnion<NormalizedObject>>;
2312
- };
2313
- export type SendToParams = {
2314
- boardOrObjectIds: string[];
2315
- };
2316
- export type SequenceLength = number;
2317
- export type SerialisedPhotoFilter = ({
2318
- type: ImageFilterType;
2319
- } & PhotoFilterOptions[ImageFilterType]) | {
2320
- type: ImageFilterType;
2321
- };
2322
- export type SerializableCornerRadii = Record<string, Record<string, number>>;
2323
- export type SerializableObjectType = ObjectType.IllustrationImage | ObjectType.Illustration | ObjectType.Artboard | ObjectType.Smartboard | ObjectType.Videoboard | ObjectType.MockupBoard | ObjectType.PathText | ObjectType.RichText | ObjectType.MockupDesign | ObjectType.OverlayTexture | ObjectType.Mask | ObjectType.BasicShape | ObjectType.VectorPath | ObjectType.Guide | ObjectType.CombinedShape | ObjectType.LoadingCard | ObjectType.Video;
2324
- export type SerializedObject = StandardSerializedObject | GuideSerializedObject;
2325
- export type SetCanvasModeWithTargetOptions = {
2326
- origin?: Origin;
2327
- targetId?: string | null;
2328
- };
2329
- export type SetColorsParams = {
2330
- objectId: string;
2331
- colorEntries: SDKColorEntry[];
2332
- };
2333
- export type SetCustomCanvasModeParams<Id extends string> = {
2334
- id: CustomCanvasModeId<Id>;
2335
- state: CustomCanvasModeState<Id>;
2336
- };
2337
- export type SetTextureParams = {
2338
- boardId: string;
2339
- texture: string;
2340
- options?: Partial<TextureOptions>;
2341
- };
2342
- export type SetVideoOnVideoboardParams = {
2343
- videoBoardId: string;
2344
- video: {
2345
- width?: number;
2346
- height?: number;
2347
- playlist: VideoPlaylistItemInput[];
2348
- };
2349
- } & Pick<VideoboardOptions, "generationSettings">;
2350
- export type SettingsType = {
2351
- gridSize: number;
2352
- showGrid: boolean;
2353
- showRuler: boolean;
2354
- showPrintMargins: boolean;
2355
- enableGuideRedraw: boolean;
2356
- };
2357
- export type ShadingOptions = AvailableShadowOptions & {
2358
- type: "drop" | "line" | "block" | "detail";
2359
- outlineWidth?: number;
2360
- borderColor?: string | null;
2361
- };
2362
- export type Shape = {
2363
- groupId?: string;
2364
- } & (BasicShapeSerializedObject | CombinedShapeSerializedObject | IllustrationSerializedObject | PathTextSerializedObject | RichTextSerializedObject);
2365
- export type ShapeBooleanOperation = "unite" | "subtract" | "intersect" | "exclude" | "divide";
2366
- export type ShapeProperties = {
2367
- angle?: BasicShapeSerializedObject["angle"];
2368
- flipX?: BasicShapeSerializedObject["flipX"];
2369
- flipY?: BasicShapeSerializedObject["flipY"];
2370
- hidden?: BasicShapeSerializedObject["hidden"];
2371
- opacity?: BasicShapeSerializedObject["opacity"];
2372
- skewX?: BasicShapeSerializedObject["skewX"];
2373
- skewY?: BasicShapeSerializedObject["skewY"];
2374
- cornerRadii?: BasicShapeSerializedObject["cornerRadii"];
2375
- name?: BasicShapeSerializedObject["name"];
2376
- shadowOptions?: BasicShapeSerializedObject["shadowOptions"];
2377
- fill?: NonNullable<BasicShapeSerializedObject["fill"]>;
2378
- fillColor?: NonNullable<BasicShapeSerializedObject["fill"]>[number]["value"];
2379
- stroke?: NonNullable<BasicShapeSerializedObject["stroke"]>;
2380
- strokeWidth?: NonNullable<BasicShapeSerializedObject["strokeWidth"]>;
2381
- };
2382
- export type SmartPlacementInput = {
2383
- objects: BoundingBox[];
2384
- padding?: number;
2385
- applyViewportScale?: boolean;
2386
- ignoredIds?: string[];
2387
- targetBoardId?: string;
2388
- };
2389
- export type SmartPlacementOutput = {
2390
- insertionBoundingBox: BoundingBox;
2391
- objectPlacements: BoundingBox[];
2392
- };
2393
- export type SmartboardAction = SmartboardActionWithAiPrompt | SmartboardActionInitial;
2394
- export type SmartboardActionInitial = {
2395
- type: "noAction";
2396
- aspectRatio?: SmartboardAspectRatio;
2397
- modelId?: string;
2398
- };
2399
- export type SmartboardActionWithAiPrompt = {
2400
- type: "aiPrompt";
2401
- prompt: string;
2402
- quality?: SmartboardQuality;
2403
- aspectRatio?: SmartboardAspectRatio;
2404
- transparentBackground?: boolean;
2405
- background?: SmartboardBackground;
2406
- modelId?: string;
2407
- averageSpeed?: number;
2408
- generatedContent?: SmartboardGeneratedContent;
2409
- };
2410
- export type SmartboardAspectRatio = string;
2411
- export type SmartboardBackground = "transparent" | "opaque";
2412
- export type SmartboardGeneratedContent = {
2413
- id: string;
2414
- status: "STARTED" | "COMPLETE" | "FAILED";
2415
- objectName?: string;
2416
- startedAt?: number;
2417
- };
2418
- export type SmartboardGenerationSettings = Record<string, unknown>;
2419
- export type SmartboardOptions = ConnectedArtboardOptions<ObjectType.Smartboard> & {
2420
- action?: SmartboardAction;
2421
- } & GeneratableBoard<SmartboardGenerationSettings>;
2422
- export type SmartboardQuality = "auto" | "high" | "medium" | "low";
2423
- export type StandardSerializedObject = BasicShapeSerializedObject | CombinedShapeSerializedObject | IllustrationImageSerializedObject | IllustrationSerializedObject | LoadingCardSerializedObject | MaskSerializedObject | MockupDesignSerializedObject | PathTextSerializedObject | RichTextSerializedObject | VideoSerializedObject;
2424
- export type StartedGenerationResult = VideoGenerationStartedResult | ImageGenerationStartedResult;
2425
- export type StateGradientInfo = {
2426
- [key: string]: GradientInfo;
2427
- };
2428
- export type StringColor = {
2429
- key: StringColorKeysType;
2430
- value: string | null | undefined;
2431
- visible: boolean;
2432
- };
2433
- export type StringColorKeysType = (typeof stringColorKeys)[number];
2434
- export type StructureObjectId = string;
2435
- export type SubscribeOptions = {
2436
- skipDedupe?: boolean;
2437
- };
2438
- export type SuccessGenerationResult = VideoGenerationResult | ImageGenerationResult;
2439
- export type TempUserImageUpload = {
2440
- objectId: string;
2441
- mimeType: string;
2442
- };
2443
- export type TextAlign = "left" | "center" | "right" | "justify" | "justify-left" | "justify-center" | "justify-right" | "justify-legacy";
2444
- export type TextCase = "none" | "uppercase";
2445
- export type TextProperties = {
2446
- fontFamily?: string;
2447
- fontSize?: number;
2448
- fontWeight?: string;
2449
- fontVariationSettings?: FontVariationSettings;
2450
- fill?: Color;
2451
- textAlign?: TextAlign;
2452
- lineHeightValue?: LineHeight;
2453
- resizeBehavior?: RichTextResizeBehavior;
2454
- charSpacing?: number;
2455
- underline?: boolean;
2456
- overline?: boolean;
2457
- linethrough?: boolean;
2458
- angle?: number;
2459
- scaleX?: number;
2460
- scaleY?: number;
2461
- stroke?: string | null;
2462
- strokeWidth?: number;
2463
- };
2464
- export type ToggleHideIllustrationPathParams = {
2465
- illustrationId: string;
2466
- pathId: string;
2467
- hidden: boolean;
2468
- };
2469
- export type ToggleLockIllustrationPathParams = {
2470
- illustrationId: string;
2471
- pathId: string;
2472
- locked: boolean;
2473
- };
2474
- export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
2475
- export type UpdateArtboardBackgroundParams = {
2476
- id: string;
2477
- objectName: string;
2478
- };
2479
- export type UpdateArtboardParams = {
2480
- id: string;
2481
- artboard?: Partial<ArtboardOptions>;
2482
- title?: string;
2483
- texture?: TextureOptions;
2484
- backgroundImage?: BackgroundImageOptions;
2485
- };
2486
- export type UpdateDecorationPluginParams = {
2487
- textId: string;
2488
- decorationPluginId: string;
2489
- decorationPlugin: Partial<Omit<RichTextDecorationPluginSerializedObject, "id">>;
2490
- };
2491
- export type UpdateIllustrationParams = {
2492
- id: string;
2493
- left?: number;
2494
- top?: number;
2495
- width?: number;
2496
- height?: number;
2497
- objectName?: string;
2498
- shadowOptions?: IllustrationSerializedObject["shadowOptions"];
2499
- shadowColor?: NonNullable<IllustrationSerializedObject["shadowOptions"]>["color"];
2500
- stroke?: IllustrationSerializedObject["stroke"];
2501
- strokeWidth?: IllustrationSerializedObject["strokeWidth"];
2502
- fill?: IllustrationSerializedObject["fill"];
2503
- };
2504
- export type UpdateImageParams = {
2505
- id: IllustrationImageSerializedObject["id"];
2506
- left?: IllustrationImageSerializedObject["left"];
2507
- top?: IllustrationImageSerializedObject["top"];
2508
- width?: IllustrationImageSerializedObject["width"];
2509
- height?: IllustrationImageSerializedObject["height"];
2510
- objectName?: IllustrationImageSerializedObject["objectName"];
2511
- backgroundRemoved?: IllustrationImageSerializedObject["backgroundRemoved"];
2512
- objectNameWithBackground?: IllustrationImageSerializedObject["objectNameWithBackground"];
2513
- shadowOptions?: IllustrationImageSerializedObject["shadowOptions"];
2514
- shadowColor?: NonNullable<IllustrationImageSerializedObject["shadowOptions"]>["color"];
2515
- stroke?: IllustrationImageSerializedObject["stroke"];
2516
- strokeWidth?: IllustrationImageSerializedObject["strokeWidth"];
2517
- inpaintingStrokeWidth?: IllustrationImageSerializedObject["inpaintingStrokeWidth"];
2518
- inpaintingSelectionMode?: IllustrationImageSerializedObject["inpaintingSelectionMode"];
2519
- } & GeneratableObject;
2520
- export type UpdateImageSourceParams = {
2521
- id: IllustrationImageSerializedObject["id"];
2522
- objectName: IllustrationImageSerializedObject["objectName"];
2523
- keepObjectDimensions?: boolean;
2524
- resizeMode?: "preserve-rendered-bounds" | "preserve-min-dimension";
2525
- flatten?: boolean;
2526
- };
2527
- export type UpdateMockupBoardParams = {
2528
- mockupBoardId: string;
2529
- size?: Dimensions;
2530
- mockupTemplateId?: number;
2531
- fill?: string;
2532
- shouldMockupColorMatchArtboard?: boolean;
2533
- };
2534
- export type UpdateObjectApiOptions = (Exclude<DesignApiOptions, undefined> & BoardRelinkOptions) | undefined;
2535
- export type UpdatePlaylistItemParams = {
2536
- videoBoardId: string;
2537
- playlistItemId: string;
2538
- playlistItem: Partial<Omit<VideoPlaylistItemInput, "id">>;
2539
- };
2540
- export type UpdateRenderPluginParams = {
2541
- textId: string;
2542
- renderPluginId: string;
2543
- renderPlugin: Partial<Omit<RichTextRenderPluginSerializedObject, "id">>;
2544
- };
2545
- export type UpdateShapeInput = Partial<CreateElementWithPositionAndSize> & BasicShapeConfigurableFields & {
2546
- id: NormalizedBasicShapeObject["id"];
2547
- };
2548
- export type UpdateSmartboardBackgroundImageParams = {
2549
- smartboardId: string;
2550
- } & Partial<Pick<BackgroundImageOptions, "objectName" | "generation" | "opacity" | "filters" | "globalCompositeOperation" | "hidden">>;
2551
- export type UpdateSmartboardParams = {
2552
- smartboardId: string;
2553
- size?: Dimensions;
2554
- backgroundImage?: Partial<BackgroundImageOptions>;
2555
- } & Pick<SmartboardOptions, "generationSettings">;
2556
- export type UpdateTextParams = {
2557
- textId: string;
2558
- text?: string;
2559
- left?: number;
2560
- top?: number;
2561
- angle?: number;
2562
- } & Partial<TextProperties>;
2563
- export type UpdateTextureParams = {
2564
- boardId: string;
2565
- options: Partial<TextureOptions>;
2566
- };
2567
- export type UpdateVideoParams = {
2568
- videoId: string;
2569
- position?: AbsolutePosition | RelativePosition;
2570
- size?: Dimensions;
2571
- shadowOptions?: VideoSerializedObject["shadowOptions"];
2572
- shadowColor?: NonNullable<VideoSerializedObject["shadowOptions"]>["color"];
2573
- stroke?: VideoSerializedObject["stroke"];
2574
- strokeWidth?: VideoSerializedObject["strokeWidth"];
2575
- };
2576
- export type UpdateVideoPlaylistItemParams = {
2577
- videoId: string;
2578
- playlistItemId: string;
2579
- playlistItem: Partial<Omit<VideoPlaylistItemInput, "id">>;
2580
- };
2581
- export type UpdateVideoboardParams = {
2582
- videoBoardId: string;
2583
- size?: Dimensions;
2584
- } & Pick<VideoboardOptions, "generationSettings">;
2585
320
  export type UploadType = (typeof UploadType)[keyof typeof UploadType];
2586
- export type UploadedFontFamily = {
2587
- id: string;
2588
- name: string;
2589
- fonts: UploadedFontStyle[];
2590
- workspaceId?: string;
2591
- preview?: string;
2592
- extension?: {
2593
- id: string;
2594
- name?: string;
2595
- };
2596
- };
2597
- export type UploadedFontStyle = {
2598
- name: string;
2599
- id: string;
2600
- style: string | null;
2601
- objectName: string;
2602
- };
2603
- export type UserImageUpload = {
2604
- id: string;
2605
- objectName: string;
2606
- mimeType: string;
2607
- };
2608
- export type VideoBoardGenerationSettings = Record<string, unknown>;
2609
- export type VideoPlaylistItem = {
2610
- id: string;
2611
- objectName?: string;
2612
- startOffset?: number;
2613
- endOffset?: number;
2614
- playbackRate: number;
2615
- volume: number;
2616
- meta?: GeneratableObject & {
2617
- generation?: {
2618
- isGenerating?: boolean;
2619
- };
2620
- };
2621
- };
2622
- export type VideoPlaylistItemInput = Omit<VideoPlaylistItem, "id" | "playbackRate" | "volume"> & {
2623
- playbackRate?: number;
2624
- volume?: number;
2625
- };
2626
- export type VideoSerializedObject = typeof DEFAULT_VALUES$2 & {
2627
- playlist: VideoPlaylistItem[];
2628
- realWidth?: number;
2629
- realHeight?: number;
2630
- };
2631
- export type VideoboardOptions = ConnectedArtboardOptions<ObjectType.Videoboard> & {
2632
- video?: {
2633
- width: number;
2634
- height: number;
2635
- playlist: VideoPlaylistItem[];
2636
- };
2637
- } & GeneratableBoard<VideoBoardGenerationSettings>;
2638
- export type Viewport = {
2639
- coords: {
2640
- tl: {
2641
- x: number;
2642
- y: number;
2643
- };
2644
- tr: {
2645
- x: number;
2646
- y: number;
2647
- };
2648
- bl: {
2649
- x: number;
2650
- y: number;
2651
- };
2652
- br: {
2653
- x: number;
2654
- y: number;
2655
- };
2656
- };
2657
- transform: [
2658
- number,
2659
- number,
2660
- number,
2661
- number,
2662
- number,
2663
- number
2664
- ];
2665
- };
2666
- export type ViewportAPI = {
2667
- get(): Viewport;
2668
- set(patch: ViewportPatch, origin?: Origin): void;
2669
- getTransform(): Viewport["transform"];
2670
- setTransform(transform: Viewport["transform"], origin?: Origin): void;
2671
- getPixelSize(): {
2672
- width: number;
2673
- height: number;
2674
- };
2675
- getZoom(): number;
2676
- setZoom(zoom: number, origin?: Origin): void;
2677
- zoomToPoint(screenPoint: {
2678
- x: number;
2679
- y: number;
2680
- }, zoom: number, origin?: Origin): void;
2681
- getCoords(): Viewport["coords"];
2682
- setCoords(coords: Viewport["coords"], origin?: Origin): void;
2683
- getPosition(): {
2684
- x: number;
2685
- y: number;
2686
- };
2687
- setPosition(position: {
2688
- x: number;
2689
- y: number;
2690
- }, origin?: Origin): void;
2691
- centerOnBounds(bounds: BoundingRect, origin?: Origin): void;
2692
- panTo(position: {
2693
- x: number;
2694
- y: number;
2695
- }, origin?: Origin): void;
2696
- animateTo(params: AnimateViewportParams, origin?: Origin): Promise<ViewportAnimationResult>;
2697
- animateToBounds(params: AnimateViewportToBoundsParams, origin?: Origin): Promise<ViewportAnimationResult>;
2698
- centerToBounds(params: AnimateViewportToCenterParams, origin?: Origin): Promise<ViewportAnimationResult>;
2699
- expandToBounds(params: AnimateViewportToBoundsParams, origin?: Origin): Promise<ViewportAnimationResult>;
2700
- };
2701
- export type ViewportAnimationResult = {
2702
- status: "completed";
2703
- } | {
2704
- status: "interrupted";
2705
- reason: "superseded" | "viewport-updated" | "destroyed";
2706
- };
2707
- export type ViewportAnimationSettings = {
2708
- duration?: number;
2709
- ease?: ViewportEasing;
2710
- };
2711
- export type ViewportBoundsPadding = number | {
2712
- left?: number;
2713
- right?: number;
2714
- top?: number;
2715
- bottom?: number;
2716
- };
2717
- export type ViewportEasing = EasingName | CubicBezierEasing;
2718
- export type ViewportPatch = {
2719
- transform: Viewport["transform"];
2720
- zoom?: never;
2721
- position?: never;
2722
- } | {
2723
- zoom: number;
2724
- position?: {
2725
- x: number;
2726
- y: number;
2727
- };
2728
- transform?: never;
2729
- } | {
2730
- position: {
2731
- x: number;
2732
- y: number;
2733
- };
2734
- zoom?: never;
2735
- transform?: never;
2736
- };
2737
- export type WithAsync<T> = {
2738
- [K in keyof T]: T[K] extends (...args: infer Args) => infer Return ? Return extends Promise<infer U> ? (...args: Args) => Promise<BridgedSdkResult<U>> : (...args: Args) => Promise<BridgedSdkResult<Return>> : T[K] extends object ? T[K] extends FunctionType | Array<unknown> ? T[K] : WithAsync<T[K]> : T[K];
2739
- };
2740
- export type WithOptsRemoved<T> = {
2741
- [K in keyof T]: T[K] extends (...args: infer Args) => infer Return ? Args extends [
2742
- infer First,
2743
- ...unknown[]
2744
- ] ? (arg: First) => Return : T[K] : T[K] extends object ? WithOptsRemoved<T[K]> : T[K];
2745
- };
2746
- type SharedFileBrowserKittlSDK = KittlSDKLifecycle & Pick<KittlSDKEditorAPIs, "auth" | "context"> & KittlSDKFileBrowserAPI;
321
+ /** Public SDK shape for shared file browser extensions, which run hidden. */
322
+ type SharedFileBrowserKittlSDK = KittlSDKLifecycle & KittlSDKSharedAPIs & {
323
+ /** Tab registration only: hidden file browsers get no host context. */
324
+ context: UploadBrowserRegistrationAPI;
325
+ } & KittlSDKFileBrowserAPI;
2747
326
 
2748
327
  export {
2749
328
  SharedFileBrowserKittlSDK as KittlSDK,