@canva/design 2.6.1 → 2.6.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{index.d.ts → beta.d.ts} +123 -11
- package/lib/cjs/sdk/design/{index.js → beta.js} +21 -2
- package/lib/cjs/sdk/design/test/beta.js +18 -0
- package/lib/esm/sdk/design/{index.js → beta.js} +6 -1
- package/lib/esm/sdk/design/test/beta.js +1 -0
- package/package.json +11 -11
- /package/test/{index.d.ts → beta.d.ts} +0 -0
package/{index.d.ts → beta.d.ts}
RENAMED
|
@@ -348,11 +348,16 @@ export declare interface ContentDraft<T> {
|
|
|
348
348
|
save(): Promise<void>;
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
+
/**
|
|
352
|
+
* @beta
|
|
353
|
+
*/
|
|
354
|
+
export declare type ContentType = "richtext" | "fill";
|
|
355
|
+
|
|
351
356
|
/**
|
|
352
357
|
* @public
|
|
353
358
|
* A type of content that can be read from a user's design.
|
|
354
359
|
*/
|
|
355
|
-
|
|
360
|
+
declare type ContentType_2 = "richtext";
|
|
356
361
|
|
|
357
362
|
/**
|
|
358
363
|
* @public
|
|
@@ -1911,6 +1916,40 @@ export declare type DesignElement =
|
|
|
1911
1916
|
| RichtextElement
|
|
1912
1917
|
| TableElement;
|
|
1913
1918
|
|
|
1919
|
+
/**
|
|
1920
|
+
* @beta
|
|
1921
|
+
* Information about the design.
|
|
1922
|
+
*/
|
|
1923
|
+
export declare type DesignMetadata = {
|
|
1924
|
+
/**
|
|
1925
|
+
* The title of the user's design.
|
|
1926
|
+
* @remarks
|
|
1927
|
+
* This is optional and will be `undefined` if the user hasn't set a title.
|
|
1928
|
+
*/
|
|
1929
|
+
title?: string;
|
|
1930
|
+
/**
|
|
1931
|
+
* The default dimensions that a new page will have when it is added to a design.
|
|
1932
|
+
* It is possible for a user to resize a page without resizing the entire design, e.g. by clicking
|
|
1933
|
+
* "Expand to Whiteboard". However, there will always be a single set of default dimensions for a
|
|
1934
|
+
* design that is applied whenever a new page is created.
|
|
1935
|
+
* @remarks
|
|
1936
|
+
* This is optional and will be `undefined` if the design is unbounded (e.g. Whiteboard or Doc).
|
|
1937
|
+
*/
|
|
1938
|
+
defaultPageDimensions?: PageDimensions;
|
|
1939
|
+
/**
|
|
1940
|
+
* The information associated with each page of the design.
|
|
1941
|
+
* @remarks
|
|
1942
|
+
* The order of pages is not guaranteed.
|
|
1943
|
+
*/
|
|
1944
|
+
pageMetadata: Iterable<PageContext>;
|
|
1945
|
+
/**
|
|
1946
|
+
* The duration of the whole design in seconds.
|
|
1947
|
+
* @remarks
|
|
1948
|
+
* This is the precise value, which differs from what is displayed in the UI as duration in Canva UI is formatted differently.
|
|
1949
|
+
*/
|
|
1950
|
+
durationInSeconds: number;
|
|
1951
|
+
};
|
|
1952
|
+
|
|
1914
1953
|
/**
|
|
1915
1954
|
* @public
|
|
1916
1955
|
* A callback for reading and updating part of a design.
|
|
@@ -2013,27 +2052,53 @@ export declare type DragStartEvent<E extends Element> = Pick<
|
|
|
2013
2052
|
};
|
|
2014
2053
|
|
|
2015
2054
|
/**
|
|
2016
|
-
* @
|
|
2017
|
-
* Reads and edits content
|
|
2018
|
-
* @param options - Options for configuring how a design is read.
|
|
2019
|
-
* @param callback - A callback
|
|
2055
|
+
* @beta
|
|
2056
|
+
* Reads and edits richtext content from the user's design.
|
|
2057
|
+
* @param options - Options for configuring how a design is read. Must specify `contentType: 'richtext'`.
|
|
2058
|
+
* @param callback - A callback that receives a `RichtextContentSession` for editing.
|
|
2059
|
+
* @returns A promise that resolves when editing is complete.
|
|
2020
2060
|
*/
|
|
2021
|
-
export declare
|
|
2022
|
-
options: EditContentOptions
|
|
2023
|
-
|
|
2024
|
-
|
|
2061
|
+
export declare function editContent(
|
|
2062
|
+
options: EditContentOptions & {
|
|
2063
|
+
contentType: "richtext";
|
|
2064
|
+
},
|
|
2065
|
+
callback: (session: RichtextContentSession) => Promise<void> | void,
|
|
2066
|
+
): Promise<void>;
|
|
2025
2067
|
|
|
2026
2068
|
/**
|
|
2027
|
-
* @
|
|
2069
|
+
* @beta
|
|
2070
|
+
* Reads and edits fill content from the user's design.
|
|
2071
|
+
* @param options - Options for configuring how a design is read. Must specify `contentType: 'fill'`.
|
|
2072
|
+
* @param callback - A callback that receives a `FillContentSession` for editing.
|
|
2073
|
+
* @returns A promise that resolves when editing is complete.
|
|
2074
|
+
*/
|
|
2075
|
+
export declare function editContent(
|
|
2076
|
+
options: EditContentOptions & {
|
|
2077
|
+
contentType: "fill";
|
|
2078
|
+
},
|
|
2079
|
+
callback: (session: FillContentSession) => Promise<void> | void,
|
|
2080
|
+
): Promise<void>;
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* @beta
|
|
2028
2084
|
* A callback for reading and updating the requested design content.
|
|
2029
2085
|
* @param session - The result of reading the content in the design.
|
|
2030
2086
|
*/
|
|
2031
2087
|
export declare type EditContentCallback = (
|
|
2032
|
-
session: RichtextContentSession,
|
|
2088
|
+
session: RichtextContentSession | FillContentSession,
|
|
2033
2089
|
) => Promise<void> | void;
|
|
2034
2090
|
|
|
2035
2091
|
/**
|
|
2036
2092
|
* @public
|
|
2093
|
+
* A callback for reading and updating the requested design content.
|
|
2094
|
+
* @param session - The result of reading the content in the design.
|
|
2095
|
+
*/
|
|
2096
|
+
declare type EditContentCallback_2 = (
|
|
2097
|
+
session: RichtextContentSession,
|
|
2098
|
+
) => Promise<void> | void;
|
|
2099
|
+
|
|
2100
|
+
/**
|
|
2101
|
+
* @beta
|
|
2037
2102
|
* Options for configuring how the design content is read.
|
|
2038
2103
|
*/
|
|
2039
2104
|
export declare type EditContentOptions = {
|
|
@@ -2043,6 +2108,17 @@ export declare type EditContentOptions = {
|
|
|
2043
2108
|
contentType: ContentType;
|
|
2044
2109
|
} & ContextOptions;
|
|
2045
2110
|
|
|
2111
|
+
/**
|
|
2112
|
+
* @public
|
|
2113
|
+
* Options for configuring how the design content is read.
|
|
2114
|
+
*/
|
|
2115
|
+
declare type EditContentOptions_2 = {
|
|
2116
|
+
/**
|
|
2117
|
+
* The type of content to edit from the user's design
|
|
2118
|
+
*/
|
|
2119
|
+
contentType: ContentType_2;
|
|
2120
|
+
} & ContextOptions;
|
|
2121
|
+
|
|
2046
2122
|
/**
|
|
2047
2123
|
* @public
|
|
2048
2124
|
* Elements targeting a cursor are a subset of the base Element
|
|
@@ -2273,6 +2349,31 @@ export declare type Fill = {
|
|
|
2273
2349
|
asset?: ImageFill | VideoFill;
|
|
2274
2350
|
};
|
|
2275
2351
|
|
|
2352
|
+
/**
|
|
2353
|
+
* @beta
|
|
2354
|
+
* Object for interacting with fill content (images/videos).
|
|
2355
|
+
*/
|
|
2356
|
+
export declare type FillContent =
|
|
2357
|
+
| {
|
|
2358
|
+
type: "image";
|
|
2359
|
+
ref: ImageRef;
|
|
2360
|
+
deleted: boolean;
|
|
2361
|
+
}
|
|
2362
|
+
| {
|
|
2363
|
+
type: "video";
|
|
2364
|
+
ref: VideoRef;
|
|
2365
|
+
deleted: boolean;
|
|
2366
|
+
};
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* @beta
|
|
2370
|
+
* Session for reading and updating fill content in a user's design.
|
|
2371
|
+
*/
|
|
2372
|
+
export declare interface FillContentSession {
|
|
2373
|
+
readonly contents: readonly FillContent[];
|
|
2374
|
+
sync(): Promise<void>;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2276
2377
|
/**
|
|
2277
2378
|
* @public
|
|
2278
2379
|
* A reference to a font that can be used in other parts of the SDK.
|
|
@@ -2316,6 +2417,12 @@ export declare const getDefaultPageDimensions: () => Promise<
|
|
|
2316
2417
|
Dimensions | undefined
|
|
2317
2418
|
>;
|
|
2318
2419
|
|
|
2420
|
+
/**
|
|
2421
|
+
* @beta
|
|
2422
|
+
* Retrieves information about the design.
|
|
2423
|
+
*/
|
|
2424
|
+
export declare const getDesignMetadata: () => Promise<DesignMetadata>;
|
|
2425
|
+
|
|
2319
2426
|
/**
|
|
2320
2427
|
* @public
|
|
2321
2428
|
* Retrieves a signed JWT that contains the Design ID, App ID and User ID.
|
|
@@ -3338,6 +3445,11 @@ export declare type TextDragConfig = {
|
|
|
3338
3445
|
* @defaultValue "none"
|
|
3339
3446
|
*/
|
|
3340
3447
|
decoration?: "none" | "underline";
|
|
3448
|
+
/**
|
|
3449
|
+
* @beta
|
|
3450
|
+
* A unique identifier that points to a font asset in Canva's backend.
|
|
3451
|
+
*/
|
|
3452
|
+
fontRef?: FontRef;
|
|
3341
3453
|
};
|
|
3342
3454
|
|
|
3343
3455
|
/**
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get editContent () {
|
|
13
|
+
return editContent;
|
|
14
|
+
},
|
|
15
|
+
get getDesignMetadata () {
|
|
16
|
+
return getDesignMetadata;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
5
19
|
_export_star(require("./public"), exports);
|
|
6
20
|
function _export_star(from, to) {
|
|
7
21
|
Object.keys(from).forEach(function(k) {
|
|
@@ -17,4 +31,9 @@ function _export_star(from, to) {
|
|
|
17
31
|
return from;
|
|
18
32
|
}
|
|
19
33
|
var _window___canva___sdkRegistration, _window___canva__;
|
|
20
|
-
|
|
34
|
+
const { canva_sdk } = window;
|
|
35
|
+
const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesignMetadata;
|
|
36
|
+
function editContent(options, callback) {
|
|
37
|
+
return canva_sdk.design.v2.designInteraction.editContent(options, (session)=>callback(session));
|
|
38
|
+
}
|
|
39
|
+
(_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.6.2', 'beta');
|
|
@@ -0,0 +1,18 @@
|
|
|
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,3 +1,8 @@
|
|
|
1
1
|
var _window___canva___sdkRegistration, _window___canva__;
|
|
2
|
+
const { canva_sdk } = window;
|
|
3
|
+
export const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesignMetadata;
|
|
4
|
+
export function editContent(options, callback) {
|
|
5
|
+
return canva_sdk.design.v2.designInteraction.editContent(options, (session)=>callback(session));
|
|
6
|
+
}
|
|
2
7
|
export * from './public';
|
|
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.6.
|
|
8
|
+
(_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.6.2', 'beta');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index';
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canva/design",
|
|
3
|
-
"version": "2.6.1",
|
|
3
|
+
"version": "2.6.2-beta.1",
|
|
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/beta.js",
|
|
11
|
+
"module": "./lib/esm/sdk/design/beta.js",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"require": "./lib/cjs/sdk/design/
|
|
16
|
-
"import": "./lib/esm/sdk/design/
|
|
14
|
+
"types": "./beta.d.ts",
|
|
15
|
+
"require": "./lib/cjs/sdk/design/beta.js",
|
|
16
|
+
"import": "./lib/esm/sdk/design/beta.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/beta.d.ts",
|
|
20
|
+
"require": "./lib/cjs/sdk/design/test/beta.js",
|
|
21
|
+
"import": "./lib/esm/sdk/design/test/beta.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"typings": "./
|
|
25
|
-
}
|
|
24
|
+
"typings": "./beta.d.ts"
|
|
25
|
+
}
|
|
File without changes
|