@pie-element/drawing-response 3.9.8 → 3.9.10-beta.1443

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +381 -0
  2. package/configure/CHANGELOG.md +363 -0
  3. package/configure/lib/button.js.map +1 -1
  4. package/configure/lib/defaults.js +21 -2
  5. package/configure/lib/defaults.js.map +1 -1
  6. package/configure/lib/image-container.js +37 -21
  7. package/configure/lib/image-container.js.map +1 -1
  8. package/configure/lib/index.js +64 -11
  9. package/configure/lib/index.js.map +1 -1
  10. package/configure/lib/root.js +65 -30
  11. package/configure/lib/root.js.map +1 -1
  12. package/configure/package.json +4 -4
  13. package/configure/src/__tests__/__snapshots__/image-container.test.jsx.snap +3 -2
  14. package/configure/src/__tests__/__snapshots__/root.test.jsx.snap +34 -14
  15. package/configure/src/__tests__/image-container.test.jsx +42 -35
  16. package/configure/src/__tests__/index.test.js +7 -7
  17. package/configure/src/__tests__/root.test.jsx +18 -18
  18. package/configure/src/button.jsx +4 -4
  19. package/configure/src/defaults.js +24 -5
  20. package/configure/src/image-container.jsx +80 -59
  21. package/configure/src/index.js +46 -14
  22. package/configure/src/root.jsx +71 -63
  23. package/controller/CHANGELOG.md +20 -0
  24. package/controller/lib/defaults.js.map +1 -1
  25. package/controller/lib/index.js +13 -7
  26. package/controller/lib/index.js.map +1 -1
  27. package/controller/package.json +1 -1
  28. package/controller/src/__tests__/index.test.js +29 -19
  29. package/controller/src/defaults.js +2 -2
  30. package/controller/src/index.js +13 -14
  31. package/docs/config-schema.json +126 -0
  32. package/docs/config-schema.json.md +97 -1
  33. package/docs/demo/config.js +2 -2
  34. package/docs/demo/generate.js +4 -2
  35. package/docs/demo/session.js +4 -4
  36. package/docs/pie-schema.json +60 -0
  37. package/docs/pie-schema.json.md +44 -0
  38. package/lib/drawing-response/button.js.map +1 -1
  39. package/lib/drawing-response/constants.js.map +1 -1
  40. package/lib/drawing-response/container.js +73 -22
  41. package/lib/drawing-response/container.js.map +1 -1
  42. package/lib/drawing-response/drawable-image.js +1 -0
  43. package/lib/drawing-response/drawable-image.js.map +1 -1
  44. package/lib/drawing-response/drawable-main.js +45 -15
  45. package/lib/drawing-response/drawable-main.js.map +1 -1
  46. package/lib/drawing-response/drawable-palette.js +6 -1
  47. package/lib/drawing-response/drawable-palette.js.map +1 -1
  48. package/lib/drawing-response/drawable-text.js +15 -5
  49. package/lib/drawing-response/drawable-text.js.map +1 -1
  50. package/lib/drawing-response/drawable-transformer.js.map +1 -1
  51. package/lib/drawing-response/factory.js.map +1 -1
  52. package/lib/drawing-response/icon.js.map +1 -1
  53. package/lib/drawing-response/index.js +3 -0
  54. package/lib/drawing-response/index.js.map +1 -1
  55. package/lib/index.js +3 -0
  56. package/lib/index.js.map +1 -1
  57. package/package.json +4 -4
  58. package/src/__tests__/drawing-index-test.jsx +4 -4
  59. package/src/drawing-response/__tests__/__snapshots__/container.test.jsx.snap +174 -290
  60. package/src/drawing-response/__tests__/__snapshots__/drawing-main.test.jsx.snap +26 -2
  61. package/src/drawing-response/__tests__/container.test.jsx +9 -2
  62. package/src/drawing-response/__tests__/drawable-helper.test.jsx +1 -1
  63. package/src/drawing-response/__tests__/drawing-main.test.jsx +74 -86
  64. package/src/drawing-response/button.jsx +5 -8
  65. package/src/drawing-response/constants.js +42 -34
  66. package/src/drawing-response/container.jsx +93 -70
  67. package/src/drawing-response/drawable-image.jsx +5 -4
  68. package/src/drawing-response/drawable-main.jsx +46 -17
  69. package/src/drawing-response/drawable-palette.jsx +18 -35
  70. package/src/drawing-response/drawable-text.jsx +34 -48
  71. package/src/drawing-response/drawable-transformer.jsx +3 -1
  72. package/src/drawing-response/factory.js +3 -11
  73. package/src/drawing-response/icon.jsx +19 -20
  74. package/src/drawing-response/index.jsx +9 -15
  75. package/src/index.js +8 -11
@@ -11,11 +11,11 @@ exports[`Container snapshot renders 1`] = `
11
11
  "value": "transparent",
12
12
  },
13
13
  Object {
14
- "label": "lightblue",
14
+ "label": "light blue",
15
15
  "value": "lightblue",
16
16
  },
17
17
  Object {
18
- "label": "lightyellow",
18
+ "label": "light yellow",
19
19
  "value": "lightyellow",
20
20
  },
21
21
  Object {
@@ -132,87 +132,92 @@ exports[`Container snapshot renders 1`] = `
132
132
  />
133
133
  <div>
134
134
  <div>
135
- <div>
136
- <WithStyles(RawButton)
137
- disabled={true}
138
- key="Select"
139
- label={
140
- <IconWrapper
141
- path="mdiCursorDefault"
142
- />
143
- }
144
- onClick={[Function]}
145
- title="Select"
146
- />
147
- <WithStyles(RawButton)
148
- disabled={false}
149
- key="FreePathDrawable"
150
- label={
151
- <IconWrapper
152
- path="mdiPencil"
153
- />
154
- }
155
- onClick={[Function]}
156
- title="Free Draw"
157
- />
158
- <WithStyles(RawButton)
159
- disabled={false}
160
- key="LineDrawable"
161
- label={
162
- <IconWrapper
163
- path="mdiMinus"
164
- />
165
- }
166
- onClick={[Function]}
167
- title="Line"
168
- />
169
- <WithStyles(RawButton)
170
- disabled={false}
171
- key="RectangleDrawable"
172
- label={
173
- <IconWrapper
174
- path="mdiRectangle"
175
- />
176
- }
177
- onClick={[Function]}
178
- title="Rectangle"
179
- />
180
- <WithStyles(RawButton)
181
- disabled={false}
182
- key="CircleDrawable"
183
- label={
184
- <IconWrapper
185
- path="mdiCircle"
186
- />
187
- }
188
- onClick={[Function]}
189
- title="Circle"
190
- />
191
- <WithStyles(RawButton)
192
- disabled={false}
193
- key="Text"
194
- label={
195
- <IconWrapper
196
- path="mdiFormatColorText"
197
- />
198
- }
199
- onClick={[Function]}
200
- title="Text Entry"
201
- />
202
- <WithStyles(RawButton)
203
- disabled={false}
204
- key="EraserDrawable"
205
- label={
206
- <IconWrapper
207
- path="mdiEraser"
208
- />
209
- }
210
- onClick={[Function]}
211
- title="Eraser"
212
- />
213
- </div>
135
+ <WithStyles(RawButton)
136
+ disabled={true}
137
+ key="Select"
138
+ label={
139
+ <IconWrapper
140
+ path="mdiCursorDefault"
141
+ />
142
+ }
143
+ onClick={[Function]}
144
+ title="Select"
145
+ />
146
+ <WithStyles(RawButton)
147
+ disabled={false}
148
+ key="FreePathDrawable"
149
+ label={
150
+ <IconWrapper
151
+ path="mdiPencil"
152
+ />
153
+ }
154
+ onClick={[Function]}
155
+ title="Free Draw"
156
+ />
157
+ <WithStyles(RawButton)
158
+ disabled={false}
159
+ key="LineDrawable"
160
+ label={
161
+ <IconWrapper
162
+ path="mdiMinus"
163
+ />
164
+ }
165
+ onClick={[Function]}
166
+ title="Line"
167
+ />
168
+ <WithStyles(RawButton)
169
+ disabled={false}
170
+ key="RectangleDrawable"
171
+ label={
172
+ <IconWrapper
173
+ path="mdiRectangle"
174
+ />
175
+ }
176
+ onClick={[Function]}
177
+ title="Rectangle"
178
+ />
179
+ <WithStyles(RawButton)
180
+ disabled={false}
181
+ key="CircleDrawable"
182
+ label={
183
+ <IconWrapper
184
+ path="mdiCircle"
185
+ />
186
+ }
187
+ onClick={[Function]}
188
+ title="Circle"
189
+ />
190
+ <WithStyles(RawButton)
191
+ disabled={false}
192
+ key="Text"
193
+ label={
194
+ <IconWrapper
195
+ path="mdiFormatColorText"
196
+ />
197
+ }
198
+ onClick={[Function]}
199
+ title="Text Entry"
200
+ />
201
+ <WithStyles(RawButton)
202
+ disabled={false}
203
+ key="EraserDrawable"
204
+ label={
205
+ <IconWrapper
206
+ path="mdiEraser"
207
+ />
208
+ }
209
+ onClick={[Function]}
210
+ title="Eraser"
211
+ />
214
212
  </div>
215
- <div>
213
+ <div
214
+ style={
215
+ Object {
216
+ "height": 0,
217
+ "maxHeight": 0,
218
+ }
219
+ }
220
+ >
216
221
  <WithStyles(DrawableMain)
217
222
  TextEntry={
218
223
  TextDrawable {
@@ -240,6 +245,7 @@ exports[`Container snapshot renders 1`] = `
240
245
  onSessionChange={[MockFunction]}
241
246
  outlineColor="black"
242
247
  paintColor="red"
248
+ scale={1}
243
249
  session={Object {}}
244
250
  toolActive={
245
251
  Object {
@@ -256,217 +262,94 @@ exports[`Container snapshot renders 1`] = `
256
262
 
257
263
  exports[`Container snapshot renders disabled 1`] = `
258
264
  <div>
259
- <WithStyles(Palette)
260
- fillColor="white"
261
- fillList={
262
- Array [
263
- Object {
264
- "label": "no fill",
265
- "value": "transparent",
266
- },
267
- Object {
268
- "label": "lightblue",
269
- "value": "lightblue",
270
- },
271
- Object {
272
- "label": "lightyellow",
273
- "value": "lightyellow",
274
- },
275
- Object {
276
- "label": "red",
277
- "value": "red",
278
- },
279
- Object {
280
- "label": "orange",
281
- "value": "orange",
282
- },
283
- Object {
284
- "label": "yellow",
285
- "value": "yellow",
286
- },
287
- Object {
288
- "label": "violet",
289
- "value": "violet",
290
- },
291
- Object {
292
- "label": "blue",
293
- "value": "blue",
294
- },
295
- Object {
296
- "label": "green",
297
- "value": "green",
298
- },
299
- Object {
300
- "label": "white",
301
- "value": "white",
302
- },
303
- Object {
304
- "label": "black",
305
- "value": "black",
306
- },
307
- ]
308
- }
309
- onFillColorChange={[Function]}
310
- onOutlineColorChange={[Function]}
311
- onPaintColorChange={[Function]}
312
- outlineColor="black"
313
- outlineList={
314
- Array [
315
- Object {
316
- "label": "red",
317
- "value": "red",
318
- },
319
- Object {
320
- "label": "orange",
321
- "value": "orange",
322
- },
323
- Object {
324
- "label": "yellow",
325
- "value": "yellow",
326
- },
327
- Object {
328
- "label": "violet",
329
- "value": "violet",
330
- },
331
- Object {
332
- "label": "blue",
333
- "value": "blue",
334
- },
335
- Object {
336
- "label": "green",
337
- "value": "green",
338
- },
339
- Object {
340
- "label": "white",
341
- "value": "white",
342
- },
343
- Object {
344
- "label": "black",
345
- "value": "black",
346
- },
347
- ]
348
- }
349
- paintColor="red"
350
- paintList={
351
- Array [
352
- Object {
353
- "label": "red",
354
- "value": "red",
355
- },
356
- Object {
357
- "label": "orange",
358
- "value": "orange",
359
- },
360
- Object {
361
- "label": "yellow",
362
- "value": "yellow",
363
- },
364
- Object {
365
- "label": "violet",
366
- "value": "violet",
367
- },
368
- Object {
369
- "label": "blue",
370
- "value": "blue",
371
- },
372
- Object {
373
- "label": "green",
374
- "value": "green",
375
- },
376
- Object {
377
- "label": "white",
378
- "value": "white",
379
- },
380
- Object {
381
- "label": "black",
382
- "value": "black",
383
- },
384
- ]
385
- }
386
- />
387
265
  <div>
388
266
  <div>
389
- <div>
390
- <WithStyles(RawButton)
391
- disabled={true}
392
- key="Select"
393
- label={
394
- <IconWrapper
395
- path="mdiCursorDefault"
396
- />
397
- }
398
- onClick={[Function]}
399
- title="Select"
400
- />
401
- <WithStyles(RawButton)
402
- disabled={true}
403
- key="FreePathDrawable"
404
- label={
405
- <IconWrapper
406
- path="mdiPencil"
407
- />
408
- }
409
- onClick={[Function]}
410
- title="Free Draw"
411
- />
412
- <WithStyles(RawButton)
413
- disabled={true}
414
- key="LineDrawable"
415
- label={
416
- <IconWrapper
417
- path="mdiMinus"
418
- />
419
- }
420
- onClick={[Function]}
421
- title="Line"
422
- />
423
- <WithStyles(RawButton)
424
- disabled={true}
425
- key="RectangleDrawable"
426
- label={
427
- <IconWrapper
428
- path="mdiRectangle"
429
- />
430
- }
431
- onClick={[Function]}
432
- title="Rectangle"
433
- />
434
- <WithStyles(RawButton)
435
- disabled={true}
436
- key="CircleDrawable"
437
- label={
438
- <IconWrapper
439
- path="mdiCircle"
440
- />
441
- }
442
- onClick={[Function]}
443
- title="Circle"
444
- />
445
- <WithStyles(RawButton)
446
- disabled={true}
447
- key="Text"
448
- label={
449
- <IconWrapper
450
- path="mdiFormatColorText"
451
- />
452
- }
453
- onClick={[Function]}
454
- title="Text Entry"
455
- />
456
- <WithStyles(RawButton)
457
- disabled={true}
458
- key="EraserDrawable"
459
- label={
460
- <IconWrapper
461
- path="mdiEraser"
462
- />
463
- }
464
- onClick={[Function]}
465
- title="Eraser"
466
- />
467
- </div>
267
+ <WithStyles(RawButton)
268
+ disabled={true}
269
+ key="Select"
270
+ label={
271
+ <IconWrapper
272
+ path="mdiCursorDefault"
273
+ />
274
+ }
275
+ onClick={[Function]}
276
+ title="Select"
277
+ />
278
+ <WithStyles(RawButton)
279
+ disabled={true}
280
+ key="FreePathDrawable"
281
+ label={
282
+ <IconWrapper
283
+ path="mdiPencil"
284
+ />
285
+ }
286
+ onClick={[Function]}
287
+ title="Free Draw"
288
+ />
289
+ <WithStyles(RawButton)
290
+ disabled={true}
291
+ key="LineDrawable"
292
+ label={
293
+ <IconWrapper
294
+ path="mdiMinus"
295
+ />
296
+ }
297
+ onClick={[Function]}
298
+ title="Line"
299
+ />
300
+ <WithStyles(RawButton)
301
+ disabled={true}
302
+ key="RectangleDrawable"
303
+ label={
304
+ <IconWrapper
305
+ path="mdiRectangle"
306
+ />
307
+ }
308
+ onClick={[Function]}
309
+ title="Rectangle"
310
+ />
311
+ <WithStyles(RawButton)
312
+ disabled={true}
313
+ key="CircleDrawable"
314
+ label={
315
+ <IconWrapper
316
+ path="mdiCircle"
317
+ />
318
+ }
319
+ onClick={[Function]}
320
+ title="Circle"
321
+ />
322
+ <WithStyles(RawButton)
323
+ disabled={true}
324
+ key="Text"
325
+ label={
326
+ <IconWrapper
327
+ path="mdiFormatColorText"
328
+ />
329
+ }
330
+ onClick={[Function]}
331
+ title="Text Entry"
332
+ />
333
+ <WithStyles(RawButton)
334
+ disabled={true}
335
+ key="EraserDrawable"
336
+ label={
337
+ <IconWrapper
338
+ path="mdiEraser"
339
+ />
340
+ }
341
+ onClick={[Function]}
342
+ title="Eraser"
343
+ />
468
344
  </div>
469
- <div>
345
+ <div
346
+ style={
347
+ Object {
348
+ "height": 0,
349
+ "maxHeight": 0,
350
+ }
351
+ }
352
+ >
470
353
  <WithStyles(DrawableMain)
471
354
  TextEntry={
472
355
  TextDrawable {
@@ -495,6 +378,7 @@ exports[`Container snapshot renders disabled 1`] = `
495
378
  onSessionChange={[MockFunction]}
496
379
  outlineColor="black"
497
380
  paintColor="red"
381
+ scale={1}
498
382
  session={Object {}}
499
383
  toolActive={
500
384
  Object {
@@ -26,7 +26,12 @@ exports[`DrawingResponse DrawableMain snapshot renders 1`] = `
26
26
  </div>
27
27
  <div>
28
28
  <WithStyles(DrawableImage)
29
- dimensions={Object {}}
29
+ dimensions={
30
+ Object {
31
+ "height": NaN,
32
+ "width": NaN,
33
+ }
34
+ }
30
35
  url="url"
31
36
  />
32
37
  <ForwardRef
@@ -34,6 +39,8 @@ exports[`DrawingResponse DrawableMain snapshot renders 1`] = `
34
39
  height={350}
35
40
  onMouseMove={[Function]}
36
41
  onMouseUp={[Function]}
42
+ onTouchEnd={[Function]}
43
+ onTouchMove={[Function]}
37
44
  width={353}
38
45
  >
39
46
  <Layer />
@@ -58,7 +65,12 @@ exports[`DrawingResponse DrawableMain snapshot renders disabled 1`] = `
58
65
  </div>
59
66
  <div>
60
67
  <WithStyles(DrawableImage)
61
- dimensions={Object {}}
68
+ dimensions={
69
+ Object {
70
+ "height": NaN,
71
+ "width": NaN,
72
+ }
73
+ }
62
74
  url="url"
63
75
  />
64
76
  <ForwardRef
@@ -83,9 +95,13 @@ exports[`DrawingResponse DrawableText snapshot renders 1`] = `
83
95
  name="text_gcifqhhimf8k2d6g8hs"
84
96
  onClick={[Function]}
85
97
  onDblClick={[Function]}
98
+ onDblTap={[Function]}
86
99
  onDragEnd={[MockFunction]}
87
100
  onMouseDown={[Function]}
88
101
  onMouseUp={[Function]}
102
+ onTap={[Function]}
103
+ onTouchEnd={[Function]}
104
+ onTouchStart={[Function]}
89
105
  onTransform={[Function]}
90
106
  onTransformEnd={[MockFunction]}
91
107
  text="Double click to edit this text. Press Enter to submit."
@@ -98,6 +114,8 @@ exports[`DrawingResponse DrawableText snapshot renders 1`] = `
98
114
  key="transformer_gcifqhhimf8k2d6g8hs"
99
115
  onMouseDown={[Function]}
100
116
  onMouseUp={[Function]}
117
+ onTouchEnd={[Function]}
118
+ onTouchStart={[Function]}
101
119
  selectedShapeName="text_gcifqhhimf8k2d6g8hs"
102
120
  />
103
121
  </div>
@@ -127,9 +145,13 @@ exports[`DrawingResponse DrawableText snapshot when there is no value renders 1`
127
145
  name="text_gcifqhhimf8k2d6g8hs"
128
146
  onClick={[Function]}
129
147
  onDblClick={[Function]}
148
+ onDblTap={[Function]}
130
149
  onDragEnd={[MockFunction]}
131
150
  onMouseDown={[Function]}
132
151
  onMouseUp={[Function]}
152
+ onTap={[Function]}
153
+ onTouchEnd={[Function]}
154
+ onTouchStart={[Function]}
133
155
  onTransform={[Function]}
134
156
  onTransformEnd={[MockFunction]}
135
157
  text="Double click to edit this text. Press Enter to submit."
@@ -142,6 +164,8 @@ exports[`DrawingResponse DrawableText snapshot when there is no value renders 1`
142
164
  key="transformer_gcifqhhimf8k2d6g8hs"
143
165
  onMouseDown={[Function]}
144
166
  onMouseUp={[Function]}
167
+ onTouchEnd={[Function]}
168
+ onTouchStart={[Function]}
145
169
  selectedShapeName="text_gcifqhhimf8k2d6g8hs"
146
170
  />
147
171
  </div>
@@ -1,5 +1,12 @@
1
1
  import { shallow } from 'enzyme';
2
2
  import React from 'react';
3
+
4
+ global.MutationObserver = class {
5
+ constructor(callback) {}
6
+ disconnect() {}
7
+ observe(element, initObject) {}
8
+ };
9
+
3
10
  import { Container } from '../container';
4
11
 
5
12
  beforeEach(() => {
@@ -15,12 +22,12 @@ describe('Container', () => {
15
22
  onSessionChange,
16
23
  imageDimensions: {},
17
24
  imageUrl: 'url',
18
- session: {}
25
+ session: {},
19
26
  };
20
27
  const props = { ...defaults, ...extras };
21
28
  return shallow(<Container {...props} />, {
22
29
  disableLifecycleMethods: false,
23
- ...renderOpts
30
+ ...renderOpts,
24
31
  });
25
32
  };
26
33
 
@@ -17,7 +17,7 @@ describe('DrawableHelper', () => {
17
17
 
18
18
  expect(o).toEqual({
19
19
  type: 'FOO_TYPE',
20
- foo: 'bar'
20
+ foo: 'bar',
21
21
  });
22
22
  });
23
23
  });