@canva/design 2.7.2-beta.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{beta.d.ts → index.d.ts} +23 -119
- package/lib/cjs/sdk/design/{beta.js → index.js} +2 -12
- package/lib/esm/sdk/design/{beta.js → index.js} +1 -5
- package/package.json +10 -10
- package/lib/cjs/sdk/design/test/beta.js +0 -18
- package/lib/esm/sdk/design/test/beta.js +0 -1
- /package/test/{beta.d.ts → index.d.ts} +0 -0
package/{beta.d.ts → index.d.ts}
RENAMED
|
@@ -1015,16 +1015,11 @@ export declare interface ContentDraft<T> {
|
|
|
1015
1015
|
save(): Promise<void>;
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
-
/**
|
|
1019
|
-
* @beta
|
|
1020
|
-
*/
|
|
1021
|
-
export declare type ContentType = "richtext" | "fill";
|
|
1022
|
-
|
|
1023
1018
|
/**
|
|
1024
1019
|
* @public
|
|
1025
1020
|
* A type of content that can be read from a user's design.
|
|
1026
1021
|
*/
|
|
1027
|
-
declare type
|
|
1022
|
+
export declare type ContentType = "richtext";
|
|
1028
1023
|
|
|
1029
1024
|
/**
|
|
1030
1025
|
* @public
|
|
@@ -2926,53 +2921,39 @@ export declare type DragStartEvent<E extends Element> = Pick<
|
|
|
2926
2921
|
};
|
|
2927
2922
|
|
|
2928
2923
|
/**
|
|
2929
|
-
* @
|
|
2930
|
-
* Reads and edits
|
|
2931
|
-
* @param options - Options for configuring how a design is read.
|
|
2932
|
-
* @param callback - A callback
|
|
2933
|
-
*
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
)
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
*
|
|
2944
|
-
*
|
|
2945
|
-
* @param options - Options for configuring how a design is read. Must specify `contentType: 'fill'`.
|
|
2946
|
-
* @param callback - A callback that receives a `FillContentSession` for editing.
|
|
2947
|
-
* @returns A promise that resolves when editing is complete.
|
|
2948
|
-
*/
|
|
2949
|
-
export declare function editContent(
|
|
2950
|
-
options: EditContentOptions & {
|
|
2951
|
-
contentType: "fill";
|
|
2952
|
-
},
|
|
2953
|
-
callback: (session: FillContentSession) => Promise<void> | void,
|
|
2954
|
-
): Promise<void>;
|
|
2955
|
-
|
|
2956
|
-
/**
|
|
2957
|
-
* @beta
|
|
2958
|
-
* A callback for reading and updating the requested design content.
|
|
2959
|
-
* @param session - Session for reading and updating content in the design.
|
|
2924
|
+
* @public
|
|
2925
|
+
* Reads and edits content of the specified type from the user's design.
|
|
2926
|
+
* @param options - Options for configuring how a design is read.
|
|
2927
|
+
* @param callback - A callback for operating on the read content.
|
|
2928
|
+
*
|
|
2929
|
+
* @example Read richtext content
|
|
2930
|
+
* ```typescript
|
|
2931
|
+
* import { editContent } from "@canva/design";
|
|
2932
|
+
*
|
|
2933
|
+
* await editContent(
|
|
2934
|
+
* { contentType: 'richtext', target: 'current_page' },
|
|
2935
|
+
* async (session) => {
|
|
2936
|
+
* // Do something with the richtext content, e.g. `session.contents`
|
|
2937
|
+
* }
|
|
2938
|
+
* );
|
|
2939
|
+
* ```
|
|
2960
2940
|
*/
|
|
2961
|
-
export declare
|
|
2962
|
-
|
|
2963
|
-
|
|
2941
|
+
export declare const editContent: (
|
|
2942
|
+
options: EditContentOptions,
|
|
2943
|
+
callback: EditContentCallback,
|
|
2944
|
+
) => Promise<void>;
|
|
2964
2945
|
|
|
2965
2946
|
/**
|
|
2966
2947
|
* @public
|
|
2967
2948
|
* A callback for reading and updating the requested design content.
|
|
2968
2949
|
* @param session - The result of reading the content in the design.
|
|
2969
2950
|
*/
|
|
2970
|
-
declare type
|
|
2951
|
+
export declare type EditContentCallback = (
|
|
2971
2952
|
session: RichtextContentSession,
|
|
2972
2953
|
) => Promise<void> | void;
|
|
2973
2954
|
|
|
2974
2955
|
/**
|
|
2975
|
-
* @
|
|
2956
|
+
* @public
|
|
2976
2957
|
* Options for configuring how the design content is read.
|
|
2977
2958
|
*/
|
|
2978
2959
|
export declare type EditContentOptions = {
|
|
@@ -2982,17 +2963,6 @@ export declare type EditContentOptions = {
|
|
|
2982
2963
|
contentType: ContentType;
|
|
2983
2964
|
} & ContextOptions;
|
|
2984
2965
|
|
|
2985
|
-
/**
|
|
2986
|
-
* @public
|
|
2987
|
-
* Options for configuring how the design content is read.
|
|
2988
|
-
*/
|
|
2989
|
-
declare type EditContentOptions_2 = {
|
|
2990
|
-
/**
|
|
2991
|
-
* The type of content to edit from the user's design
|
|
2992
|
-
*/
|
|
2993
|
-
contentType: ContentType_2;
|
|
2994
|
-
} & ContextOptions;
|
|
2995
|
-
|
|
2996
2966
|
/**
|
|
2997
2967
|
* @public
|
|
2998
2968
|
* Elements targeting a cursor are a subset of the base Element
|
|
@@ -3223,67 +3193,6 @@ export declare type Fill = {
|
|
|
3223
3193
|
asset?: ImageFill | VideoFill;
|
|
3224
3194
|
};
|
|
3225
3195
|
|
|
3226
|
-
/**
|
|
3227
|
-
* @beta
|
|
3228
|
-
* Object for interacting with fill content (images/videos).
|
|
3229
|
-
*/
|
|
3230
|
-
export declare type FillContent =
|
|
3231
|
-
| {
|
|
3232
|
-
type: "image";
|
|
3233
|
-
/**
|
|
3234
|
-
* A unique identifier that points to an image asset in Canva's backend.
|
|
3235
|
-
*/
|
|
3236
|
-
ref: ImageRef;
|
|
3237
|
-
/**
|
|
3238
|
-
* A description of the image content.
|
|
3239
|
-
*
|
|
3240
|
-
* @remarks
|
|
3241
|
-
* Use `undefined` for content with no description.
|
|
3242
|
-
*/
|
|
3243
|
-
altText?: AltText;
|
|
3244
|
-
/**
|
|
3245
|
-
* Indicates whether the object containing this fill has been deleted.
|
|
3246
|
-
*/
|
|
3247
|
-
deleted: boolean;
|
|
3248
|
-
}
|
|
3249
|
-
| {
|
|
3250
|
-
type: "video";
|
|
3251
|
-
/**
|
|
3252
|
-
* A unique identifier that points to an video asset in Canva's backend.
|
|
3253
|
-
*/
|
|
3254
|
-
ref: VideoRef;
|
|
3255
|
-
/**
|
|
3256
|
-
* A description of the video content.
|
|
3257
|
-
*
|
|
3258
|
-
* @remarks
|
|
3259
|
-
* Use `undefined` for content with no description.
|
|
3260
|
-
*/
|
|
3261
|
-
altText?: AltText;
|
|
3262
|
-
/**
|
|
3263
|
-
* Indicates whether the object containing this fill has been deleted.
|
|
3264
|
-
*/
|
|
3265
|
-
deleted: boolean;
|
|
3266
|
-
};
|
|
3267
|
-
|
|
3268
|
-
/**
|
|
3269
|
-
* @beta
|
|
3270
|
-
* Session for reading and updating fill content in a user's design.
|
|
3271
|
-
*/
|
|
3272
|
-
export declare interface FillContentSession {
|
|
3273
|
-
/**
|
|
3274
|
-
* Fill content in the design.
|
|
3275
|
-
*/
|
|
3276
|
-
readonly contents: readonly FillContent[];
|
|
3277
|
-
/**
|
|
3278
|
-
* Saves any changes made during the session while keeping the transaction open.
|
|
3279
|
-
*
|
|
3280
|
-
* @remarks
|
|
3281
|
-
* - Any changes in the session are only reflected in the design after this method is called.
|
|
3282
|
-
* - Once this method is called, further changes in the session can still be made.
|
|
3283
|
-
*/
|
|
3284
|
-
sync(): Promise<void>;
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
3196
|
/**
|
|
3288
3197
|
* @public
|
|
3289
3198
|
* A reference to a font that can be used in other parts of the SDK.
|
|
@@ -4914,11 +4823,6 @@ export declare type TextDragConfig = {
|
|
|
4914
4823
|
* @defaultValue "none"
|
|
4915
4824
|
*/
|
|
4916
4825
|
decoration?: "none" | "underline";
|
|
4917
|
-
/**
|
|
4918
|
-
* @beta
|
|
4919
|
-
* A unique identifier that points to a font asset in Canva's backend.
|
|
4920
|
-
*/
|
|
4921
|
-
fontRef?: FontRef;
|
|
4922
4826
|
};
|
|
4923
4827
|
|
|
4924
4828
|
/**
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict"
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
Object.defineProperty(exports, "editContent", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return editContent;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
5
|
_export_star(require("./public"), exports);
|
|
12
6
|
function _export_star(from, to) {
|
|
13
7
|
Object.keys(from).forEach(function(k) {
|
|
@@ -23,8 +17,4 @@ function _export_star(from, to) {
|
|
|
23
17
|
return from;
|
|
24
18
|
}
|
|
25
19
|
var _window___canva___sdkRegistration, _window___canva__;
|
|
26
|
-
|
|
27
|
-
function editContent(options, callback) {
|
|
28
|
-
return canva_sdk.design.v2.designInteraction.editContent(options, (session)=>callback(session));
|
|
29
|
-
}
|
|
30
|
-
(_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.7.0', 'beta');
|
|
20
|
+
(_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.7.2', 'ga');
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
var _window___canva___sdkRegistration, _window___canva__;
|
|
2
|
-
const { canva_sdk } = window;
|
|
3
|
-
export function editContent(options, callback) {
|
|
4
|
-
return canva_sdk.design.v2.designInteraction.editContent(options, (session)=>callback(session));
|
|
5
|
-
}
|
|
6
2
|
export * from './public';
|
|
7
|
-
(_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.7.
|
|
3
|
+
(_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.7.2', 'ga');
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canva/design",
|
|
3
|
-
"version": "2.7.2
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "The Canva Apps SDK design library",
|
|
5
5
|
"author": "Canva Pty Ltd.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md FILE",
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@canva/error": "^2.0.0"
|
|
9
9
|
},
|
|
10
|
-
"main": "./lib/cjs/sdk/design/
|
|
11
|
-
"module": "./lib/esm/sdk/design/
|
|
10
|
+
"main": "./lib/cjs/sdk/design/index.js",
|
|
11
|
+
"module": "./lib/esm/sdk/design/index.js",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"require": "./lib/cjs/sdk/design/
|
|
16
|
-
"import": "./lib/esm/sdk/design/
|
|
14
|
+
"types": "./index.d.ts",
|
|
15
|
+
"require": "./lib/cjs/sdk/design/index.js",
|
|
16
|
+
"import": "./lib/esm/sdk/design/index.js"
|
|
17
17
|
},
|
|
18
18
|
"./test": {
|
|
19
|
-
"types": "./test/
|
|
20
|
-
"require": "./lib/cjs/sdk/design/test/
|
|
21
|
-
"import": "./lib/esm/sdk/design/test/
|
|
19
|
+
"types": "./test/index.d.ts",
|
|
20
|
+
"require": "./lib/cjs/sdk/design/test/index.js",
|
|
21
|
+
"import": "./lib/esm/sdk/design/test/index.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"typings": "./
|
|
24
|
+
"typings": "./index.d.ts"
|
|
25
25
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./index"), exports);
|
|
6
|
-
function _export_star(from, to) {
|
|
7
|
-
Object.keys(from).forEach(function(k) {
|
|
8
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
-
Object.defineProperty(to, k, {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function() {
|
|
12
|
-
return from[k];
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return from;
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './index';
|
|
File without changes
|