scandit-react-native-datacapture-core 6.20.0-beta.2 → 6.21.0-beta.2

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 (117) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCoreModule.kt +8 -4
  3. package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/ui/DataCaptureViewManager.kt +5 -2
  4. package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/utils/EventWithResult.kt +5 -3
  5. package/dist/core.js +2575 -0
  6. package/dist/core.js.map +1 -0
  7. package/{js → dist/dts}/DataCaptureView.d.ts +4 -5
  8. package/dist/dts/index.d.ts +18 -0
  9. package/dist/dts/native/CameraProxy.d.ts +14 -0
  10. package/dist/dts/native/DataCaptureContextProxy.d.ts +13 -0
  11. package/dist/dts/native/DataCaptureViewProxy.d.ts +13 -0
  12. package/dist/dts/native/FeedbackProxy.d.ts +4 -0
  13. package/dist/dts/native/ImageFrameSourceProxy.d.ts +12 -0
  14. package/dist/dts/native/initProxy.d.ts +1 -0
  15. package/dist/dts/private/Defaults.d.ts +1 -0
  16. package/dist/index.js +3123 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/tsconfig.tsbuildinfo +1 -0
  19. package/ios/Sources/ScanditDataCaptureCore.swift +6 -8
  20. package/ios/Sources/Utils/ReactNativeResult.swift +7 -0
  21. package/package.json +17 -7
  22. package/scandit-react-native-datacapture-core.podspec +1 -1
  23. package/js/Camera+Related.d.ts +0 -82
  24. package/js/Camera+Related.js +0 -308
  25. package/js/Camera+Related.js.map +0 -1
  26. package/js/Camera.d.ts +0 -28
  27. package/js/Camera.js +0 -162
  28. package/js/Camera.js.map +0 -1
  29. package/js/Common.d.ts +0 -138
  30. package/js/Common.js +0 -702
  31. package/js/Common.js.map +0 -1
  32. package/js/CommonEnums.d.ts +0 -38
  33. package/js/CommonEnums.js +0 -47
  34. package/js/CommonEnums.js.map +0 -1
  35. package/js/DataCaptureContext+Related.d.ts +0 -14
  36. package/js/DataCaptureContext+Related.js +0 -38
  37. package/js/DataCaptureContext+Related.js.map +0 -1
  38. package/js/DataCaptureContext.d.ts +0 -48
  39. package/js/DataCaptureContext.js +0 -182
  40. package/js/DataCaptureContext.js.map +0 -1
  41. package/js/DataCaptureVersion.js +0 -27
  42. package/js/DataCaptureVersion.js.map +0 -1
  43. package/js/DataCaptureView+Related.d.ts +0 -45
  44. package/js/DataCaptureView+Related.js +0 -183
  45. package/js/DataCaptureView+Related.js.map +0 -1
  46. package/js/DataCaptureView.js +0 -167
  47. package/js/DataCaptureView.js.map +0 -1
  48. package/js/Feedback.d.ts +0 -40
  49. package/js/Feedback.js +0 -180
  50. package/js/Feedback.js.map +0 -1
  51. package/js/FrameSource.d.ts +0 -22
  52. package/js/FrameSource.js +0 -16
  53. package/js/FrameSource.js.map +0 -1
  54. package/js/LocationSelection.d.ts +0 -24
  55. package/js/LocationSelection.js +0 -123
  56. package/js/LocationSelection.js.map +0 -1
  57. package/js/Viewfinder+Related.d.ts +0 -20
  58. package/js/Viewfinder+Related.js +0 -69
  59. package/js/Viewfinder+Related.js.map +0 -1
  60. package/js/Viewfinder.d.ts +0 -67
  61. package/js/Viewfinder.js +0 -232
  62. package/js/Viewfinder.js.map +0 -1
  63. package/js/index.d.ts +0 -14
  64. package/js/index.js +0 -31
  65. package/js/index.js.map +0 -1
  66. package/js/native/CameraProxy.d.ts +0 -15
  67. package/js/native/CameraProxy.js +0 -67
  68. package/js/native/CameraProxy.js.map +0 -1
  69. package/js/native/DataCaptureContextProxy.d.ts +0 -15
  70. package/js/native/DataCaptureContextProxy.js +0 -99
  71. package/js/native/DataCaptureContextProxy.js.map +0 -1
  72. package/js/native/DataCaptureViewProxy.d.ts +0 -12
  73. package/js/native/DataCaptureViewProxy.js +0 -58
  74. package/js/native/DataCaptureViewProxy.js.map +0 -1
  75. package/js/native/FeedbackProxy.d.ts +0 -6
  76. package/js/native/FeedbackProxy.js +0 -21
  77. package/js/native/FeedbackProxy.js.map +0 -1
  78. package/js/native/ImageFrameSourceProxy.d.ts +0 -11
  79. package/js/native/ImageFrameSourceProxy.js +0 -51
  80. package/js/native/ImageFrameSourceProxy.js.map +0 -1
  81. package/js/private/Defaults.d.ts +0 -60
  82. package/js/private/Defaults.js +0 -97
  83. package/js/private/Defaults.js.map +0 -1
  84. package/js/private/PrivateCamera+Related.d.ts +0 -52
  85. package/js/private/PrivateCamera+Related.js +0 -37
  86. package/js/private/PrivateCamera+Related.js.map +0 -1
  87. package/js/private/PrivateCamera.d.ts +0 -16
  88. package/js/private/PrivateCamera.js +0 -3
  89. package/js/private/PrivateCamera.js.map +0 -1
  90. package/js/private/PrivateCommon.d.ts +0 -86
  91. package/js/private/PrivateCommon.js +0 -3
  92. package/js/private/PrivateCommon.js.map +0 -1
  93. package/js/private/PrivateDataCaptureContext.d.ts +0 -27
  94. package/js/private/PrivateDataCaptureContext.js +0 -3
  95. package/js/private/PrivateDataCaptureContext.js.map +0 -1
  96. package/js/private/PrivateDataCaptureView+Related.d.ts +0 -17
  97. package/js/private/PrivateDataCaptureView+Related.js +0 -33
  98. package/js/private/PrivateDataCaptureView+Related.js.map +0 -1
  99. package/js/private/PrivateDataCaptureView.d.ts +0 -39
  100. package/js/private/PrivateDataCaptureView.js +0 -147
  101. package/js/private/PrivateDataCaptureView.js.map +0 -1
  102. package/js/private/PrivateFeedback.d.ts +0 -22
  103. package/js/private/PrivateFeedback.js +0 -3
  104. package/js/private/PrivateFeedback.js.map +0 -1
  105. package/js/private/PrivateFrameSource.d.ts +0 -4
  106. package/js/private/PrivateFrameSource.js +0 -3
  107. package/js/private/PrivateFrameSource.js.map +0 -1
  108. package/js/private/PrivateLocationSelection.d.ts +0 -14
  109. package/js/private/PrivateLocationSelection.js +0 -3
  110. package/js/private/PrivateLocationSelection.js.map +0 -1
  111. package/js/private/PrivateViewfinder+Related.d.ts +0 -7
  112. package/js/private/PrivateViewfinder+Related.js +0 -3
  113. package/js/private/PrivateViewfinder+Related.js.map +0 -1
  114. package/js/private/Serializeable.d.ts +0 -13
  115. package/js/private/Serializeable.js +0 -75
  116. package/js/private/Serializeable.js.map +0 -1
  117. /package/{js → dist/dts}/DataCaptureVersion.d.ts +0 -0
package/js/Common.js DELETED
@@ -1,702 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.Brush = exports.Color = exports.MarginsWithUnit = exports.SizeWithUnitAndAspect = exports.SizeWithAspect = exports.Size = exports.SizeWithUnit = exports.RectWithUnit = exports.Rect = exports.PointWithUnit = exports.NumberWithUnit = exports.Quadrilateral = exports.Point = void 0;
25
- var CommonEnums_1 = require("./CommonEnums");
26
- var Serializeable_1 = require("./private/Serializeable");
27
- var Point = /** @class */ (function (_super) {
28
- __extends(Point, _super);
29
- function Point(x, y) {
30
- var _this = _super.call(this) || this;
31
- _this._x = x;
32
- _this._y = y;
33
- return _this;
34
- }
35
- Object.defineProperty(Point.prototype, "x", {
36
- get: function () {
37
- return this._x;
38
- },
39
- enumerable: false,
40
- configurable: true
41
- });
42
- Object.defineProperty(Point.prototype, "y", {
43
- get: function () {
44
- return this._y;
45
- },
46
- enumerable: false,
47
- configurable: true
48
- });
49
- Point.fromJSON = function (json) {
50
- return new Point(json.x, json.y);
51
- };
52
- __decorate([
53
- (0, Serializeable_1.nameForSerialization)('x')
54
- ], Point.prototype, "_x", void 0);
55
- __decorate([
56
- (0, Serializeable_1.nameForSerialization)('y')
57
- ], Point.prototype, "_y", void 0);
58
- return Point;
59
- }(Serializeable_1.DefaultSerializeable));
60
- exports.Point = Point;
61
- var Quadrilateral = /** @class */ (function (_super) {
62
- __extends(Quadrilateral, _super);
63
- function Quadrilateral(topLeft, topRight, bottomRight, bottomLeft) {
64
- var _this = _super.call(this) || this;
65
- _this._topLeft = topLeft;
66
- _this._topRight = topRight;
67
- _this._bottomRight = bottomRight;
68
- _this._bottomLeft = bottomLeft;
69
- return _this;
70
- }
71
- Object.defineProperty(Quadrilateral.prototype, "topLeft", {
72
- get: function () {
73
- return this._topLeft;
74
- },
75
- enumerable: false,
76
- configurable: true
77
- });
78
- Object.defineProperty(Quadrilateral.prototype, "topRight", {
79
- get: function () {
80
- return this._topRight;
81
- },
82
- enumerable: false,
83
- configurable: true
84
- });
85
- Object.defineProperty(Quadrilateral.prototype, "bottomRight", {
86
- get: function () {
87
- return this._bottomRight;
88
- },
89
- enumerable: false,
90
- configurable: true
91
- });
92
- Object.defineProperty(Quadrilateral.prototype, "bottomLeft", {
93
- get: function () {
94
- return this._bottomLeft;
95
- },
96
- enumerable: false,
97
- configurable: true
98
- });
99
- Quadrilateral.fromJSON = function (json) {
100
- return new Quadrilateral(Point.fromJSON(json.topLeft), Point.fromJSON(json.topRight), Point.fromJSON(json.bottomRight), Point.fromJSON(json.bottomLeft));
101
- };
102
- __decorate([
103
- (0, Serializeable_1.nameForSerialization)('topLeft')
104
- ], Quadrilateral.prototype, "_topLeft", void 0);
105
- __decorate([
106
- (0, Serializeable_1.nameForSerialization)('topRight')
107
- ], Quadrilateral.prototype, "_topRight", void 0);
108
- __decorate([
109
- (0, Serializeable_1.nameForSerialization)('bottomRight')
110
- ], Quadrilateral.prototype, "_bottomRight", void 0);
111
- __decorate([
112
- (0, Serializeable_1.nameForSerialization)('bottomLeft')
113
- ], Quadrilateral.prototype, "_bottomLeft", void 0);
114
- return Quadrilateral;
115
- }(Serializeable_1.DefaultSerializeable));
116
- exports.Quadrilateral = Quadrilateral;
117
- var NumberWithUnit = /** @class */ (function (_super) {
118
- __extends(NumberWithUnit, _super);
119
- function NumberWithUnit(value, unit) {
120
- var _this = _super.call(this) || this;
121
- _this._value = value;
122
- _this._unit = unit;
123
- return _this;
124
- }
125
- Object.defineProperty(NumberWithUnit.prototype, "value", {
126
- get: function () {
127
- return this._value;
128
- },
129
- enumerable: false,
130
- configurable: true
131
- });
132
- Object.defineProperty(NumberWithUnit.prototype, "unit", {
133
- get: function () {
134
- return this._unit;
135
- },
136
- enumerable: false,
137
- configurable: true
138
- });
139
- NumberWithUnit.fromJSON = function (json) {
140
- return new NumberWithUnit(json.value, json.unit);
141
- };
142
- __decorate([
143
- (0, Serializeable_1.nameForSerialization)('value')
144
- ], NumberWithUnit.prototype, "_value", void 0);
145
- __decorate([
146
- (0, Serializeable_1.nameForSerialization)('unit')
147
- ], NumberWithUnit.prototype, "_unit", void 0);
148
- return NumberWithUnit;
149
- }(Serializeable_1.DefaultSerializeable));
150
- exports.NumberWithUnit = NumberWithUnit;
151
- var PointWithUnit = /** @class */ (function (_super) {
152
- __extends(PointWithUnit, _super);
153
- function PointWithUnit(x, y) {
154
- var _this = _super.call(this) || this;
155
- _this._x = x;
156
- _this._y = y;
157
- return _this;
158
- }
159
- Object.defineProperty(PointWithUnit.prototype, "x", {
160
- get: function () {
161
- return this._x;
162
- },
163
- enumerable: false,
164
- configurable: true
165
- });
166
- Object.defineProperty(PointWithUnit.prototype, "y", {
167
- get: function () {
168
- return this._y;
169
- },
170
- enumerable: false,
171
- configurable: true
172
- });
173
- PointWithUnit.fromJSON = function (json) {
174
- return new PointWithUnit(NumberWithUnit.fromJSON(json.x), NumberWithUnit.fromJSON(json.y));
175
- };
176
- Object.defineProperty(PointWithUnit, "zero", {
177
- get: function () {
178
- return new PointWithUnit(new NumberWithUnit(0, CommonEnums_1.MeasureUnit.Pixel), new NumberWithUnit(0, CommonEnums_1.MeasureUnit.Pixel));
179
- },
180
- enumerable: false,
181
- configurable: true
182
- });
183
- __decorate([
184
- (0, Serializeable_1.nameForSerialization)('x')
185
- ], PointWithUnit.prototype, "_x", void 0);
186
- __decorate([
187
- (0, Serializeable_1.nameForSerialization)('y')
188
- ], PointWithUnit.prototype, "_y", void 0);
189
- return PointWithUnit;
190
- }(Serializeable_1.DefaultSerializeable));
191
- exports.PointWithUnit = PointWithUnit;
192
- var Rect = /** @class */ (function (_super) {
193
- __extends(Rect, _super);
194
- function Rect(origin, size) {
195
- var _this = _super.call(this) || this;
196
- _this._origin = origin;
197
- _this._size = size;
198
- return _this;
199
- }
200
- Object.defineProperty(Rect.prototype, "origin", {
201
- get: function () {
202
- return this._origin;
203
- },
204
- enumerable: false,
205
- configurable: true
206
- });
207
- Object.defineProperty(Rect.prototype, "size", {
208
- get: function () {
209
- return this._size;
210
- },
211
- enumerable: false,
212
- configurable: true
213
- });
214
- __decorate([
215
- (0, Serializeable_1.nameForSerialization)('origin')
216
- ], Rect.prototype, "_origin", void 0);
217
- __decorate([
218
- (0, Serializeable_1.nameForSerialization)('size')
219
- ], Rect.prototype, "_size", void 0);
220
- return Rect;
221
- }(Serializeable_1.DefaultSerializeable));
222
- exports.Rect = Rect;
223
- var RectWithUnit = /** @class */ (function (_super) {
224
- __extends(RectWithUnit, _super);
225
- function RectWithUnit(origin, size) {
226
- var _this = _super.call(this) || this;
227
- _this._origin = origin;
228
- _this._size = size;
229
- return _this;
230
- }
231
- Object.defineProperty(RectWithUnit.prototype, "origin", {
232
- get: function () {
233
- return this._origin;
234
- },
235
- enumerable: false,
236
- configurable: true
237
- });
238
- Object.defineProperty(RectWithUnit.prototype, "size", {
239
- get: function () {
240
- return this._size;
241
- },
242
- enumerable: false,
243
- configurable: true
244
- });
245
- __decorate([
246
- (0, Serializeable_1.nameForSerialization)('origin')
247
- ], RectWithUnit.prototype, "_origin", void 0);
248
- __decorate([
249
- (0, Serializeable_1.nameForSerialization)('size')
250
- ], RectWithUnit.prototype, "_size", void 0);
251
- return RectWithUnit;
252
- }(Serializeable_1.DefaultSerializeable));
253
- exports.RectWithUnit = RectWithUnit;
254
- var SizeWithUnit = /** @class */ (function (_super) {
255
- __extends(SizeWithUnit, _super);
256
- function SizeWithUnit(width, height) {
257
- var _this = _super.call(this) || this;
258
- _this._width = width;
259
- _this._height = height;
260
- return _this;
261
- }
262
- Object.defineProperty(SizeWithUnit.prototype, "width", {
263
- get: function () {
264
- return this._width;
265
- },
266
- enumerable: false,
267
- configurable: true
268
- });
269
- Object.defineProperty(SizeWithUnit.prototype, "height", {
270
- get: function () {
271
- return this._height;
272
- },
273
- enumerable: false,
274
- configurable: true
275
- });
276
- __decorate([
277
- (0, Serializeable_1.nameForSerialization)('width')
278
- ], SizeWithUnit.prototype, "_width", void 0);
279
- __decorate([
280
- (0, Serializeable_1.nameForSerialization)('height')
281
- ], SizeWithUnit.prototype, "_height", void 0);
282
- return SizeWithUnit;
283
- }(Serializeable_1.DefaultSerializeable));
284
- exports.SizeWithUnit = SizeWithUnit;
285
- var Size = /** @class */ (function (_super) {
286
- __extends(Size, _super);
287
- function Size(width, height) {
288
- var _this = _super.call(this) || this;
289
- _this._width = width;
290
- _this._height = height;
291
- return _this;
292
- }
293
- Object.defineProperty(Size.prototype, "width", {
294
- get: function () {
295
- return this._width;
296
- },
297
- enumerable: false,
298
- configurable: true
299
- });
300
- Object.defineProperty(Size.prototype, "height", {
301
- get: function () {
302
- return this._height;
303
- },
304
- enumerable: false,
305
- configurable: true
306
- });
307
- Size.fromJSON = function (json) {
308
- return new Size(json.width, json.height);
309
- };
310
- __decorate([
311
- (0, Serializeable_1.nameForSerialization)('width')
312
- ], Size.prototype, "_width", void 0);
313
- __decorate([
314
- (0, Serializeable_1.nameForSerialization)('height')
315
- ], Size.prototype, "_height", void 0);
316
- return Size;
317
- }(Serializeable_1.DefaultSerializeable));
318
- exports.Size = Size;
319
- var SizeWithAspect = /** @class */ (function () {
320
- function SizeWithAspect(size, aspect) {
321
- this._size = size;
322
- this._aspect = aspect;
323
- }
324
- Object.defineProperty(SizeWithAspect.prototype, "size", {
325
- get: function () {
326
- return this._size;
327
- },
328
- enumerable: false,
329
- configurable: true
330
- });
331
- Object.defineProperty(SizeWithAspect.prototype, "aspect", {
332
- get: function () {
333
- return this._aspect;
334
- },
335
- enumerable: false,
336
- configurable: true
337
- });
338
- __decorate([
339
- (0, Serializeable_1.nameForSerialization)('size')
340
- ], SizeWithAspect.prototype, "_size", void 0);
341
- __decorate([
342
- (0, Serializeable_1.nameForSerialization)('aspect')
343
- ], SizeWithAspect.prototype, "_aspect", void 0);
344
- return SizeWithAspect;
345
- }());
346
- exports.SizeWithAspect = SizeWithAspect;
347
- var SizeWithUnitAndAspect = /** @class */ (function () {
348
- function SizeWithUnitAndAspect() {
349
- this._widthAndHeight = null;
350
- this._widthAndAspectRatio = null;
351
- this._heightAndAspectRatio = null;
352
- this._shorterDimensionAndAspectRatio = null;
353
- }
354
- Object.defineProperty(SizeWithUnitAndAspect.prototype, "widthAndHeight", {
355
- get: function () {
356
- return this._widthAndHeight;
357
- },
358
- enumerable: false,
359
- configurable: true
360
- });
361
- Object.defineProperty(SizeWithUnitAndAspect.prototype, "widthAndAspectRatio", {
362
- get: function () {
363
- return this._widthAndAspectRatio;
364
- },
365
- enumerable: false,
366
- configurable: true
367
- });
368
- Object.defineProperty(SizeWithUnitAndAspect.prototype, "heightAndAspectRatio", {
369
- get: function () {
370
- return this._heightAndAspectRatio;
371
- },
372
- enumerable: false,
373
- configurable: true
374
- });
375
- Object.defineProperty(SizeWithUnitAndAspect.prototype, "shorterDimensionAndAspectRatio", {
376
- get: function () {
377
- return this._shorterDimensionAndAspectRatio;
378
- },
379
- enumerable: false,
380
- configurable: true
381
- });
382
- Object.defineProperty(SizeWithUnitAndAspect.prototype, "sizingMode", {
383
- get: function () {
384
- if (this.widthAndAspectRatio) {
385
- return CommonEnums_1.SizingMode.WidthAndAspectRatio;
386
- }
387
- if (this.heightAndAspectRatio) {
388
- return CommonEnums_1.SizingMode.HeightAndAspectRatio;
389
- }
390
- if (this.shorterDimensionAndAspectRatio) {
391
- return CommonEnums_1.SizingMode.ShorterDimensionAndAspectRatio;
392
- }
393
- return CommonEnums_1.SizingMode.WidthAndHeight;
394
- },
395
- enumerable: false,
396
- configurable: true
397
- });
398
- SizeWithUnitAndAspect.sizeWithWidthAndHeight = function (widthAndHeight) {
399
- var sizeWithUnitAndAspect = new SizeWithUnitAndAspect();
400
- sizeWithUnitAndAspect._widthAndHeight = widthAndHeight;
401
- return sizeWithUnitAndAspect;
402
- };
403
- SizeWithUnitAndAspect.sizeWithWidthAndAspectRatio = function (width, aspectRatio) {
404
- var sizeWithUnitAndAspect = new SizeWithUnitAndAspect();
405
- sizeWithUnitAndAspect._widthAndAspectRatio = new SizeWithAspect(width, aspectRatio);
406
- return sizeWithUnitAndAspect;
407
- };
408
- SizeWithUnitAndAspect.sizeWithHeightAndAspectRatio = function (height, aspectRatio) {
409
- var sizeWithUnitAndAspect = new SizeWithUnitAndAspect();
410
- sizeWithUnitAndAspect._heightAndAspectRatio = new SizeWithAspect(height, aspectRatio);
411
- return sizeWithUnitAndAspect;
412
- };
413
- SizeWithUnitAndAspect.sizeWithShorterDimensionAndAspectRatio = function (shorterDimension, aspectRatio) {
414
- var sizeWithUnitAndAspect = new SizeWithUnitAndAspect();
415
- sizeWithUnitAndAspect._shorterDimensionAndAspectRatio = new SizeWithAspect(shorterDimension, aspectRatio);
416
- return sizeWithUnitAndAspect;
417
- };
418
- SizeWithUnitAndAspect.fromJSON = function (json) {
419
- if (json.width && json.height) {
420
- return this.sizeWithWidthAndHeight(new SizeWithUnit(NumberWithUnit.fromJSON(json.width), NumberWithUnit.fromJSON(json.height)));
421
- }
422
- else if (json.width && json.aspect) {
423
- return this.sizeWithWidthAndAspectRatio(NumberWithUnit.fromJSON(json.width), json.aspect);
424
- }
425
- else if (json.height && json.aspect) {
426
- return this.sizeWithHeightAndAspectRatio(NumberWithUnit.fromJSON(json.height), json.aspect);
427
- }
428
- else if (json.shorterDimension && json.aspect) {
429
- return this.sizeWithShorterDimensionAndAspectRatio(NumberWithUnit.fromJSON(json.shorterDimension), json.aspect);
430
- }
431
- else {
432
- throw new Error("SizeWithUnitAndAspectJSON is malformed: ".concat(JSON.stringify(json)));
433
- }
434
- };
435
- SizeWithUnitAndAspect.prototype.toJSON = function () {
436
- switch (this.sizingMode) {
437
- case CommonEnums_1.SizingMode.WidthAndAspectRatio:
438
- return {
439
- width: this.widthAndAspectRatio.size.toJSON(),
440
- aspect: this.widthAndAspectRatio.aspect,
441
- };
442
- case CommonEnums_1.SizingMode.HeightAndAspectRatio:
443
- return {
444
- height: this.heightAndAspectRatio.size.toJSON(),
445
- aspect: this.heightAndAspectRatio.aspect,
446
- };
447
- case CommonEnums_1.SizingMode.ShorterDimensionAndAspectRatio:
448
- return {
449
- shorterDimension: this.shorterDimensionAndAspectRatio.size.toJSON(),
450
- aspect: this.shorterDimensionAndAspectRatio.aspect,
451
- };
452
- default:
453
- return {
454
- width: this.widthAndHeight.width.toJSON(),
455
- height: this.widthAndHeight.height.toJSON(),
456
- };
457
- }
458
- };
459
- __decorate([
460
- (0, Serializeable_1.nameForSerialization)('widthAndHeight')
461
- ], SizeWithUnitAndAspect.prototype, "_widthAndHeight", void 0);
462
- __decorate([
463
- (0, Serializeable_1.nameForSerialization)('widthAndAspectRatio')
464
- ], SizeWithUnitAndAspect.prototype, "_widthAndAspectRatio", void 0);
465
- __decorate([
466
- (0, Serializeable_1.nameForSerialization)('heightAndAspectRatio')
467
- ], SizeWithUnitAndAspect.prototype, "_heightAndAspectRatio", void 0);
468
- __decorate([
469
- (0, Serializeable_1.nameForSerialization)('shorterDimensionAndAspectRatio')
470
- ], SizeWithUnitAndAspect.prototype, "_shorterDimensionAndAspectRatio", void 0);
471
- return SizeWithUnitAndAspect;
472
- }());
473
- exports.SizeWithUnitAndAspect = SizeWithUnitAndAspect;
474
- var MarginsWithUnit = /** @class */ (function (_super) {
475
- __extends(MarginsWithUnit, _super);
476
- function MarginsWithUnit(left, right, top, bottom) {
477
- var _this = _super.call(this) || this;
478
- _this._left = left;
479
- _this._right = right;
480
- _this._top = top;
481
- _this._bottom = bottom;
482
- return _this;
483
- }
484
- Object.defineProperty(MarginsWithUnit.prototype, "left", {
485
- get: function () {
486
- return this._left;
487
- },
488
- enumerable: false,
489
- configurable: true
490
- });
491
- Object.defineProperty(MarginsWithUnit.prototype, "right", {
492
- get: function () {
493
- return this._right;
494
- },
495
- enumerable: false,
496
- configurable: true
497
- });
498
- Object.defineProperty(MarginsWithUnit.prototype, "top", {
499
- get: function () {
500
- return this._top;
501
- },
502
- enumerable: false,
503
- configurable: true
504
- });
505
- Object.defineProperty(MarginsWithUnit.prototype, "bottom", {
506
- get: function () {
507
- return this._bottom;
508
- },
509
- enumerable: false,
510
- configurable: true
511
- });
512
- MarginsWithUnit.fromJSON = function (json) {
513
- return new MarginsWithUnit(NumberWithUnit.fromJSON(json.left), NumberWithUnit.fromJSON(json.right), NumberWithUnit.fromJSON(json.top), NumberWithUnit.fromJSON(json.bottom));
514
- };
515
- Object.defineProperty(MarginsWithUnit, "zero", {
516
- get: function () {
517
- return new MarginsWithUnit(new NumberWithUnit(0, CommonEnums_1.MeasureUnit.Pixel), new NumberWithUnit(0, CommonEnums_1.MeasureUnit.Pixel), new NumberWithUnit(0, CommonEnums_1.MeasureUnit.Pixel), new NumberWithUnit(0, CommonEnums_1.MeasureUnit.Pixel));
518
- },
519
- enumerable: false,
520
- configurable: true
521
- });
522
- __decorate([
523
- (0, Serializeable_1.nameForSerialization)('left')
524
- ], MarginsWithUnit.prototype, "_left", void 0);
525
- __decorate([
526
- (0, Serializeable_1.nameForSerialization)('right')
527
- ], MarginsWithUnit.prototype, "_right", void 0);
528
- __decorate([
529
- (0, Serializeable_1.nameForSerialization)('top')
530
- ], MarginsWithUnit.prototype, "_top", void 0);
531
- __decorate([
532
- (0, Serializeable_1.nameForSerialization)('bottom')
533
- ], MarginsWithUnit.prototype, "_bottom", void 0);
534
- return MarginsWithUnit;
535
- }(Serializeable_1.DefaultSerializeable));
536
- exports.MarginsWithUnit = MarginsWithUnit;
537
- var Color = /** @class */ (function () {
538
- function Color(hex) {
539
- this.hexadecimalString = hex;
540
- }
541
- Object.defineProperty(Color.prototype, "redComponent", {
542
- get: function () {
543
- return this.hexadecimalString.slice(0, 2);
544
- },
545
- enumerable: false,
546
- configurable: true
547
- });
548
- Object.defineProperty(Color.prototype, "greenComponent", {
549
- get: function () {
550
- return this.hexadecimalString.slice(2, 4);
551
- },
552
- enumerable: false,
553
- configurable: true
554
- });
555
- Object.defineProperty(Color.prototype, "blueComponent", {
556
- get: function () {
557
- return this.hexadecimalString.slice(4, 6);
558
- },
559
- enumerable: false,
560
- configurable: true
561
- });
562
- Object.defineProperty(Color.prototype, "alphaComponent", {
563
- get: function () {
564
- return this.hexadecimalString.slice(6, 8);
565
- },
566
- enumerable: false,
567
- configurable: true
568
- });
569
- Object.defineProperty(Color.prototype, "red", {
570
- get: function () {
571
- return Color.hexToNumber(this.redComponent);
572
- },
573
- enumerable: false,
574
- configurable: true
575
- });
576
- Object.defineProperty(Color.prototype, "green", {
577
- get: function () {
578
- return Color.hexToNumber(this.greenComponent);
579
- },
580
- enumerable: false,
581
- configurable: true
582
- });
583
- Object.defineProperty(Color.prototype, "blue", {
584
- get: function () {
585
- return Color.hexToNumber(this.blueComponent);
586
- },
587
- enumerable: false,
588
- configurable: true
589
- });
590
- Object.defineProperty(Color.prototype, "alpha", {
591
- get: function () {
592
- return Color.hexToNumber(this.alphaComponent);
593
- },
594
- enumerable: false,
595
- configurable: true
596
- });
597
- Color.fromHex = function (hex) {
598
- return new Color(Color.normalizeHex(hex));
599
- };
600
- Color.fromRGBA = function (red, green, blue, alpha) {
601
- var _this = this;
602
- if (alpha === void 0) { alpha = 1; }
603
- var hexString = [red, green, blue, this.normalizeAlpha(alpha)]
604
- .reduce(function (hex, colorComponent) { return hex + _this.numberToHex(colorComponent); }, '');
605
- return new Color(hexString);
606
- };
607
- Color.hexToNumber = function (hex) {
608
- return parseInt(hex, 16);
609
- };
610
- Color.fromJSON = function (json) {
611
- return Color.fromHex(json);
612
- };
613
- Color.numberToHex = function (x) {
614
- x = Math.round(x);
615
- var hex = x.toString(16);
616
- if (hex.length === 1) {
617
- hex = '0' + hex;
618
- }
619
- return hex.toUpperCase();
620
- };
621
- Color.normalizeHex = function (hex) {
622
- // remove leading #
623
- if (hex[0] === '#') {
624
- hex = hex.slice(1);
625
- }
626
- // double digits if single digit
627
- if (hex.length < 6) {
628
- hex = hex.split('').map(function (s) { return s + s; }).join('');
629
- }
630
- // add alpha if missing
631
- if (hex.length === 6) {
632
- hex = hex + 'FF';
633
- }
634
- return hex.toUpperCase();
635
- };
636
- Color.normalizeAlpha = function (alpha) {
637
- if (alpha > 0 && alpha <= 1) {
638
- return 255 * alpha;
639
- }
640
- return alpha;
641
- };
642
- Color.prototype.withAlpha = function (alpha) {
643
- var newHex = this.hexadecimalString.slice(0, 6) + Color.numberToHex(Color.normalizeAlpha(alpha));
644
- return Color.fromHex(newHex);
645
- };
646
- Color.prototype.toJSON = function () {
647
- return this.hexadecimalString;
648
- };
649
- return Color;
650
- }());
651
- exports.Color = Color;
652
- var Brush = /** @class */ (function (_super) {
653
- __extends(Brush, _super);
654
- function Brush(fillColor, strokeColor, strokeWidth) {
655
- if (fillColor === void 0) { fillColor = Brush.defaults.fillColor; }
656
- if (strokeColor === void 0) { strokeColor = Brush.defaults.strokeColor; }
657
- if (strokeWidth === void 0) { strokeWidth = Brush.defaults.strokeWidth; }
658
- var _this = _super.call(this) || this;
659
- _this.fill = { color: fillColor };
660
- _this.stroke = { color: strokeColor, width: strokeWidth };
661
- return _this;
662
- }
663
- Object.defineProperty(Brush, "transparent", {
664
- get: function () {
665
- var transparentBlack = Color.fromRGBA(255, 255, 255, 0);
666
- return new Brush(transparentBlack, transparentBlack, 0);
667
- },
668
- enumerable: false,
669
- configurable: true
670
- });
671
- Object.defineProperty(Brush.prototype, "fillColor", {
672
- get: function () {
673
- return this.fill.color;
674
- },
675
- enumerable: false,
676
- configurable: true
677
- });
678
- Object.defineProperty(Brush.prototype, "strokeColor", {
679
- get: function () {
680
- return this.stroke.color;
681
- },
682
- enumerable: false,
683
- configurable: true
684
- });
685
- Object.defineProperty(Brush.prototype, "strokeWidth", {
686
- get: function () {
687
- return this.stroke.width;
688
- },
689
- enumerable: false,
690
- configurable: true
691
- });
692
- Object.defineProperty(Brush.prototype, "copy", {
693
- get: function () {
694
- return new Brush(this.fillColor, this.strokeColor, this.strokeWidth);
695
- },
696
- enumerable: false,
697
- configurable: true
698
- });
699
- return Brush;
700
- }(Serializeable_1.DefaultSerializeable));
701
- exports.Brush = Brush;
702
- //# sourceMappingURL=Common.js.map