@canva/design 2.6.1-beta.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/beta.d.ts CHANGED
@@ -348,29 +348,6 @@ export declare interface ContentDraft<T> {
348
348
  save(): Promise<void>;
349
349
  }
350
350
 
351
- /**
352
- * @beta
353
- * Object for interacting with fill content (images/videos).
354
- */
355
- export declare type ContentFill = (
356
- | Omit<ImageFill, "altText">
357
- | Omit<VideoFill, "altText">
358
- ) & {
359
- /**
360
- * Indicates whether the fill object has been deleted.
361
- */
362
- deleted: boolean;
363
- };
364
-
365
- /**
366
- * @beta
367
- * Session for reading and updating fill content in a user's design.
368
- */
369
- export declare interface ContentFillSession {
370
- readonly contents: readonly ContentFill[];
371
- sync(): Promise<void>;
372
- }
373
-
374
351
  /**
375
352
  * @beta
376
353
  */
@@ -2075,15 +2052,32 @@ export declare type DragStartEvent<E extends Element> = Pick<
2075
2052
  };
2076
2053
 
2077
2054
  /**
2078
- * @public
2079
- * Reads and edits content of the specified type from the user's design.
2080
- * @param options - Options for configuring how a design is read.
2081
- * @param callback - A callback for operating on the read content.
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.
2082
2060
  */
2083
- export declare const editContent: (
2084
- options: EditContentOptions_2,
2085
- callback: EditContentCallback_2,
2086
- ) => Promise<void>;
2061
+ export declare function editContent(
2062
+ options: EditContentOptions & {
2063
+ contentType: "richtext";
2064
+ },
2065
+ callback: (session: RichtextContentSession) => Promise<void> | void,
2066
+ ): Promise<void>;
2067
+
2068
+ /**
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>;
2087
2081
 
2088
2082
  /**
2089
2083
  * @beta
@@ -2091,7 +2085,7 @@ export declare const editContent: (
2091
2085
  * @param session - The result of reading the content in the design.
2092
2086
  */
2093
2087
  export declare type EditContentCallback = (
2094
- session: RichtextContentSession | ContentFillSession,
2088
+ session: RichtextContentSession | FillContentSession,
2095
2089
  ) => Promise<void> | void;
2096
2090
 
2097
2091
  /**
@@ -2355,6 +2349,31 @@ export declare type Fill = {
2355
2349
  asset?: ImageFill | VideoFill;
2356
2350
  };
2357
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
+
2358
2377
  /**
2359
2378
  * @public
2360
2379
  * A reference to a font that can be used in other parts of the SDK.
@@ -2,9 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "getDesignMetadata", {
6
- enumerable: true,
7
- get: function() {
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 () {
8
16
  return getDesignMetadata;
9
17
  }
10
18
  });
@@ -25,4 +33,7 @@ function _export_star(from, to) {
25
33
  var _window___canva___sdkRegistration, _window___canva__;
26
34
  const { canva_sdk } = window;
27
35
  const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesignMetadata;
28
- (_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.1', 'beta');
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');
@@ -1,5 +1,8 @@
1
1
  var _window___canva___sdkRegistration, _window___canva__;
2
2
  const { canva_sdk } = window;
3
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
+ }
4
7
  export * from './public';
5
- (_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.1', 'beta');
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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canva/design",
3
- "version": "2.6.1-beta.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",
@@ -22,4 +22,4 @@
22
22
  }
23
23
  },
24
24
  "typings": "./beta.d.ts"
25
- }
25
+ }