@canva/design 2.4.1 → 2.6.0

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.
@@ -9,12 +9,44 @@ Object.defineProperty(exports, "FakeDesignInteractionClient", {
9
9
  }
10
10
  });
11
11
  class FakeDesignInteractionClient {
12
+ async getDesignTitle() {
13
+ await this.delay();
14
+ return 'title';
15
+ }
12
16
  async getDesignToken() {
13
17
  await this.delay();
14
18
  return {
15
19
  token: 'token'
16
20
  };
17
21
  }
22
+ async getDesignMetadata() {
23
+ await this.delay();
24
+ return {
25
+ title: 'title',
26
+ defaultPageDimensions: {
27
+ width: 800,
28
+ height: 600
29
+ },
30
+ pageMetadata: [
31
+ {
32
+ dimensions: {
33
+ width: 800,
34
+ height: 600
35
+ }
36
+ },
37
+ {
38
+ dimensions: {
39
+ width: 300,
40
+ height: 900
41
+ }
42
+ },
43
+ {
44
+ dimensions: undefined
45
+ }
46
+ ],
47
+ durationInSeconds: 30
48
+ };
49
+ }
18
50
  async addNativeElement(element) {
19
51
  await this.delay();
20
52
  }
@@ -80,15 +112,7 @@ class FakeDesignInteractionClient {
80
112
  });
81
113
  }
82
114
  async openDesign(options, callback) {
83
- await this.delay();
84
- await callback({
85
- page: fakePage,
86
- save: async ()=>{
87
- await this.delay();
88
- }
89
- }, {
90
- elementBuilder: fakeElementBuilder
91
- });
115
+ throw new Error('Not yet implemented');
92
116
  }
93
117
  constructor(delay){
94
118
  this.delay = delay;
@@ -136,82 +160,3 @@ const fakePageDimensions = {
136
160
  width: 800,
137
161
  height: 600
138
162
  };
139
- const fakeFill = {
140
- media: undefined,
141
- color: {
142
- type: 'solid',
143
- color: '#FFFFFF'
144
- }
145
- };
146
- const fakePage = {
147
- type: 'fixed',
148
- locked: false,
149
- dimensions: fakePageDimensions,
150
- background: fakeFill,
151
- elements: {
152
- count: ()=>0,
153
- toArray: ()=>[],
154
- insertBefore: (ref)=>ref,
155
- insertAfter: (ref)=>ref,
156
- forEach: (callback)=>{},
157
- filter: (filter)=>[],
158
- moveBefore: (item)=>{},
159
- moveAfter: (item)=>{},
160
- delete: (item)=>{}
161
- }
162
- };
163
- const fakeElement = {
164
- top: 0,
165
- left: 0,
166
- rotation: 0,
167
- transparency: 0,
168
- locked: true,
169
- width: 100,
170
- height: 100
171
- };
172
- const fakeRectElement = {
173
- ...fakeElement,
174
- type: 'rect',
175
- fill: fakeFill,
176
- stroke: {
177
- weight: 10,
178
- color: fakeFill.color
179
- }
180
- };
181
- const fakeShapeElement = {
182
- ...fakeElement,
183
- type: 'shape',
184
- viewBox: {
185
- top: 0,
186
- left: 0,
187
- width: 100,
188
- height: 100
189
- },
190
- paths: {
191
- count: ()=>0,
192
- toArray: ()=>[],
193
- forEach: (callback)=>{},
194
- filter: (filter)=>[]
195
- }
196
- };
197
- const fakeEmbedElement = {
198
- ...fakeElement,
199
- type: 'embed',
200
- url: 'https://canva.dev/docs/apps/testing/'
201
- };
202
- const fakeTextElement = {
203
- ...fakeElement,
204
- type: 'text',
205
- text: fakeRichtextRange
206
- };
207
- function cloneElement(element) {
208
- return fakeRectElement;
209
- }
210
- const fakeElementBuilder = {
211
- createRectElement: (opts)=>fakeRectElement,
212
- createShapeElement: (opts)=>fakeShapeElement,
213
- createEmbedElement: (opts)=>fakeEmbedElement,
214
- createTextElement: (opts)=>fakeTextElement,
215
- createRichtextRange: ()=>fakeRichtextRange,
216
- cloneElement
217
- };
@@ -17,4 +17,4 @@ function _export_star(from, to) {
17
17
  return from;
18
18
  }
19
19
  var _window___canva___sdkRegistration, _window___canva__;
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.4.0', 'ga');
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.6.0', 'ga');
@@ -5,56 +5,59 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- addAudioTrack: function() {
12
+ get addAudioTrack () {
13
13
  return addAudioTrack;
14
14
  },
15
- addElementAtCursor: function() {
15
+ get addElementAtCursor () {
16
16
  return addElementAtCursor;
17
17
  },
18
- addElementAtPoint: function() {
18
+ get addElementAtPoint () {
19
19
  return addElementAtPoint;
20
20
  },
21
- addNativeElement: function() {
21
+ get addNativeElement () {
22
22
  return addNativeElement;
23
23
  },
24
- addPage: function() {
24
+ get addPage () {
25
25
  return addPage;
26
26
  },
27
- createRichtextRange: function() {
27
+ get createRichtextRange () {
28
28
  return createRichtextRange;
29
29
  },
30
- editContent: function() {
30
+ get editContent () {
31
31
  return editContent;
32
32
  },
33
- getCurrentPageContext: function() {
33
+ get getCurrentPageContext () {
34
34
  return getCurrentPageContext;
35
35
  },
36
- getDefaultPageDimensions: function() {
36
+ get getDefaultPageDimensions () {
37
37
  return getDefaultPageDimensions;
38
38
  },
39
- getDesignToken: function() {
39
+ get getDesignToken () {
40
40
  return getDesignToken;
41
41
  },
42
- initAppElement: function() {
42
+ get initAppElement () {
43
43
  return initAppElement;
44
44
  },
45
- overlay: function() {
45
+ get openDesign () {
46
+ return openDesign;
47
+ },
48
+ get overlay () {
46
49
  return overlay;
47
50
  },
48
- requestExport: function() {
51
+ get requestExport () {
49
52
  return requestExport;
50
53
  },
51
- selection: function() {
54
+ get selection () {
52
55
  return selection;
53
56
  },
54
- setCurrentPageBackground: function() {
57
+ get setCurrentPageBackground () {
55
58
  return setCurrentPageBackground;
56
59
  },
57
- ui: function() {
60
+ get ui () {
58
61
  return ui;
59
62
  }
60
63
  });
@@ -75,3 +78,4 @@ const initAppElement = canva_sdk.design.v2.designInteraction.initAppElement;
75
78
  const getDesignToken = canva_sdk.design.v2.designInteraction.getDesignToken;
76
79
  const createRichtextRange = canva_sdk.design.v2.designInteraction.createRichtextRange;
77
80
  const editContent = canva_sdk.design.v2.designInteraction.editContent;
81
+ const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- assertIsTestCanvaSdk: function() {
12
+ get assertIsTestCanvaSdk () {
13
13
  return assertIsTestCanvaSdk;
14
14
  },
15
- bindMethodsToClients: function() {
15
+ get bindMethodsToClients () {
16
16
  return bindMethodsToClients;
17
17
  },
18
- getCanvaSdk: function() {
18
+ get getCanvaSdk () {
19
19
  return getCanvaSdk;
20
20
  },
21
- injectFakeAPIClients: function() {
21
+ get injectFakeAPIClients () {
22
22
  return injectFakeAPIClients;
23
23
  }
24
24
  });
@@ -1,10 +1,42 @@
1
1
  export class FakeDesignInteractionClient {
2
+ async getDesignTitle() {
3
+ await this.delay();
4
+ return 'title';
5
+ }
2
6
  async getDesignToken() {
3
7
  await this.delay();
4
8
  return {
5
9
  token: 'token'
6
10
  };
7
11
  }
12
+ async getDesignMetadata() {
13
+ await this.delay();
14
+ return {
15
+ title: 'title',
16
+ defaultPageDimensions: {
17
+ width: 800,
18
+ height: 600
19
+ },
20
+ pageMetadata: [
21
+ {
22
+ dimensions: {
23
+ width: 800,
24
+ height: 600
25
+ }
26
+ },
27
+ {
28
+ dimensions: {
29
+ width: 300,
30
+ height: 900
31
+ }
32
+ },
33
+ {
34
+ dimensions: undefined
35
+ }
36
+ ],
37
+ durationInSeconds: 30
38
+ };
39
+ }
8
40
  async addNativeElement(element) {
9
41
  await this.delay();
10
42
  }
@@ -70,15 +102,7 @@ export class FakeDesignInteractionClient {
70
102
  });
71
103
  }
72
104
  async openDesign(options, callback) {
73
- await this.delay();
74
- await callback({
75
- page: fakePage,
76
- save: async ()=>{
77
- await this.delay();
78
- }
79
- }, {
80
- elementBuilder: fakeElementBuilder
81
- });
105
+ throw new Error('Not yet implemented');
82
106
  }
83
107
  constructor(delay){
84
108
  this.delay = delay;
@@ -126,82 +150,3 @@ const fakePageDimensions = {
126
150
  width: 800,
127
151
  height: 600
128
152
  };
129
- const fakeFill = {
130
- media: undefined,
131
- color: {
132
- type: 'solid',
133
- color: '#FFFFFF'
134
- }
135
- };
136
- const fakePage = {
137
- type: 'fixed',
138
- locked: false,
139
- dimensions: fakePageDimensions,
140
- background: fakeFill,
141
- elements: {
142
- count: ()=>0,
143
- toArray: ()=>[],
144
- insertBefore: (ref)=>ref,
145
- insertAfter: (ref)=>ref,
146
- forEach: (callback)=>{},
147
- filter: (filter)=>[],
148
- moveBefore: (item)=>{},
149
- moveAfter: (item)=>{},
150
- delete: (item)=>{}
151
- }
152
- };
153
- const fakeElement = {
154
- top: 0,
155
- left: 0,
156
- rotation: 0,
157
- transparency: 0,
158
- locked: true,
159
- width: 100,
160
- height: 100
161
- };
162
- const fakeRectElement = {
163
- ...fakeElement,
164
- type: 'rect',
165
- fill: fakeFill,
166
- stroke: {
167
- weight: 10,
168
- color: fakeFill.color
169
- }
170
- };
171
- const fakeShapeElement = {
172
- ...fakeElement,
173
- type: 'shape',
174
- viewBox: {
175
- top: 0,
176
- left: 0,
177
- width: 100,
178
- height: 100
179
- },
180
- paths: {
181
- count: ()=>0,
182
- toArray: ()=>[],
183
- forEach: (callback)=>{},
184
- filter: (filter)=>[]
185
- }
186
- };
187
- const fakeEmbedElement = {
188
- ...fakeElement,
189
- type: 'embed',
190
- url: 'https://canva.dev/docs/apps/testing/'
191
- };
192
- const fakeTextElement = {
193
- ...fakeElement,
194
- type: 'text',
195
- text: fakeRichtextRange
196
- };
197
- function cloneElement(element) {
198
- return fakeRectElement;
199
- }
200
- const fakeElementBuilder = {
201
- createRectElement: (opts)=>fakeRectElement,
202
- createShapeElement: (opts)=>fakeShapeElement,
203
- createEmbedElement: (opts)=>fakeEmbedElement,
204
- createTextElement: (opts)=>fakeTextElement,
205
- createRichtextRange: ()=>fakeRichtextRange,
206
- cloneElement
207
- };
@@ -1,3 +1,3 @@
1
1
  var _window___canva___sdkRegistration, _window___canva__;
2
2
  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.4.0', 'ga');
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.0', 'ga');
@@ -15,3 +15,4 @@ export const initAppElement = canva_sdk.design.v2.designInteraction.initAppEleme
15
15
  export const getDesignToken = canva_sdk.design.v2.designInteraction.getDesignToken;
16
16
  export const createRichtextRange = canva_sdk.design.v2.designInteraction.createRichtextRange;
17
17
  export const editContent = canva_sdk.design.v2.designInteraction.editContent;
18
+ export const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canva/design",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
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": "./index.d.ts"
25
- }
25
+ }