nzk-react-components 0.4.2 → 0.4.5

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 (96) hide show
  1. package/dist/assets/icons/bear.svg +177 -0
  2. package/dist/assets/icons/bear.svg.js +606 -0
  3. package/dist/assets/icons/bear.svg.js.map +1 -0
  4. package/dist/assets/icons/flamingo.svg +85 -0
  5. package/dist/assets/icons/flamingo.svg.js +287 -0
  6. package/dist/assets/icons/flamingo.svg.js.map +1 -0
  7. package/dist/assets/icons/giraffe.svg +259 -0
  8. package/dist/assets/icons/giraffe.svg.js +756 -0
  9. package/dist/assets/icons/giraffe.svg.js.map +1 -0
  10. package/dist/assets/icons/penguin.svg +231 -0
  11. package/dist/assets/icons/penguin.svg.js +718 -0
  12. package/dist/assets/icons/penguin.svg.js.map +1 -0
  13. package/dist/assets/icons/sealion.svg +156 -0
  14. package/dist/assets/icons/sealion.svg.js +649 -0
  15. package/dist/assets/icons/sealion.svg.js.map +1 -0
  16. package/dist/components/DrawingTool/DrawingTool.d.ts +29 -0
  17. package/dist/components/DrawingTool/DrawingTool.js +277 -0
  18. package/dist/components/DrawingTool/DrawingTool.js.map +1 -0
  19. package/dist/components/DrawingTool/DrawingTool.stories.d.ts +6 -0
  20. package/dist/components/DrawingTool/DrawingTool.styles.d.ts +41 -0
  21. package/dist/components/DrawingTool/DrawingTool.styles.js +54 -0
  22. package/dist/components/DrawingTool/DrawingTool.styles.js.map +1 -0
  23. package/dist/components/DrawingTool/DrawingToolProvider.d.ts +56 -0
  24. package/dist/components/DrawingTool/DrawingToolProvider.js +182 -0
  25. package/dist/components/DrawingTool/DrawingToolProvider.js.map +1 -0
  26. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.d.ts +21 -0
  27. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.js +89 -0
  28. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.js.map +1 -0
  29. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.d.ts +9 -0
  30. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.js +18 -0
  31. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.js.map +1 -0
  32. package/dist/components/DrawingTool/components/ColourToolbar/index.d.ts +2 -0
  33. package/dist/components/DrawingTool/components/ColourToolbar/index.js +8 -0
  34. package/dist/components/DrawingTool/components/ColourToolbar/index.js.map +1 -0
  35. package/dist/components/DrawingTool/components/FileInput/FileInput.d.ts +9 -0
  36. package/dist/components/DrawingTool/components/FileInput/FileInput.js +88 -0
  37. package/dist/components/DrawingTool/components/FileInput/FileInput.js.map +1 -0
  38. package/dist/components/DrawingTool/components/FileInput/FileInput.styles.d.ts +4 -0
  39. package/dist/components/DrawingTool/components/FileInput/FileInput.styles.js +22 -0
  40. package/dist/components/DrawingTool/components/FileInput/FileInput.styles.js.map +1 -0
  41. package/dist/components/DrawingTool/components/FileInput/index.d.ts +2 -0
  42. package/dist/components/DrawingTool/components/FileInput/index.js +8 -0
  43. package/dist/components/DrawingTool/components/FileInput/index.js.map +1 -0
  44. package/dist/components/DrawingTool/components/Header/Header.d.ts +9 -0
  45. package/dist/components/DrawingTool/components/Header/Header.js +38 -0
  46. package/dist/components/DrawingTool/components/Header/Header.js.map +1 -0
  47. package/dist/components/DrawingTool/components/Header/index.d.ts +2 -0
  48. package/dist/components/DrawingTool/components/Header/index.js +8 -0
  49. package/dist/components/DrawingTool/components/Header/index.js.map +1 -0
  50. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.d.ts +8 -0
  51. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.js +31 -0
  52. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.js.map +1 -0
  53. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.d.ts +9 -0
  54. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.js +18 -0
  55. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.js.map +1 -0
  56. package/dist/components/DrawingTool/components/OpacityToggle/index.d.ts +2 -0
  57. package/dist/components/DrawingTool/components/OpacityToggle/index.js +8 -0
  58. package/dist/components/DrawingTool/components/OpacityToggle/index.js.map +1 -0
  59. package/dist/components/DrawingTool/components/Placeable/index.d.ts +9 -0
  60. package/dist/components/DrawingTool/components/Placeable/index.js +22 -0
  61. package/dist/components/DrawingTool/components/Placeable/index.js.map +1 -0
  62. package/dist/components/DrawingTool/index.d.ts +2 -0
  63. package/dist/components/DrawingTool/lib/Sketch.d.ts +90 -0
  64. package/dist/components/DrawingTool/lib/Sketch.js +414 -0
  65. package/dist/components/DrawingTool/lib/Sketch.js.map +1 -0
  66. package/dist/components/DrawingTool/lib/SketchCut.d.ts +22 -0
  67. package/dist/components/DrawingTool/lib/SketchCut.js +98 -0
  68. package/dist/components/DrawingTool/lib/SketchCut.js.map +1 -0
  69. package/dist/components/DrawingTool/lib/SketchCutModel.d.ts +6 -0
  70. package/dist/components/DrawingTool/lib/SketchCutModel.js +20 -0
  71. package/dist/components/DrawingTool/lib/SketchCutModel.js.map +1 -0
  72. package/dist/components/DrawingTool/lib/SketchLayer.d.ts +27 -0
  73. package/dist/components/DrawingTool/lib/SketchLayer.js +59 -0
  74. package/dist/components/DrawingTool/lib/SketchLayer.js.map +1 -0
  75. package/dist/components/DrawingTool/lib/SketchModel.d.ts +65 -0
  76. package/dist/components/DrawingTool/lib/SketchModel.js +137 -0
  77. package/dist/components/DrawingTool/lib/SketchModel.js.map +1 -0
  78. package/dist/components/DrawingTool/lib/SketchStrokeModel.d.ts +33 -0
  79. package/dist/components/DrawingTool/lib/SketchStrokeModel.js +48 -0
  80. package/dist/components/DrawingTool/lib/SketchStrokeModel.js.map +1 -0
  81. package/dist/components/DrawingTool/lib/createInteractionSurface.d.ts +16 -0
  82. package/dist/components/DrawingTool/lib/createInteractionSurface.js +56 -0
  83. package/dist/components/DrawingTool/lib/createInteractionSurface.js.map +1 -0
  84. package/dist/components/DrawingTool/lib/trace.d.ts +3 -0
  85. package/dist/components/DrawingTool/lib/trace.js +24 -0
  86. package/dist/components/DrawingTool/lib/trace.js.map +1 -0
  87. package/dist/components/DrawingTool/lib/trimCanvas.d.ts +2 -0
  88. package/dist/components/DrawingTool/lib/trimCanvas.js +42 -0
  89. package/dist/components/DrawingTool/lib/trimCanvas.js.map +1 -0
  90. package/dist/components/Icon/icons.d.ts +5 -0
  91. package/dist/components/Icon/icons.js +10 -0
  92. package/dist/components/Icon/icons.js.map +1 -1
  93. package/dist/hooks/useCloudinary/index.d.ts +1 -1
  94. package/dist/hooks/useCloudinary/index.js +8 -9
  95. package/dist/hooks/useCloudinary/index.js.map +1 -1
  96. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trimCanvas.js","sources":["../../../../src/components/DrawingTool/lib/trimCanvas.js"],"sourcesContent":["const rowBlank = (imageData, width, y) => {\n for (let x = 0; x < width; x+=1) {\n if (imageData.data[y * width * 4 + x * 4 + 3] !== 0) return false\n }\n return true\n}\n\nconst columnBlank = (imageData, width, x, top, bottom) => {\n for (let y = top; y < bottom; y+=1) {\n if (imageData.data[y * width * 4 + x * 4 + 3] !== 0) return false\n }\n return true\n}\n\nexport default (canvas) => {\n const ctx = canvas.getContext(\"2d\")\n\n const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height)\n let top = 0\n let bottom = imageData.height\n let left = 0\n let right = imageData.width\n\n while (top < bottom && rowBlank(imageData, canvas.width, top)) top+=1\n while (bottom - 1 > top && rowBlank(imageData, canvas.width, bottom - 1)) bottom-=1\n while (left < right && columnBlank(imageData, canvas.width, left, top, bottom)) left+=1\n while (right - 1 > left && columnBlank(imageData, canvas.width, right - 1, top, bottom)) right-=1\n\n const trimmed = ctx.getImageData(left, top, right - left, bottom - top)\n const copy = canvas.ownerDocument.createElement(\"canvas\")\n const copyCtx = copy.getContext(\"2d\")\n copy.width = trimmed.width\n copy.height = trimmed.height\n copyCtx.putImageData(trimmed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CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,EAAC;AACvE,EAAE,OAAO,MAAM,GAAG,CAAC,GAAG,GAAG,IAAI,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAC;AACrF,EAAE,OAAO,IAAI,GAAG,KAAK,IAAI,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,EAAC;AACzF,EAAE,OAAO,KAAK,GAAG,CAAC,GAAG,IAAI,IAAI,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,EAAC;AACnG;AACA,EAAE,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,GAAG,EAAC;AACzE,EAAE,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAC;AAC3D,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAC;AACvC,EAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,MAAK;AAC5B,EAAE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,OAAM;AAC9B,EAAE,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAC;AACrC;AACA,EAAE,OAAO,IAAI;AACb;;;;"}
@@ -122,5 +122,10 @@ export declare const ICONS: {
122
122
  'drawing-tool-sticker': JSX.Element;
123
123
  'idea-creator': JSX.Element;
124
124
  send: JSX.Element;
125
+ giraffe: JSX.Element;
126
+ penguin: JSX.Element;
127
+ flamingo: JSX.Element;
128
+ bear: JSX.Element;
129
+ sealion: JSX.Element;
125
130
  };
126
131
  export default ICONS;
@@ -125,6 +125,11 @@ var writingTypePoem = require('../../assets/icons/writing-type-poem.svg.js');
125
125
  var writingTypeReport = require('../../assets/icons/writing-type-report.svg.js');
126
126
  var writing = require('../../assets/icons/writing.svg.js');
127
127
  var zooPoint = require('../../assets/icons/zoo-point.svg.js');
128
+ var giraffe = require('../../assets/icons/giraffe.svg.js');
129
+ var penguin = require('../../assets/icons/penguin.svg.js');
130
+ var flamingo = require('../../assets/icons/flamingo.svg.js');
131
+ var bear = require('../../assets/icons/bear.svg.js');
132
+ var sealion = require('../../assets/icons/sealion.svg.js');
128
133
 
129
134
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
130
135
 
@@ -253,6 +258,11 @@ var ICONS = {
253
258
  'drawing-tool-sticker': React__default['default'].createElement(drawingToolStickers, null),
254
259
  'idea-creator': React__default['default'].createElement(ideaCreator, null),
255
260
  'send': React__default['default'].createElement(send, null),
261
+ 'giraffe': React__default['default'].createElement(giraffe, null),
262
+ 'penguin': React__default['default'].createElement(penguin, null),
263
+ 'flamingo': React__default['default'].createElement(flamingo, null),
264
+ 'bear': React__default['default'].createElement(bear, null),
265
+ 'sealion': React__default['default'].createElement(sealion, null)
256
266
  };
257
267
 
258
268
  exports.ICONS = ICONS;
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"icons.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -5,6 +5,6 @@ export interface Props {
5
5
  }
6
6
  declare const useCloudinary: (props?: Props | undefined) => {
7
7
  uploadImage: (file: Blob | string, onComplete?: ((imageUrl: string) => void) | undefined) => void;
8
- promiseUploadImage: (file: Blob | string) => Promise<unknown>;
8
+ promiseUploadImage: (file: Blob | string) => Promise<string>;
9
9
  };
10
10
  export default useCloudinary;
@@ -44,23 +44,22 @@ var useCloudinary = function (props) {
44
44
  var xhr = new XMLHttpRequest();
45
45
  var fd = new FormData();
46
46
  xhr.addEventListener('error', function () {
47
- reject(new Error("Couldn't reach cloudinary to upload image"));
47
+ return reject(new Error("Couldn't reach cloudinary to upload image"));
48
48
  });
49
49
  xhr.open('POST', url, true);
50
50
  xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
51
51
  xhr.onreadystatechange = function () {
52
- if (xhr.readyState === 4 && xhr.status < 300) {
52
+ if (xhr.readyState === 4 && xhr.status >= 200 && xhr.status < 300) {
53
53
  var response = JSON.parse(xhr.responseText);
54
- if (response.secure_url) {
55
- resolve(response.secure_url);
56
- }
57
- else {
58
- reject(new Error("No secure_url returned by cloudinary"));
54
+ if (!response.secure_url) {
55
+ return reject(new Error("No secure_url returned by cloudinary"));
59
56
  }
57
+ return resolve(response.secure_url);
60
58
  }
61
- else if (xhr.readyState === 4 && xhr.status >= 300) {
62
- reject(new Error("Cloudinary returned error code: " + xhr.status));
59
+ if (xhr.readyState === 4 && xhr.status >= 300) {
60
+ return reject(new Error("Cloudinary returned error code: " + xhr.status));
63
61
  }
62
+ return null;
64
63
  };
65
64
  fd.append('upload_preset', unsignedUploadPreset);
66
65
  if (uploadTag)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nzk-react-components",
3
- "version": "0.4.2",
3
+ "version": "0.4.5",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "files": [