@canva/design 2.7.1-beta.0 → 2.7.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.
@@ -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 ContentType_2 = "richtext";
1022
+ export declare type ContentType = "richtext";
1028
1023
 
1029
1024
  /**
1030
1025
  * @public
@@ -2625,6 +2620,7 @@ export declare namespace DesignEditing {
2625
2620
  */
2626
2621
  readonly elements: ElementList;
2627
2622
  };
2623
+
2628
2624
  /**
2629
2625
  * @public
2630
2626
  * A page in a design.
@@ -2635,6 +2631,7 @@ export declare namespace DesignEditing {
2635
2631
  * - Additional page types may be supported in future releases.
2636
2632
  */
2637
2633
  export type Page = AbsolutePage | Unsupported;
2634
+
2638
2635
  {
2639
2636
  }
2640
2637
  }
@@ -2924,53 +2921,39 @@ export declare type DragStartEvent<E extends Element> = Pick<
2924
2921
  };
2925
2922
 
2926
2923
  /**
2927
- * @beta
2928
- * Reads and edits richtext content from the user's design.
2929
- * @param options - Options for configuring how a design is read. Must specify `contentType: 'richtext'`.
2930
- * @param callback - A callback that receives a `RichtextContentSession` for editing.
2931
- * @returns A promise that resolves when editing is complete.
2932
- */
2933
- export declare function editContent(
2934
- options: EditContentOptions & {
2935
- contentType: "richtext";
2936
- },
2937
- callback: (session: RichtextContentSession) => Promise<void> | void,
2938
- ): Promise<void>;
2939
-
2940
- /**
2941
- * @beta
2942
- * Reads and edits fill content from the user's design.
2943
- * @param options - Options for configuring how a design is read. Must specify `contentType: 'fill'`.
2944
- * @param callback - A callback that receives a `FillContentSession` for editing.
2945
- * @returns A promise that resolves when editing is complete.
2946
- */
2947
- export declare function editContent(
2948
- options: EditContentOptions & {
2949
- contentType: "fill";
2950
- },
2951
- callback: (session: FillContentSession) => Promise<void> | void,
2952
- ): Promise<void>;
2953
-
2954
- /**
2955
- * @beta
2956
- * A callback for reading and updating the requested design content.
2957
- * @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
+ * ```
2958
2940
  */
2959
- export declare type EditContentCallback = (
2960
- session: RichtextContentSession | FillContentSession,
2961
- ) => Promise<void> | void;
2941
+ export declare const editContent: (
2942
+ options: EditContentOptions,
2943
+ callback: EditContentCallback,
2944
+ ) => Promise<void>;
2962
2945
 
2963
2946
  /**
2964
2947
  * @public
2965
2948
  * A callback for reading and updating the requested design content.
2966
2949
  * @param session - The result of reading the content in the design.
2967
2950
  */
2968
- declare type EditContentCallback_2 = (
2951
+ export declare type EditContentCallback = (
2969
2952
  session: RichtextContentSession,
2970
2953
  ) => Promise<void> | void;
2971
2954
 
2972
2955
  /**
2973
- * @beta
2956
+ * @public
2974
2957
  * Options for configuring how the design content is read.
2975
2958
  */
2976
2959
  export declare type EditContentOptions = {
@@ -2980,17 +2963,6 @@ export declare type EditContentOptions = {
2980
2963
  contentType: ContentType;
2981
2964
  } & ContextOptions;
2982
2965
 
2983
- /**
2984
- * @public
2985
- * Options for configuring how the design content is read.
2986
- */
2987
- declare type EditContentOptions_2 = {
2988
- /**
2989
- * The type of content to edit from the user's design
2990
- */
2991
- contentType: ContentType_2;
2992
- } & ContextOptions;
2993
-
2994
2966
  /**
2995
2967
  * @public
2996
2968
  * Elements targeting a cursor are a subset of the base Element
@@ -3221,67 +3193,6 @@ export declare type Fill = {
3221
3193
  asset?: ImageFill | VideoFill;
3222
3194
  };
3223
3195
 
3224
- /**
3225
- * @beta
3226
- * Object for interacting with fill content (images/videos).
3227
- */
3228
- export declare type FillContent =
3229
- | {
3230
- type: "image";
3231
- /**
3232
- * A unique identifier that points to an image asset in Canva's backend.
3233
- */
3234
- ref: ImageRef;
3235
- /**
3236
- * A description of the image content.
3237
- *
3238
- * @remarks
3239
- * Use `undefined` for content with no description.
3240
- */
3241
- altText?: AltText;
3242
- /**
3243
- * Indicates whether the object containing this fill has been deleted.
3244
- */
3245
- deleted: boolean;
3246
- }
3247
- | {
3248
- type: "video";
3249
- /**
3250
- * A unique identifier that points to an video asset in Canva's backend.
3251
- */
3252
- ref: VideoRef;
3253
- /**
3254
- * A description of the video content.
3255
- *
3256
- * @remarks
3257
- * Use `undefined` for content with no description.
3258
- */
3259
- altText?: AltText;
3260
- /**
3261
- * Indicates whether the object containing this fill has been deleted.
3262
- */
3263
- deleted: boolean;
3264
- };
3265
-
3266
- /**
3267
- * @beta
3268
- * Session for reading and updating fill content in a user's design.
3269
- */
3270
- export declare interface FillContentSession {
3271
- /**
3272
- * Fill content in the design.
3273
- */
3274
- readonly contents: readonly FillContent[];
3275
- /**
3276
- * Saves any changes made during the session while keeping the transaction open.
3277
- *
3278
- * @remarks
3279
- * - Any changes in the session are only reflected in the design after this method is called.
3280
- * - Once this method is called, further changes in the session can still be made.
3281
- */
3282
- sync(): Promise<void>;
3283
- }
3284
-
3285
3196
  /**
3286
3197
  * @public
3287
3198
  * A reference to a font that can be used in other parts of the SDK.
@@ -3325,6 +3236,7 @@ export declare type FontWeight =
3325
3236
  export declare const getCurrentPageContext: () => Promise<PageContext>;
3326
3237
 
3327
3238
  /**
3239
+ * @deprecated
3328
3240
  * @public
3329
3241
  * Gets the default dimensions that a new page will have when it is added to a design.
3330
3242
  * It is possible for a user to resize a page without resizing the entire design, e.g. by clicking
@@ -4911,11 +4823,6 @@ export declare type TextDragConfig = {
4911
4823
  * @defaultValue "none"
4912
4824
  */
4913
4825
  decoration?: "none" | "underline";
4914
- /**
4915
- * @beta
4916
- * A unique identifier that points to a font asset in Canva's backend.
4917
- */
4918
- fontRef?: FontRef;
4919
4826
  };
4920
4827
 
4921
4828
  /**
@@ -9,10 +9,6 @@ Object.defineProperty(exports, "FakeDesignInteractionClient", {
9
9
  }
10
10
  });
11
11
  class FakeDesignInteractionClient {
12
- async getDesignTitle() {
13
- await this.delay();
14
- return 'title';
15
- }
16
12
  async getDesignToken() {
17
13
  await this.delay();
18
14
  return {
@@ -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
- const { canva_sdk } = window;
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.0', 'ga');
@@ -1,8 +1,4 @@
1
1
  export class FakeDesignInteractionClient {
2
- async getDesignTitle() {
3
- await this.delay();
4
- return 'title';
5
- }
6
2
  async getDesignToken() {
7
3
  await this.delay();
8
4
  return {
@@ -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.0', 'beta');
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.0', 'ga');
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@canva/design",
3
- "version": "2.7.1-beta.0",
3
+ "version": "2.7.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/beta.js",
11
- "module": "./lib/esm/sdk/design/beta.js",
10
+ "main": "./lib/cjs/sdk/design/index.js",
11
+ "module": "./lib/esm/sdk/design/index.js",
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./beta.d.ts",
15
- "require": "./lib/cjs/sdk/design/beta.js",
16
- "import": "./lib/esm/sdk/design/beta.js"
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/beta.d.ts",
20
- "require": "./lib/cjs/sdk/design/test/beta.js",
21
- "import": "./lib/esm/sdk/design/test/beta.js"
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": "./beta.d.ts"
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