@canva/design 2.8.1-alpha.0 → 2.8.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/alpha.d.ts +449 -307
- package/lib/cjs/api/design/types/design_interaction/document/alpha.js +11 -0
- package/lib/cjs/sdk/design/alpha.js +12 -0
- package/lib/cjs/sdk/design/fake/fake_design_interaction_client.js +14 -0
- package/lib/cjs/sdk/design/version.js +1 -1
- package/lib/esm/api/design/types/design_interaction/document/alpha.js +1 -0
- package/lib/esm/sdk/design/alpha.js +3 -0
- package/lib/esm/sdk/design/fake/fake_design_interaction_client.js +14 -0
- package/lib/esm/sdk/design/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 2.8.1-alpha.1 - 2026-04-22
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- openDesign (Early-Preview): Added `helpers.timingFor(elementRef)` for element-bound timing access.
|
|
8
|
+
- Introducing a new preview API method `applyTemplate` to apply a template to the current design.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fixed `ResetToDefault` import failing at runtime in the built package due to a path restructuring issue in the build.
|
|
13
|
+
- Exported missing `Patch` type — previously referenced in `TimingAccessor.set()` but not importable from the package.
|
|
14
|
+
|
|
3
15
|
## 2.8.1-alpha.0 - 2026-04-01
|
|
4
16
|
|
|
5
17
|
### Added
|
|
6
18
|
|
|
7
19
|
- Initial npm release of the `@canva/design` Early Preview package.
|
|
8
|
-
|
package/alpha.d.ts
CHANGED
|
@@ -890,6 +890,55 @@ export declare type AppElementRendererOutputV2 = AppElementRendererOutput;
|
|
|
890
890
|
*/
|
|
891
891
|
export declare type AppElementRendererV2<A extends AppElementData> = (appElementData: A) => AppElementRendererOutputV2;
|
|
892
892
|
|
|
893
|
+
/**
|
|
894
|
+
* @alpha
|
|
895
|
+
* Apply a template to the current design given a template id.
|
|
896
|
+
*
|
|
897
|
+
* @example Apply a template to the current design
|
|
898
|
+
* ```typescript
|
|
899
|
+
* import {
|
|
900
|
+
* applyTemplate,
|
|
901
|
+
* requestBrandTemplates,
|
|
902
|
+
* type BrandTemplateId,
|
|
903
|
+
* } from "@canva/design";
|
|
904
|
+
*
|
|
905
|
+
* const selection = await requestBrandTemplates();
|
|
906
|
+
* if (selection.status === "aborted") return;
|
|
907
|
+
*
|
|
908
|
+
* const templateId = selection.brandTemplates[0]?.token as BrandTemplateId | undefined;
|
|
909
|
+
* if (!templateId) return;
|
|
910
|
+
*
|
|
911
|
+
* const result = await applyTemplate({
|
|
912
|
+
* template: { id: templateId },
|
|
913
|
+
* mode: "overwrite",
|
|
914
|
+
* });
|
|
915
|
+
*
|
|
916
|
+
* if (result.status === "completed") {
|
|
917
|
+
* // Template was successfully applied
|
|
918
|
+
* }
|
|
919
|
+
* ```
|
|
920
|
+
*/
|
|
921
|
+
export declare const applyTemplate: (options: ApplyTemplateOptions) => Promise<ApplyTemplateResult>;
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* @alpha
|
|
925
|
+
* Options for applying a template to a design.
|
|
926
|
+
*/
|
|
927
|
+
export declare type ApplyTemplateOptions = {
|
|
928
|
+
template: {
|
|
929
|
+
id: BrandTemplateId;
|
|
930
|
+
};
|
|
931
|
+
mode: 'overwrite';
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* @alpha
|
|
936
|
+
* Response object from the ApplyTemplate operation.
|
|
937
|
+
*/
|
|
938
|
+
export declare type ApplyTemplateResult = {
|
|
939
|
+
status: 'completed' | 'aborted';
|
|
940
|
+
};
|
|
941
|
+
|
|
893
942
|
/**
|
|
894
943
|
* @public
|
|
895
944
|
* A unique identifier that references an app runtime process
|
|
@@ -1399,6 +1448,14 @@ export declare type Coordinates = {
|
|
|
1399
1448
|
*/
|
|
1400
1449
|
export declare const createRichtextRange: () => RichtextRange;
|
|
1401
1450
|
|
|
1451
|
+
/**
|
|
1452
|
+
* @alpha
|
|
1453
|
+
* Session for the `openDesign` callback (current page) when `helpers` is {@link PageHelpersWithTiming}.
|
|
1454
|
+
*/
|
|
1455
|
+
export declare type CurrentPageSessionWithTiming<Page extends DesignEditing.Page = DesignEditing.Page> = Omit<DesignEditing.CurrentPageSession<Page, DesignEditing.PageHelpers>, 'helpers'> & {
|
|
1456
|
+
helpers: PageHelpersWithTiming;
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1402
1459
|
/**
|
|
1403
1460
|
* @beta
|
|
1404
1461
|
* Metadata for a data field in a brand template.
|
|
@@ -3228,6 +3285,12 @@ export declare type DesignOpenCallback = (session: DesignEditing.CurrentPageSess
|
|
|
3228
3285
|
*/
|
|
3229
3286
|
export declare type DesignOpenCurrentPageCallback = (session: DesignEditing.CurrentPageSession) => Promise<void>;
|
|
3230
3287
|
|
|
3288
|
+
/**
|
|
3289
|
+
* @alpha
|
|
3290
|
+
* Callback for `openDesign` when the session exposes {@link PageHelpersWithTiming}.
|
|
3291
|
+
*/
|
|
3292
|
+
declare type DesignOpenCurrentPageCallbackWithTiming = (session: CurrentPageSessionWithTiming<DesignEditing.Page>) => Promise<void>;
|
|
3293
|
+
|
|
3231
3294
|
/**
|
|
3232
3295
|
* @beta
|
|
3233
3296
|
* Options for configuring how the current page of the design is read.
|
|
@@ -4719,14 +4782,13 @@ declare type NumberDataTableCell = {
|
|
|
4719
4782
|
declare type ObjectPrimitive = Boolean | String;
|
|
4720
4783
|
|
|
4721
4784
|
/**
|
|
4722
|
-
* @
|
|
4723
|
-
*
|
|
4724
|
-
*
|
|
4725
|
-
*
|
|
4726
|
-
* @param
|
|
4727
|
-
* @param callback - A callback for operating on the design.
|
|
4785
|
+
* @alpha
|
|
4786
|
+
* Reads (and optionally updates) the current page of the user's design, with timing support for
|
|
4787
|
+
* video timeline elements.
|
|
4788
|
+
* @param options - Options for configuring how the current page of the design is read.
|
|
4789
|
+
* @param callback - A callback for operating on the current page of the design.
|
|
4728
4790
|
*/
|
|
4729
|
-
export declare const openDesign: (options:
|
|
4791
|
+
export declare const openDesign: (options: DesignOpenCurrentPageOptions, callback: DesignOpenCurrentPageCallbackWithTiming) => Promise<void>;
|
|
4730
4792
|
|
|
4731
4793
|
/**
|
|
4732
4794
|
* @public
|
|
@@ -4819,6 +4881,22 @@ export declare type PageDimensions = {
|
|
|
4819
4881
|
height: number;
|
|
4820
4882
|
};
|
|
4821
4883
|
|
|
4884
|
+
/**
|
|
4885
|
+
* @alpha
|
|
4886
|
+
* {@link DesignEditing.PageHelpers} plus {@link PageHelpersWithTiming.timingFor | timingFor} for **video / fixed pages** with a timeline.
|
|
4887
|
+
*
|
|
4888
|
+
* @preventInline
|
|
4889
|
+
*/
|
|
4890
|
+
export declare type PageHelpersWithTiming = DesignEditing.PageHelpers & {
|
|
4891
|
+
/**
|
|
4892
|
+
* Timing API for one element on the current page.
|
|
4893
|
+
*
|
|
4894
|
+
* @param elementRef - Must belong to the current page.
|
|
4895
|
+
* @returns A {@link TimingAccessor} for the element.
|
|
4896
|
+
*/
|
|
4897
|
+
timingFor(elementRef: DesignEditing.AbsoluteElement): TimingAccessor;
|
|
4898
|
+
};
|
|
4899
|
+
|
|
4822
4900
|
/**
|
|
4823
4901
|
* @beta
|
|
4824
4902
|
* Information about a page within a design.
|
|
@@ -4841,6 +4919,18 @@ declare type PageMetadata_2 = {
|
|
|
4841
4919
|
dimensions?: PageDimensions;
|
|
4842
4920
|
};
|
|
4843
4921
|
|
|
4922
|
+
/**
|
|
4923
|
+
* @alpha
|
|
4924
|
+
* Partial update shape: only listed properties are applied; others stay as they are.
|
|
4925
|
+
*
|
|
4926
|
+
* @remarks
|
|
4927
|
+
* Each key may be the normal value, {@link ResetToDefault} to reset that property to its default, or
|
|
4928
|
+
* omitted / **`undefined`** to leave that property **unchanged**.
|
|
4929
|
+
*/
|
|
4930
|
+
export declare type Patch<T extends Record<string, unknown>> = {
|
|
4931
|
+
[K in keyof T]?: T[K] | typeof ResetToDefault;
|
|
4932
|
+
};
|
|
4933
|
+
|
|
4844
4934
|
/**
|
|
4845
4935
|
* @public
|
|
4846
4936
|
* The outline of a path.
|
|
@@ -5053,6 +5143,15 @@ export declare type RequestBrandTemplatesResponseContent = {
|
|
|
5053
5143
|
*/
|
|
5054
5144
|
export declare const requestExport: (request: ExportRequest) => Promise<ExportResponse>;
|
|
5055
5145
|
|
|
5146
|
+
/**
|
|
5147
|
+
* @alpha
|
|
5148
|
+
* Use in a {@link Patch} to mean “set this property to its default” instead of a concrete value.
|
|
5149
|
+
*
|
|
5150
|
+
* @remarks
|
|
5151
|
+
* String literals like `'default'` are avoided so they cannot clash with future string-valued fields.
|
|
5152
|
+
*/
|
|
5153
|
+
export declare const ResetToDefault: unique symbol;
|
|
5154
|
+
|
|
5056
5155
|
/**
|
|
5057
5156
|
* @public
|
|
5058
5157
|
* Provides methods for interacting with a range of formatted text.
|
|
@@ -6043,358 +6142,401 @@ export declare type TextRegion = {
|
|
|
6043
6142
|
};
|
|
6044
6143
|
|
|
6045
6144
|
/**
|
|
6046
|
-
* @
|
|
6047
|
-
*
|
|
6145
|
+
* @alpha
|
|
6146
|
+
* Start time and duration for an element on the **video timeline** (seconds).
|
|
6048
6147
|
*/
|
|
6049
|
-
export declare
|
|
6148
|
+
export declare type Timing = {
|
|
6050
6149
|
/**
|
|
6051
|
-
*
|
|
6052
|
-
* @public
|
|
6053
|
-
* Adds the specified element or content to a design at the end of a drag event.
|
|
6054
|
-
*
|
|
6055
|
-
* @param event - A drag start event.
|
|
6056
|
-
* @param dragData - Element or content to be added to the design at the end of the drag event.
|
|
6150
|
+
* Delay from the start of the page’s timeline until this element becomes visible. Minimum `0`.
|
|
6057
6151
|
*/
|
|
6058
|
-
|
|
6152
|
+
readonly delayInSeconds: number;
|
|
6059
6153
|
/**
|
|
6060
|
-
*
|
|
6061
|
-
*
|
|
6062
|
-
*
|
|
6063
|
-
* @param event - A drag start event.
|
|
6064
|
-
* @param dragData - Element or content to be added to the design at the end of the drag event.
|
|
6065
|
-
*/
|
|
6066
|
-
startDragToPoint<E extends Element>(event: DragStartEvent<E>, dragData: TextDragConfig | AudioDragConfig | EmbedDragConfig | VideoDragConfigForElement<E> | ImageDragConfigForElement<E>): Promise<void>;
|
|
6067
|
-
/**
|
|
6068
|
-
* @public
|
|
6069
|
-
* Adds the specified element or content to responsive documents, which slot things into a text stream at the end of a drag event.
|
|
6070
|
-
*
|
|
6071
|
-
* @param event - A drag start event.
|
|
6072
|
-
* @param dragData - Element or content to be added to the design at the end of the drag event.
|
|
6073
|
-
*/
|
|
6074
|
-
startDragToCursor<E extends Element>(event: DragStartEvent<E>, dragData: EmbedDragConfig | VideoDragConfigForElement<E> | ImageDragConfigForElement<E>): Promise<void>;
|
|
6075
|
-
}
|
|
6076
|
-
|
|
6077
|
-
/**
|
|
6078
|
-
* An alias for the UI interface, providing access to ui related functionality
|
|
6079
|
-
* @public
|
|
6080
|
-
*/
|
|
6081
|
-
export declare const ui: UI;
|
|
6082
|
-
|
|
6083
|
-
/**
|
|
6084
|
-
* @beta
|
|
6085
|
-
* Pages that do not have fixed or unbounded dimensions currently do not return metadata.
|
|
6086
|
-
*/
|
|
6087
|
-
declare type UnsupportedPageMetadata = {
|
|
6088
|
-
/**
|
|
6089
|
-
* The type of page.
|
|
6154
|
+
* How long the element stays visible. A **number** is a duration in seconds (Positive number).
|
|
6155
|
+
* The string **`'until_end_of_page'`** means until the **end of the current page** (default).
|
|
6090
6156
|
*/
|
|
6091
|
-
|
|
6157
|
+
readonly durationInSeconds: number | 'until_end_of_page';
|
|
6092
6158
|
};
|
|
6093
6159
|
|
|
6094
6160
|
/**
|
|
6095
|
-
* @
|
|
6096
|
-
*
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
[key: string]: Value;
|
|
6100
|
-
};
|
|
6101
|
-
|
|
6102
|
-
/**
|
|
6103
|
-
* @public
|
|
6104
|
-
* Video element or content to be added to the design at the end of a drag event.
|
|
6161
|
+
* @alpha
|
|
6162
|
+
* Read/write timing for a single element. Obtained from {@link PageHelpersWithTiming.timingFor}.
|
|
6163
|
+
*
|
|
6164
|
+
* @preventInline
|
|
6105
6165
|
*/
|
|
6106
|
-
export declare type
|
|
6107
|
-
/**
|
|
6108
|
-
* The type of element.
|
|
6109
|
-
*/
|
|
6110
|
-
type: 'video';
|
|
6111
|
-
/**
|
|
6112
|
-
* A function that returns a reference (ref) to a video asset in Canva's backend.
|
|
6113
|
-
*/
|
|
6114
|
-
resolveVideoRef: () => Promise<{
|
|
6115
|
-
ref: VideoRef;
|
|
6116
|
-
}>;
|
|
6117
|
-
/**
|
|
6118
|
-
* The dimensions of the preview image.
|
|
6119
|
-
*/
|
|
6120
|
-
previewSize: Dimensions;
|
|
6166
|
+
export declare type TimingAccessor = {
|
|
6121
6167
|
/**
|
|
6122
|
-
*
|
|
6168
|
+
* Reads the element’s current timing.
|
|
6123
6169
|
*
|
|
6124
|
-
* @
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6170
|
+
* @returns {@link Timing}
|
|
6171
|
+
*
|
|
6172
|
+
* @remarks
|
|
6173
|
+
* If set(ResetToDefault) and then get(), it will returns `{ startMs: 0, durationMs: 'until_end_of_page' }` instead
|
|
6174
|
+
*/
|
|
6175
|
+
get(): Timing;
|
|
6176
|
+
/**
|
|
6177
|
+
* Updates timing on the element, or resets it entirely.
|
|
6178
|
+
*
|
|
6179
|
+
* @param timing - Either:
|
|
6180
|
+
* - **`ResetToDefault`** alone — reset **all** timing to defaults (delay at 0, duration to end of page).
|
|
6181
|
+
* - A **patch object** — merge with current timing. Omitted keys or keys set to `undefined` are
|
|
6182
|
+
* **unchanged**. Use {@link ResetToDefault} on a key to reset that property to its default.
|
|
6183
|
+
*/
|
|
6184
|
+
set(timing: Patch<Timing> | typeof ResetToDefault): Promise<void>;
|
|
6185
|
+
};
|
|
6140
6186
|
|
|
6141
|
-
/**
|
|
6142
|
-
* @public
|
|
6143
|
-
* An element that renders video content.
|
|
6144
|
-
*/
|
|
6145
|
-
export declare type VideoElement = {
|
|
6146
6187
|
/**
|
|
6147
|
-
*
|
|
6188
|
+
* @public
|
|
6189
|
+
* Provides methods for adding drag and drop behavior to an app.
|
|
6148
6190
|
*/
|
|
6149
|
-
|
|
6191
|
+
export declare interface UI {
|
|
6192
|
+
/**
|
|
6193
|
+
* @deprecated The method has been superseded by `startDragToPoint`.
|
|
6194
|
+
* @public
|
|
6195
|
+
* Adds the specified element or content to a design at the end of a drag event.
|
|
6196
|
+
*
|
|
6197
|
+
* @param event - A drag start event.
|
|
6198
|
+
* @param dragData - Element or content to be added to the design at the end of the drag event.
|
|
6199
|
+
*/
|
|
6200
|
+
startDrag<E extends Element>(event: DragStartEvent<E>, dragData: TextDragConfig | AudioDragConfig | EmbedDragConfig | VideoDragConfigForElement<E> | ImageDragConfigForElement<E>): Promise<void>;
|
|
6201
|
+
/**
|
|
6202
|
+
* @public
|
|
6203
|
+
* Adds the specified element or content to fixed designs, which use a coordinate-based positioning system at the end of a drag event.
|
|
6204
|
+
*
|
|
6205
|
+
* @param event - A drag start event.
|
|
6206
|
+
* @param dragData - Element or content to be added to the design at the end of the drag event.
|
|
6207
|
+
*/
|
|
6208
|
+
startDragToPoint<E extends Element>(event: DragStartEvent<E>, dragData: TextDragConfig | AudioDragConfig | EmbedDragConfig | VideoDragConfigForElement<E> | ImageDragConfigForElement<E>): Promise<void>;
|
|
6209
|
+
/**
|
|
6210
|
+
* @public
|
|
6211
|
+
* Adds the specified element or content to responsive documents, which slot things into a text stream at the end of a drag event.
|
|
6212
|
+
*
|
|
6213
|
+
* @param event - A drag start event.
|
|
6214
|
+
* @param dragData - Element or content to be added to the design at the end of the drag event.
|
|
6215
|
+
*/
|
|
6216
|
+
startDragToCursor<E extends Element>(event: DragStartEvent<E>, dragData: EmbedDragConfig | VideoDragConfigForElement<E> | ImageDragConfigForElement<E>): Promise<void>;
|
|
6217
|
+
}
|
|
6218
|
+
|
|
6150
6219
|
/**
|
|
6151
|
-
*
|
|
6220
|
+
* An alias for the UI interface, providing access to ui related functionality
|
|
6221
|
+
* @public
|
|
6152
6222
|
*/
|
|
6153
|
-
|
|
6223
|
+
export declare const ui: UI;
|
|
6224
|
+
|
|
6154
6225
|
/**
|
|
6155
|
-
*
|
|
6156
|
-
*
|
|
6157
|
-
* @remarks
|
|
6158
|
-
* Use `undefined` for content with no description.
|
|
6226
|
+
* @beta
|
|
6227
|
+
* Pages that do not have fixed or unbounded dimensions currently do not return metadata.
|
|
6159
6228
|
*/
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
*/
|
|
6167
|
-
export declare type VideoElementAtPoint = VideoElement & Point & (WidthAndHeight | Width | Height);
|
|
6229
|
+
declare type UnsupportedPageMetadata = {
|
|
6230
|
+
/**
|
|
6231
|
+
* The type of page.
|
|
6232
|
+
*/
|
|
6233
|
+
type: 'unsupported';
|
|
6234
|
+
};
|
|
6168
6235
|
|
|
6169
|
-
/**
|
|
6170
|
-
* @public
|
|
6171
|
-
* A video asset that fills a path's interior.
|
|
6172
|
-
*/
|
|
6173
|
-
export declare type VideoFill = {
|
|
6174
6236
|
/**
|
|
6175
|
-
*
|
|
6237
|
+
* @public
|
|
6238
|
+
* A data type that can be used in app element data.
|
|
6176
6239
|
*/
|
|
6177
|
-
type
|
|
6240
|
+
export declare type Value = Primitive | ObjectPrimitive | Exclude<Value, undefined>[] | {
|
|
6241
|
+
[key: string]: Value;
|
|
6242
|
+
};
|
|
6243
|
+
|
|
6178
6244
|
/**
|
|
6179
|
-
*
|
|
6245
|
+
* @public
|
|
6246
|
+
* Video element or content to be added to the design at the end of a drag event.
|
|
6180
6247
|
*/
|
|
6181
|
-
|
|
6248
|
+
export declare type VideoDragConfig = {
|
|
6249
|
+
/**
|
|
6250
|
+
* The type of element.
|
|
6251
|
+
*/
|
|
6252
|
+
type: 'video';
|
|
6253
|
+
/**
|
|
6254
|
+
* A function that returns a reference (ref) to a video asset in Canva's backend.
|
|
6255
|
+
*/
|
|
6256
|
+
resolveVideoRef: () => Promise<{
|
|
6257
|
+
ref: VideoRef;
|
|
6258
|
+
}>;
|
|
6259
|
+
/**
|
|
6260
|
+
* The dimensions of the preview image.
|
|
6261
|
+
*/
|
|
6262
|
+
previewSize: Dimensions;
|
|
6263
|
+
/**
|
|
6264
|
+
* The dimensions of the full-size video.
|
|
6265
|
+
*
|
|
6266
|
+
* @remarks
|
|
6267
|
+
* - These dimensions are used when adding the video to the design
|
|
6268
|
+
* - If omitted, the `previewSize` dimensions are used as a fallback.
|
|
6269
|
+
*/
|
|
6270
|
+
fullSize?: Dimensions;
|
|
6271
|
+
/**
|
|
6272
|
+
* The URL of an image to display under the user's cursor during the drag and drop event.
|
|
6273
|
+
*/
|
|
6274
|
+
previewUrl: string;
|
|
6275
|
+
};
|
|
6276
|
+
|
|
6182
6277
|
/**
|
|
6183
|
-
*
|
|
6184
|
-
*
|
|
6185
|
-
* @remarks
|
|
6186
|
-
* Use `undefined` for content with no description.
|
|
6278
|
+
* @public
|
|
6279
|
+
* Video element or content to be added to the design at the end of a drag event.
|
|
6187
6280
|
*/
|
|
6188
|
-
|
|
6189
|
-
};
|
|
6281
|
+
export declare type VideoDragConfigForElement<E extends Element> = E extends HTMLImageElement ? Partial<VideoDragConfig> & Pick<VideoDragConfig, 'type' | 'resolveVideoRef'> : VideoDragConfig;
|
|
6190
6282
|
|
|
6191
|
-
/**
|
|
6192
|
-
* @public
|
|
6193
|
-
* The MIME type of a video file that's supported by Canva's backend.
|
|
6194
|
-
*
|
|
6195
|
-
* @remarks
|
|
6196
|
-
* - GIFs are treated as videos, not images.
|
|
6197
|
-
* - `"application/json"` is only used for Lottie files.
|
|
6198
|
-
*/
|
|
6199
|
-
declare type VideoMimeType = 'video/avi' | 'video/x-msvideo' | 'image/gif' | 'video/x-m4v' | 'video/x-matroska' | 'video/quicktime' | 'video/mp4' | 'video/mpeg' | 'video/webm' | 'application/json';
|
|
6200
|
-
|
|
6201
|
-
/**
|
|
6202
|
-
* @public
|
|
6203
|
-
* A unique identifier that references a video asset in Canva's backend.
|
|
6204
|
-
*/
|
|
6205
|
-
export declare type VideoRef = string & {
|
|
6206
|
-
__videoRef: never;
|
|
6207
|
-
};
|
|
6208
|
-
|
|
6209
|
-
/**
|
|
6210
|
-
* @public
|
|
6211
|
-
* A unique identifier that points to a video asset in Canva's backend.
|
|
6212
|
-
*/
|
|
6213
|
-
declare type VideoRef_2 = string & {
|
|
6214
|
-
__videoRef: never;
|
|
6215
|
-
};
|
|
6216
|
-
|
|
6217
|
-
/**
|
|
6218
|
-
* @public
|
|
6219
|
-
* Options for uploading a video asset to the user's private media library.
|
|
6220
|
-
*/
|
|
6221
|
-
declare type VideoUploadOptions = {
|
|
6222
6283
|
/**
|
|
6223
|
-
*
|
|
6284
|
+
* @public
|
|
6285
|
+
* An element that renders video content.
|
|
6224
6286
|
*/
|
|
6225
|
-
type
|
|
6287
|
+
export declare type VideoElement = {
|
|
6288
|
+
/**
|
|
6289
|
+
* The type of element.
|
|
6290
|
+
*/
|
|
6291
|
+
type: 'video';
|
|
6292
|
+
/**
|
|
6293
|
+
* A unique identifier that points to a video asset in Canva's backend.
|
|
6294
|
+
*/
|
|
6295
|
+
ref: VideoRef;
|
|
6296
|
+
/**
|
|
6297
|
+
* A description of the video content.
|
|
6298
|
+
*
|
|
6299
|
+
* @remarks
|
|
6300
|
+
* Use `undefined` for content with no description.
|
|
6301
|
+
*/
|
|
6302
|
+
altText: AltText | undefined;
|
|
6303
|
+
};
|
|
6304
|
+
|
|
6226
6305
|
/**
|
|
6227
|
-
*
|
|
6228
|
-
*
|
|
6229
|
-
* @remarks
|
|
6230
|
-
* This name is displayed in the user's media library and helps users identify
|
|
6231
|
-
* and find the asset later. If not provided, Canva will generate a name based
|
|
6232
|
-
* on the asset's URL or a unique identifier.
|
|
6233
|
-
*
|
|
6234
|
-
* Requirements:
|
|
6235
|
-
* - Minimum length: 1 character (empty strings are not allowed)
|
|
6236
|
-
* - Maximum length: 255 characters
|
|
6306
|
+
* @public
|
|
6307
|
+
* An element that renders video content and has positional properties.
|
|
6237
6308
|
*/
|
|
6238
|
-
|
|
6309
|
+
export declare type VideoElementAtPoint = VideoElement & Point & (WidthAndHeight | Width | Height);
|
|
6310
|
+
|
|
6239
6311
|
/**
|
|
6240
|
-
*
|
|
6241
|
-
*
|
|
6242
|
-
* @remarks
|
|
6243
|
-
* For example, if an app applies an effect to a video, `parentRef` should contain the ref of the original video.
|
|
6312
|
+
* @public
|
|
6313
|
+
* A video asset that fills a path's interior.
|
|
6244
6314
|
*/
|
|
6245
|
-
|
|
6315
|
+
export declare type VideoFill = {
|
|
6316
|
+
/**
|
|
6317
|
+
* The type of fill.
|
|
6318
|
+
*/
|
|
6319
|
+
type: 'video';
|
|
6320
|
+
/**
|
|
6321
|
+
* A unique identifier that points to a video asset in Canva's backend.
|
|
6322
|
+
*/
|
|
6323
|
+
ref: VideoRef;
|
|
6324
|
+
/**
|
|
6325
|
+
* A description of the image content.
|
|
6326
|
+
*
|
|
6327
|
+
* @remarks
|
|
6328
|
+
* Use `undefined` for content with no description.
|
|
6329
|
+
*/
|
|
6330
|
+
altText?: AltText;
|
|
6331
|
+
};
|
|
6332
|
+
|
|
6246
6333
|
/**
|
|
6247
|
-
*
|
|
6334
|
+
* @public
|
|
6335
|
+
* The MIME type of a video file that's supported by Canva's backend.
|
|
6248
6336
|
*
|
|
6249
6337
|
* @remarks
|
|
6250
|
-
*
|
|
6251
|
-
*
|
|
6252
|
-
* - Must use HTTPS
|
|
6253
|
-
* - Must return a `200` status code
|
|
6254
|
-
* - `Content-Type` must match the file's MIME type
|
|
6255
|
-
* - Must be publicly accessible (i.e. not a localhost URL)
|
|
6256
|
-
* - Must not redirect
|
|
6257
|
-
* - Must not contain an IP address
|
|
6258
|
-
* - Maximum length: 4096 characters
|
|
6259
|
-
* - Must not contain whitespace
|
|
6260
|
-
* - Must not contain these characters: `>`, `<`, `{`, `}`, `^`, backticks
|
|
6261
|
-
* - Maximum file size: 1000MB (1GB)
|
|
6262
|
-
*/
|
|
6263
|
-
url: string;
|
|
6264
|
-
/**
|
|
6265
|
-
* The MIME type of the video file.
|
|
6338
|
+
* - GIFs are treated as videos, not images.
|
|
6339
|
+
* - `"application/json"` is only used for Lottie files.
|
|
6266
6340
|
*/
|
|
6267
|
-
|
|
6341
|
+
declare type VideoMimeType = 'video/avi' | 'video/x-msvideo' | 'image/gif' | 'video/x-m4v' | 'video/x-matroska' | 'video/quicktime' | 'video/mp4' | 'video/mpeg' | 'video/webm' | 'application/json';
|
|
6342
|
+
|
|
6268
6343
|
/**
|
|
6269
|
-
*
|
|
6270
|
-
*
|
|
6271
|
-
* @remarks
|
|
6272
|
-
* Requirements:
|
|
6273
|
-
*
|
|
6274
|
-
* - Must use HTTPS
|
|
6275
|
-
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
6276
|
-
* - Maximum length: 4096 characters
|
|
6277
|
-
* - The dimensions of the thumbnail video must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
|
|
6278
|
-
* - Must not be an AVI file. Although our APIs support uploading AVI videos, Canva can't preview them because of native support of browsers
|
|
6344
|
+
* @public
|
|
6345
|
+
* A unique identifier that references a video asset in Canva's backend.
|
|
6279
6346
|
*/
|
|
6280
|
-
|
|
6347
|
+
export declare type VideoRef = string & {
|
|
6348
|
+
__videoRef: never;
|
|
6349
|
+
};
|
|
6350
|
+
|
|
6281
6351
|
/**
|
|
6282
|
-
*
|
|
6283
|
-
*
|
|
6284
|
-
*
|
|
6285
|
-
* @remarks
|
|
6286
|
-
* Requirements for external URLs:
|
|
6287
|
-
*
|
|
6288
|
-
* - Must use HTTPS
|
|
6289
|
-
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
6290
|
-
* - Must be a PNG, JPEG, or SVG file
|
|
6291
|
-
* - Maximum length: 4096 characters
|
|
6292
|
-
*
|
|
6293
|
-
* Requirements for data URLs:
|
|
6294
|
-
*
|
|
6295
|
-
* - Must include `;base64` for base64-encoded data
|
|
6296
|
-
* - Maximum size: 10MB (10 × 1024 × 1024 characters)
|
|
6297
|
-
* - The dimensions of the thumbnail must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
|
|
6352
|
+
* @public
|
|
6353
|
+
* A unique identifier that points to a video asset in Canva's backend.
|
|
6298
6354
|
*/
|
|
6299
|
-
|
|
6355
|
+
declare type VideoRef_2 = string & {
|
|
6356
|
+
__videoRef: never;
|
|
6357
|
+
};
|
|
6358
|
+
|
|
6300
6359
|
/**
|
|
6301
|
-
*
|
|
6302
|
-
*
|
|
6303
|
-
* @remarks
|
|
6304
|
-
* Helps users make informed decisions about the content they interact with.
|
|
6305
|
-
* See {@link AiDisclosure} for the full definition.
|
|
6306
|
-
*
|
|
6307
|
-
* **App Generated**
|
|
6308
|
-
*
|
|
6309
|
-
* 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
|
|
6310
|
-
* the app requests a third-party service to take similar action on a video using AI.
|
|
6311
|
-
*
|
|
6312
|
-
* Required for the following cases (this list is not exhaustive):
|
|
6313
|
-
* | Case | Reason |
|
|
6314
|
-
* | -- | -- |
|
|
6315
|
-
* | AI generates a new video from scratch | Creates new creative content |
|
|
6316
|
-
* | AI changes the style of the video e.g. makes it cartoon | Significantly alters the style |
|
|
6317
|
-
* | AI adds subtitles that rely on subjective interpretation | Creates new creative content |
|
|
6318
|
-
* | AI expands a video by generating new content to fill the edges | Creates new creative content |
|
|
6319
|
-
* | AI animates an image | Creates new creative content |
|
|
6320
|
-
* | AI fixes defects e.g. blur in a video by generating details | Creates new creative content |
|
|
6321
|
-
* | AI generates a talking head presenter | Creates new creative content |
|
|
6322
|
-
*
|
|
6323
|
-
* **None**
|
|
6324
|
-
*
|
|
6325
|
-
* 'none' indicates when the app doesn't create or significantly alter an asset using AI, or as a part of
|
|
6326
|
-
* a request to third-party hosted content.
|
|
6327
|
-
*
|
|
6328
|
-
* Required for the following cases (this list is not exhaustive):
|
|
6329
|
-
* | Case | Reason |
|
|
6330
|
-
* | -- | -- |
|
|
6331
|
-
* | Asset comes from an asset library | Didn't generate the asset itself |
|
|
6332
|
-
* | AI corrects red eyes | A minor correction |
|
|
6333
|
-
* | AI adjusts brightness and contrast on a video | Doesn't change original meaning by itself |
|
|
6334
|
-
* | AI creates a slow motion effect in a video | Doesn't change original meaning by itself |
|
|
6335
|
-
* | AI adds AI word-by-word transcribed subtitles to a video | Doesn't change original meaning by itself |
|
|
6360
|
+
* @public
|
|
6361
|
+
* Options for uploading a video asset to the user's private media library.
|
|
6336
6362
|
*/
|
|
6337
|
-
|
|
6363
|
+
declare type VideoUploadOptions = {
|
|
6364
|
+
/**
|
|
6365
|
+
* The type of asset.
|
|
6366
|
+
*/
|
|
6367
|
+
type: 'video';
|
|
6368
|
+
/**
|
|
6369
|
+
* A human-readable name for the video asset.
|
|
6370
|
+
*
|
|
6371
|
+
* @remarks
|
|
6372
|
+
* This name is displayed in the user's media library and helps users identify
|
|
6373
|
+
* and find the asset later. If not provided, Canva will generate a name based
|
|
6374
|
+
* on the asset's URL or a unique identifier.
|
|
6375
|
+
*
|
|
6376
|
+
* Requirements:
|
|
6377
|
+
* - Minimum length: 1 character (empty strings are not allowed)
|
|
6378
|
+
* - Maximum length: 255 characters
|
|
6379
|
+
*/
|
|
6380
|
+
name?: string;
|
|
6381
|
+
/**
|
|
6382
|
+
* The ref of the original asset from which this new asset was derived.
|
|
6383
|
+
*
|
|
6384
|
+
* @remarks
|
|
6385
|
+
* For example, if an app applies an effect to a video, `parentRef` should contain the ref of the original video.
|
|
6386
|
+
*/
|
|
6387
|
+
parentRef?: VideoRef_2;
|
|
6388
|
+
/**
|
|
6389
|
+
* The URL of the video file to upload.
|
|
6390
|
+
*
|
|
6391
|
+
* @remarks
|
|
6392
|
+
* Requirements:
|
|
6393
|
+
*
|
|
6394
|
+
* - Must use HTTPS
|
|
6395
|
+
* - Must return a `200` status code
|
|
6396
|
+
* - `Content-Type` must match the file's MIME type
|
|
6397
|
+
* - Must be publicly accessible (i.e. not a localhost URL)
|
|
6398
|
+
* - Must not redirect
|
|
6399
|
+
* - Must not contain an IP address
|
|
6400
|
+
* - Maximum length: 4096 characters
|
|
6401
|
+
* - Must not contain whitespace
|
|
6402
|
+
* - Must not contain these characters: `>`, `<`, `{`, `}`, `^`, backticks
|
|
6403
|
+
* - Maximum file size: 1000MB (1GB)
|
|
6404
|
+
*/
|
|
6405
|
+
url: string;
|
|
6406
|
+
/**
|
|
6407
|
+
* The MIME type of the video file.
|
|
6408
|
+
*/
|
|
6409
|
+
mimeType: VideoMimeType;
|
|
6410
|
+
/**
|
|
6411
|
+
* The URL of a thumbnail video to display while the video is queued for upload.
|
|
6412
|
+
*
|
|
6413
|
+
* @remarks
|
|
6414
|
+
* Requirements:
|
|
6415
|
+
*
|
|
6416
|
+
* - Must use HTTPS
|
|
6417
|
+
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
6418
|
+
* - Maximum length: 4096 characters
|
|
6419
|
+
* - The dimensions of the thumbnail video must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
|
|
6420
|
+
* - Must not be an AVI file. Although our APIs support uploading AVI videos, Canva can't preview them because of native support of browsers
|
|
6421
|
+
*/
|
|
6422
|
+
thumbnailVideoUrl?: string;
|
|
6423
|
+
/**
|
|
6424
|
+
* The URL of a thumbnail image to use as a fallback if `thumbnailVideoUrl` isn't provided.
|
|
6425
|
+
* This can be an external URL or a data URL.
|
|
6426
|
+
*
|
|
6427
|
+
* @remarks
|
|
6428
|
+
* Requirements for external URLs:
|
|
6429
|
+
*
|
|
6430
|
+
* - Must use HTTPS
|
|
6431
|
+
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
6432
|
+
* - Must be a PNG, JPEG, or SVG file
|
|
6433
|
+
* - Maximum length: 4096 characters
|
|
6434
|
+
*
|
|
6435
|
+
* Requirements for data URLs:
|
|
6436
|
+
*
|
|
6437
|
+
* - Must include `;base64` for base64-encoded data
|
|
6438
|
+
* - Maximum size: 10MB (10 × 1024 × 1024 characters)
|
|
6439
|
+
* - The dimensions of the thumbnail must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
|
|
6440
|
+
*/
|
|
6441
|
+
thumbnailImageUrl: string;
|
|
6442
|
+
/**
|
|
6443
|
+
* A disclosure identifying if the app generated this video using AI.
|
|
6444
|
+
*
|
|
6445
|
+
* @remarks
|
|
6446
|
+
* Helps users make informed decisions about the content they interact with.
|
|
6447
|
+
* See {@link AiDisclosure} for the full definition.
|
|
6448
|
+
*
|
|
6449
|
+
* **App Generated**
|
|
6450
|
+
*
|
|
6451
|
+
* 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
|
|
6452
|
+
* the app requests a third-party service to take similar action on a video using AI.
|
|
6453
|
+
*
|
|
6454
|
+
* Required for the following cases (this list is not exhaustive):
|
|
6455
|
+
* | Case | Reason |
|
|
6456
|
+
* | -- | -- |
|
|
6457
|
+
* | AI generates a new video from scratch | Creates new creative content |
|
|
6458
|
+
* | AI changes the style of the video e.g. makes it cartoon | Significantly alters the style |
|
|
6459
|
+
* | AI adds subtitles that rely on subjective interpretation | Creates new creative content |
|
|
6460
|
+
* | AI expands a video by generating new content to fill the edges | Creates new creative content |
|
|
6461
|
+
* | AI animates an image | Creates new creative content |
|
|
6462
|
+
* | AI fixes defects e.g. blur in a video by generating details | Creates new creative content |
|
|
6463
|
+
* | AI generates a talking head presenter | Creates new creative content |
|
|
6464
|
+
*
|
|
6465
|
+
* **None**
|
|
6466
|
+
*
|
|
6467
|
+
* 'none' indicates when the app doesn't create or significantly alter an asset using AI, or as a part of
|
|
6468
|
+
* a request to third-party hosted content.
|
|
6469
|
+
*
|
|
6470
|
+
* Required for the following cases (this list is not exhaustive):
|
|
6471
|
+
* | Case | Reason |
|
|
6472
|
+
* | -- | -- |
|
|
6473
|
+
* | Asset comes from an asset library | Didn't generate the asset itself |
|
|
6474
|
+
* | AI corrects red eyes | A minor correction |
|
|
6475
|
+
* | AI adjusts brightness and contrast on a video | Doesn't change original meaning by itself |
|
|
6476
|
+
* | AI creates a slow motion effect in a video | Doesn't change original meaning by itself |
|
|
6477
|
+
* | AI adds AI word-by-word transcribed subtitles to a video | Doesn't change original meaning by itself |
|
|
6478
|
+
*/
|
|
6479
|
+
aiDisclosure: AiDisclosure;
|
|
6338
6480
|
|
|
6339
|
-
} & AllOrNone<Dimensions_2>;
|
|
6481
|
+
} & AllOrNone<Dimensions_2>;
|
|
6340
6482
|
|
|
6341
|
-
/**
|
|
6342
|
-
* A set of dimensions with an auto-calculated height.
|
|
6343
|
-
*/
|
|
6344
|
-
declare type Width = {
|
|
6345
6483
|
/**
|
|
6346
|
-
* A
|
|
6347
|
-
*
|
|
6348
|
-
* @remarks
|
|
6349
|
-
* - The pixels are relative to their container.
|
|
6350
|
-
* - Minimum: 0
|
|
6351
|
-
* - Maximum: 32767
|
|
6484
|
+
* A set of dimensions with an auto-calculated height.
|
|
6352
6485
|
*/
|
|
6353
|
-
|
|
6486
|
+
declare type Width = {
|
|
6487
|
+
/**
|
|
6488
|
+
* A width, in pixels.
|
|
6489
|
+
*
|
|
6490
|
+
* @remarks
|
|
6491
|
+
* - The pixels are relative to their container.
|
|
6492
|
+
* - Minimum: 0
|
|
6493
|
+
* - Maximum: 32767
|
|
6494
|
+
*/
|
|
6495
|
+
width: number;
|
|
6496
|
+
/**
|
|
6497
|
+
* Indicates that the height should be auto-calculated.
|
|
6498
|
+
*/
|
|
6499
|
+
height: 'auto';
|
|
6500
|
+
};
|
|
6501
|
+
|
|
6354
6502
|
/**
|
|
6355
|
-
*
|
|
6503
|
+
* A set of dimensions, in pixels.
|
|
6356
6504
|
*/
|
|
6357
|
-
|
|
6358
|
-
|
|
6505
|
+
declare type WidthAndHeight = {
|
|
6506
|
+
/**
|
|
6507
|
+
* A width, in pixels.
|
|
6508
|
+
*
|
|
6509
|
+
* @remarks
|
|
6510
|
+
* - The pixels are relative to their container.
|
|
6511
|
+
* - Minimum: 0
|
|
6512
|
+
* - Maximum: 32767
|
|
6513
|
+
*/
|
|
6514
|
+
width: number;
|
|
6515
|
+
/**
|
|
6516
|
+
* A height, in pixels.
|
|
6517
|
+
*
|
|
6518
|
+
* @remarks
|
|
6519
|
+
* - The pixels are relative to their container.
|
|
6520
|
+
* - Minimum: 0
|
|
6521
|
+
* - Maximum: 32767
|
|
6522
|
+
*/
|
|
6523
|
+
height: number;
|
|
6524
|
+
};
|
|
6359
6525
|
|
|
6360
|
-
/**
|
|
6361
|
-
* A set of dimensions, in pixels.
|
|
6362
|
-
*/
|
|
6363
|
-
declare type WidthAndHeight = {
|
|
6364
6526
|
/**
|
|
6365
|
-
*
|
|
6527
|
+
* @public
|
|
6528
|
+
* The behavior of zipping the exported files.
|
|
6366
6529
|
*
|
|
6367
6530
|
* @remarks
|
|
6368
|
-
*
|
|
6369
|
-
* -
|
|
6370
|
-
* -
|
|
6371
|
-
|
|
6372
|
-
width: number;
|
|
6373
|
-
/**
|
|
6374
|
-
* A height, in pixels.
|
|
6531
|
+
* For `png`, `jpg`, and `svg`:
|
|
6532
|
+
* - `auto` (default): Files are zipped together if the design has multiple pages, unzipped if it has one page.
|
|
6533
|
+
* - `always`: Files are always zipped into a single zip file, regardless of page count.
|
|
6534
|
+
* - `never`: Files are never zipped, providing an array of files.
|
|
6375
6535
|
*
|
|
6376
|
-
*
|
|
6377
|
-
* -
|
|
6378
|
-
* -
|
|
6379
|
-
* - Maximum: 32767
|
|
6536
|
+
* For `video` and `gif`:
|
|
6537
|
+
* - `auto` or `never` (default): Files are never zipped together, regardless of count.
|
|
6538
|
+
* - `always`: Files are always zipped into a single file.
|
|
6380
6539
|
*/
|
|
6381
|
-
|
|
6382
|
-
};
|
|
6383
|
-
|
|
6384
|
-
/**
|
|
6385
|
-
* @public
|
|
6386
|
-
* The behavior of zipping the exported files.
|
|
6387
|
-
*
|
|
6388
|
-
* @remarks
|
|
6389
|
-
* For `png`, `jpg`, and `svg`:
|
|
6390
|
-
* - `auto` (default): Files are zipped together if the design has multiple pages, unzipped if it has one page.
|
|
6391
|
-
* - `always`: Files are always zipped into a single zip file, regardless of page count.
|
|
6392
|
-
* - `never`: Files are never zipped, providing an array of files.
|
|
6393
|
-
*
|
|
6394
|
-
* For `video` and `gif`:
|
|
6395
|
-
* - `auto` or `never` (default): Files are never zipped together, regardless of count.
|
|
6396
|
-
* - `always`: Files are always zipped into a single file.
|
|
6397
|
-
*/
|
|
6398
|
-
export declare type ZipBehavior = 'auto' | 'always' | 'never';
|
|
6540
|
+
export declare type ZipBehavior = 'auto' | 'always' | 'never';
|
|
6399
6541
|
|
|
6400
|
-
export { }
|
|
6542
|
+
export { }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ResetToDefault", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return ResetToDefault;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const ResetToDefault = Symbol.for('$$canva_reset_to_default');
|
|
@@ -9,12 +9,21 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
get ResetToDefault () {
|
|
13
|
+
return _alpha.ResetToDefault;
|
|
14
|
+
},
|
|
15
|
+
get applyTemplate () {
|
|
16
|
+
return applyTemplate;
|
|
17
|
+
},
|
|
12
18
|
get getBrandTemplateMetadata () {
|
|
13
19
|
return getBrandTemplateMetadata;
|
|
14
20
|
},
|
|
15
21
|
get initAppElement () {
|
|
16
22
|
return initAppElement;
|
|
17
23
|
},
|
|
24
|
+
get openDesign () {
|
|
25
|
+
return openDesign;
|
|
26
|
+
},
|
|
18
27
|
get requestAutofillDesign () {
|
|
19
28
|
return requestAutofillDesign;
|
|
20
29
|
},
|
|
@@ -23,6 +32,7 @@ _export(exports, {
|
|
|
23
32
|
}
|
|
24
33
|
});
|
|
25
34
|
const _version = require("./version");
|
|
35
|
+
const _alpha = require('../../api/design/types/design_interaction/document/alpha');
|
|
26
36
|
_export_star(require("./public"), exports);
|
|
27
37
|
function _export_star(from, to) {
|
|
28
38
|
Object.keys(from).forEach(function(k) {
|
|
@@ -41,4 +51,6 @@ const initAppElement = canva_sdk.design.v2.designInteraction.initAppElement;
|
|
|
41
51
|
const requestAutofillDesign = canva_sdk.design.v2.autofill.requestAutofillDesign;
|
|
42
52
|
const requestBrandTemplates = canva_sdk.design.v2.designInteraction.requestBrandTemplates;
|
|
43
53
|
const getBrandTemplateMetadata = canva_sdk.design.v2.designInteraction.getBrandTemplateMetadata;
|
|
54
|
+
const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
|
|
55
|
+
const applyTemplate = canva_sdk.design.v2.designInteraction.applyTemplate;
|
|
44
56
|
window.__canva__?.sdkRegistration?.registerPackageVersion('design', _version.LATEST_VERSION_ALPHA, 'alpha');
|
|
@@ -37,6 +37,12 @@ class FakeDesignInteractionClient {
|
|
|
37
37
|
]
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
+
async applyTemplate(options) {
|
|
41
|
+
await this.delay();
|
|
42
|
+
return {
|
|
43
|
+
status: 'completed'
|
|
44
|
+
};
|
|
45
|
+
}
|
|
40
46
|
async getBrandTemplateMetadata(id) {
|
|
41
47
|
await this.delay();
|
|
42
48
|
return {
|
|
@@ -410,10 +416,18 @@ const fakeAsyncOperations = {
|
|
|
410
416
|
];
|
|
411
417
|
}
|
|
412
418
|
};
|
|
419
|
+
const fakeTimingAccessor = {
|
|
420
|
+
get: ()=>({
|
|
421
|
+
delayInSeconds: 0,
|
|
422
|
+
durationInSeconds: 'until_end_of_page'
|
|
423
|
+
}),
|
|
424
|
+
set: async ()=>{}
|
|
425
|
+
};
|
|
413
426
|
const fakeOpenDesignHelpers = {
|
|
414
427
|
elementStateBuilder: fakeElementStateBuilder,
|
|
415
428
|
group: fakeAsyncOperations.group,
|
|
416
429
|
ungroup: fakeAsyncOperations.ungroup,
|
|
430
|
+
timingFor: (_elementRef)=>fakeTimingAccessor,
|
|
417
431
|
snapshot: ()=>{
|
|
418
432
|
return {};
|
|
419
433
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ResetToDefault = Symbol.for('$$canva_reset_to_default');
|
|
@@ -3,5 +3,8 @@ export const initAppElement = canva_sdk.design.v2.designInteraction.initAppEleme
|
|
|
3
3
|
export const requestAutofillDesign = canva_sdk.design.v2.autofill.requestAutofillDesign;
|
|
4
4
|
export const requestBrandTemplates = canva_sdk.design.v2.designInteraction.requestBrandTemplates;
|
|
5
5
|
export const getBrandTemplateMetadata = canva_sdk.design.v2.designInteraction.getBrandTemplateMetadata;
|
|
6
|
+
export const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
|
|
7
|
+
export const applyTemplate = canva_sdk.design.v2.designInteraction.applyTemplate;
|
|
8
|
+
export { ResetToDefault } from '../../api/design/types/design_interaction/document/alpha';
|
|
6
9
|
export * from './public';
|
|
7
10
|
window.__canva__?.sdkRegistration?.registerPackageVersion('design', LATEST_VERSION_ALPHA, 'alpha');
|
|
@@ -16,6 +16,12 @@ export class FakeDesignInteractionClient {
|
|
|
16
16
|
]
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
async applyTemplate(options) {
|
|
20
|
+
await this.delay();
|
|
21
|
+
return {
|
|
22
|
+
status: 'completed'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
19
25
|
async getBrandTemplateMetadata(id) {
|
|
20
26
|
await this.delay();
|
|
21
27
|
return {
|
|
@@ -389,10 +395,18 @@ const fakeAsyncOperations = {
|
|
|
389
395
|
];
|
|
390
396
|
}
|
|
391
397
|
};
|
|
398
|
+
const fakeTimingAccessor = {
|
|
399
|
+
get: ()=>({
|
|
400
|
+
delayInSeconds: 0,
|
|
401
|
+
durationInSeconds: 'until_end_of_page'
|
|
402
|
+
}),
|
|
403
|
+
set: async ()=>{}
|
|
404
|
+
};
|
|
392
405
|
export const fakeOpenDesignHelpers = {
|
|
393
406
|
elementStateBuilder: fakeElementStateBuilder,
|
|
394
407
|
group: fakeAsyncOperations.group,
|
|
395
408
|
ungroup: fakeAsyncOperations.ungroup,
|
|
409
|
+
timingFor: (_elementRef)=>fakeTimingAccessor,
|
|
396
410
|
snapshot: ()=>{
|
|
397
411
|
return {};
|
|
398
412
|
}
|