@aurigma/design-atoms-model 6.5.45 → 6.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.
Files changed (214) hide show
  1. package/Collection.d.ts +1 -0
  2. package/Collection.js.map +1 -1
  3. package/Colors/CmykColor.d.ts +16 -20
  4. package/Colors/CmykColor.js +43 -131
  5. package/Colors/CmykColor.js.map +1 -1
  6. package/Colors/Color.d.ts +7 -19
  7. package/Colors/Color.js +12 -49
  8. package/Colors/Color.js.map +1 -1
  9. package/Colors/ColorSpace.d.ts +7 -0
  10. package/Colors/ColorSpace.js +9 -0
  11. package/Colors/ColorSpace.js.map +1 -0
  12. package/Colors/GrayscaleColor.d.ts +10 -13
  13. package/Colors/GrayscaleColor.js +19 -52
  14. package/Colors/GrayscaleColor.js.map +1 -1
  15. package/Colors/HsbColor.d.ts +30 -9
  16. package/Colors/HsbColor.js +97 -41
  17. package/Colors/HsbColor.js.map +1 -1
  18. package/{ColorsNew → Colors}/Ink.d.ts +7 -6
  19. package/{ColorsNew → Colors}/Ink.js +16 -9
  20. package/Colors/Ink.js.map +1 -0
  21. package/Colors/LabColor.d.ts +15 -17
  22. package/Colors/LabColor.js +36 -78
  23. package/Colors/LabColor.js.map +1 -1
  24. package/Colors/Palette.js.map +1 -0
  25. package/Colors/ProcessColor.d.ts +16 -0
  26. package/{ColorsNew → Colors}/ProcessColor.js +24 -6
  27. package/Colors/ProcessColor.js.map +1 -0
  28. package/Colors/RgbColor.d.ts +11 -28
  29. package/Colors/RgbColor.js +31 -164
  30. package/Colors/RgbColor.js.map +1 -1
  31. package/Colors/SpotColor.d.ts +17 -20
  32. package/Colors/SpotColor.js +44 -79
  33. package/Colors/SpotColor.js.map +1 -1
  34. package/{ColorsNew → Colors}/Swatch.d.ts +3 -1
  35. package/{ColorsNew → Colors}/Swatch.js +10 -0
  36. package/Colors/Swatch.js.map +1 -0
  37. package/Colors/ValidationUtils.d.ts +2 -0
  38. package/Colors/ValidationUtils.js +17 -0
  39. package/Colors/ValidationUtils.js.map +1 -0
  40. package/Colors/index.d.ts +9 -5
  41. package/Colors/index.js +9 -5
  42. package/Colors/index.js.map +1 -1
  43. package/ColorsOld/CmykColor.d.ts +30 -0
  44. package/ColorsOld/CmykColor.js +173 -0
  45. package/ColorsOld/CmykColor.js.map +1 -0
  46. package/ColorsOld/Color.d.ts +25 -0
  47. package/ColorsOld/Color.js +67 -0
  48. package/ColorsOld/Color.js.map +1 -0
  49. package/ColorsOld/ColorFactory.js.map +1 -0
  50. package/ColorsOld/GrayscaleColor.d.ts +18 -0
  51. package/ColorsOld/GrayscaleColor.js +82 -0
  52. package/ColorsOld/GrayscaleColor.js.map +1 -0
  53. package/ColorsOld/HsbColor.d.ts +14 -0
  54. package/ColorsOld/HsbColor.js +74 -0
  55. package/ColorsOld/HsbColor.js.map +1 -0
  56. package/ColorsOld/LabColor.d.ts +23 -0
  57. package/ColorsOld/LabColor.js +111 -0
  58. package/ColorsOld/LabColor.js.map +1 -0
  59. package/ColorsOld/RgbColor.d.ts +39 -0
  60. package/ColorsOld/RgbColor.js +209 -0
  61. package/ColorsOld/RgbColor.js.map +1 -0
  62. package/ColorsOld/SpotColor.d.ts +25 -0
  63. package/ColorsOld/SpotColor.js +112 -0
  64. package/ColorsOld/SpotColor.js.map +1 -0
  65. package/ColorsOld/Utils.js.map +1 -0
  66. package/{ColorsNew → ColorsOld}/index.d.ts +5 -6
  67. package/ColorsOld/index.js +9 -0
  68. package/ColorsOld/index.js.map +1 -0
  69. package/EquatableKeyDictionary.d.ts +51 -0
  70. package/EquatableKeyDictionary.js +183 -0
  71. package/EquatableKeyDictionary.js.map +1 -0
  72. package/EventObject.js.map +1 -1
  73. package/Math/Common.d.ts +1 -1
  74. package/Math/Common.js.map +1 -1
  75. package/Math/Matrix.d.ts +10 -7
  76. package/Math/Matrix.js +68 -49
  77. package/Math/Matrix.js.map +1 -1
  78. package/Math/Transform.js +2 -2
  79. package/Math/Transform.js.map +1 -1
  80. package/Product/Container.js.map +1 -1
  81. package/Product/CropMark.js +1 -1
  82. package/Product/CropMark.js.map +1 -1
  83. package/Product/Decorators/Factory/ColorFactory.js +6 -10
  84. package/Product/Decorators/Factory/ColorFactory.js.map +1 -1
  85. package/Product/Items/ArchedTextItem.js +0 -1
  86. package/Product/Items/ArchedTextItem.js.map +1 -1
  87. package/Product/Items/AutoScaledTextItem.js +6 -2
  88. package/Product/Items/AutoScaledTextItem.js.map +1 -1
  89. package/Product/Items/BarcodeFormat.js +0 -5
  90. package/Product/Items/BarcodeFormat.js.map +1 -1
  91. package/Product/Items/BarcodeItem.js +2 -2
  92. package/Product/Items/BarcodeItem.js.map +1 -1
  93. package/Product/Items/BarcodePermissions.js.map +1 -1
  94. package/Product/Items/BaseItem.js.map +1 -1
  95. package/Product/Items/BaseTextItem.js +3 -13
  96. package/Product/Items/BaseTextItem.js.map +1 -1
  97. package/Product/Items/BoundedTextItem.js +39 -13
  98. package/Product/Items/BoundedTextItem.js.map +1 -1
  99. package/Product/Items/ClipartItem.d.ts +2 -2
  100. package/Product/Items/ClipartItem.js +14 -14
  101. package/Product/Items/ClipartItem.js.map +1 -1
  102. package/Product/Items/ContentItem.js +4 -2
  103. package/Product/Items/ContentItem.js.map +1 -1
  104. package/Product/Items/ContentPermissions.js.map +1 -1
  105. package/Product/Items/CurvedTextItem.js +18 -6
  106. package/Product/Items/CurvedTextItem.js.map +1 -1
  107. package/Product/Items/DashedLineItem.js +10 -4
  108. package/Product/Items/DashedLineItem.js.map +1 -1
  109. package/Product/Items/FrontEndPermissions.js.map +1 -1
  110. package/Product/Items/GridItem.js +29 -11
  111. package/Product/Items/GridItem.js.map +1 -1
  112. package/Product/Items/GroupItem.js +12 -4
  113. package/Product/Items/GroupItem.js.map +1 -1
  114. package/Product/Items/GroupItemPermissions.js.map +1 -1
  115. package/Product/Items/ImageEffect.js.map +1 -1
  116. package/Product/Items/ImageItem.d.ts +1 -1
  117. package/Product/Items/ImageItem.js +58 -35
  118. package/Product/Items/ImageItem.js.map +1 -1
  119. package/Product/Items/ImagePermissions.js.map +1 -1
  120. package/Product/Items/InStringPlaceholder.js +9 -3
  121. package/Product/Items/InStringPlaceholder.js.map +1 -1
  122. package/Product/Items/Item.js +44 -27
  123. package/Product/Items/Item.js.map +1 -1
  124. package/Product/Items/ItemPermissions.js.map +1 -1
  125. package/Product/Items/ItemToolbarPermissions.js.map +1 -1
  126. package/Product/Items/LayoutItem.js +21 -7
  127. package/Product/Items/LayoutItem.js.map +1 -1
  128. package/Product/Items/LineItem.js +17 -9
  129. package/Product/Items/LineItem.js.map +1 -1
  130. package/Product/Items/LinePermissions.js.map +1 -1
  131. package/Product/Items/ManipulationPermissions.js +5 -1
  132. package/Product/Items/ManipulationPermissions.js.map +1 -1
  133. package/Product/Items/OverlayEffect.js +3 -1
  134. package/Product/Items/OverlayEffect.js.map +1 -1
  135. package/Product/Items/PathBoundedTextItem.js +21 -7
  136. package/Product/Items/PathBoundedTextItem.js.map +1 -1
  137. package/Product/Items/PathBoundedTextPermissions.js +3 -1
  138. package/Product/Items/PathBoundedTextPermissions.js.map +1 -1
  139. package/Product/Items/PlaceholderItem.js +40 -18
  140. package/Product/Items/PlaceholderItem.js.map +1 -1
  141. package/Product/Items/PlaceholderPermissions.js.map +1 -1
  142. package/Product/Items/PlainTextItem.js +6 -2
  143. package/Product/Items/PlainTextItem.js.map +1 -1
  144. package/Product/Items/PolylineItem.js +10 -4
  145. package/Product/Items/PolylineItem.js.map +1 -1
  146. package/Product/Items/RectangleItem.js +0 -1
  147. package/Product/Items/RectangleItem.js.map +1 -1
  148. package/Product/Items/ResizeGripsPermissions.js +5 -1
  149. package/Product/Items/ResizeGripsPermissions.js.map +1 -1
  150. package/Product/Items/ShadowSettings.d.ts +0 -1
  151. package/Product/Items/ShadowSettings.js +15 -17
  152. package/Product/Items/ShadowSettings.js.map +1 -1
  153. package/Product/Items/ShapeItem.js +14 -16
  154. package/Product/Items/ShapeItem.js.map +1 -1
  155. package/Product/Items/ShapePermissions.js.map +1 -1
  156. package/Product/Items/SmartItem.js.map +1 -1
  157. package/Product/Items/StrokeSettings.d.ts +0 -1
  158. package/Product/Items/StrokeSettings.js +12 -15
  159. package/Product/Items/StrokeSettings.js.map +1 -1
  160. package/Product/Items/ThemeBinding.js.map +1 -1
  161. package/Product/Items/VisualizationPermissions.js.map +1 -1
  162. package/Product/ItemsData/ItemData.js.map +1 -1
  163. package/Product/ModelComponent.js +3 -1
  164. package/Product/ModelComponent.js.map +1 -1
  165. package/Product/Product.d.ts +1 -1
  166. package/Product/Product.js +4 -5
  167. package/Product/Product.js.map +1 -1
  168. package/Product/SafetyLine.js +29 -11
  169. package/Product/SafetyLine.js.map +1 -1
  170. package/Product/Surface.js +15 -6
  171. package/Product/Surface.js.map +1 -1
  172. package/Product/SurfaceMockup.d.ts +4 -4
  173. package/Product/SurfaceMockup.js +5 -5
  174. package/Product/SurfaceMockup.js.map +1 -1
  175. package/Product/Uuid.d.ts +1 -1
  176. package/Product/Uuid.js +7 -7
  177. package/Product/Uuid.js.map +1 -1
  178. package/Version.d.ts +1 -1
  179. package/Version.js +1 -1
  180. package/Version.js.map +1 -1
  181. package/index.d.ts +1 -0
  182. package/index.js +1 -0
  183. package/index.js.map +1 -1
  184. package/package.json +1 -1
  185. package/Colors/ColorFactory.js.map +0 -1
  186. package/Colors/Utils.js.map +0 -1
  187. package/ColorsNew/CmykColor.d.ts +0 -17
  188. package/ColorsNew/CmykColor.js +0 -71
  189. package/ColorsNew/CmykColor.js.map +0 -1
  190. package/ColorsNew/Color.d.ts +0 -7
  191. package/ColorsNew/Color.js +0 -23
  192. package/ColorsNew/Color.js.map +0 -1
  193. package/ColorsNew/GrayscaleColor.d.ts +0 -11
  194. package/ColorsNew/GrayscaleColor.js +0 -50
  195. package/ColorsNew/GrayscaleColor.js.map +0 -1
  196. package/ColorsNew/Ink.js.map +0 -1
  197. package/ColorsNew/Palette.js.map +0 -1
  198. package/ColorsNew/ProcessColor.d.ts +0 -10
  199. package/ColorsNew/ProcessColor.js.map +0 -1
  200. package/ColorsNew/RgbColor.d.ts +0 -15
  201. package/ColorsNew/RgbColor.js +0 -64
  202. package/ColorsNew/RgbColor.js.map +0 -1
  203. package/ColorsNew/SpotColor.d.ts +0 -15
  204. package/ColorsNew/SpotColor.js +0 -68
  205. package/ColorsNew/SpotColor.js.map +0 -1
  206. package/ColorsNew/Swatch.js.map +0 -1
  207. package/ColorsNew/index.js +0 -10
  208. package/ColorsNew/index.js.map +0 -1
  209. /package/{ColorsNew → Colors}/Palette.d.ts +0 -0
  210. /package/{ColorsNew → Colors}/Palette.js +0 -0
  211. /package/{Colors → ColorsOld}/ColorFactory.d.ts +0 -0
  212. /package/{Colors → ColorsOld}/ColorFactory.js +0 -0
  213. /package/{Colors → ColorsOld}/Utils.d.ts +0 -0
  214. /package/{Colors → ColorsOld}/Utils.js +0 -0
@@ -0,0 +1,111 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import { Color } from "./Color";
15
+ import { Utils } from "./Utils";
16
+ var LabColor = /** @class */ (function (_super) {
17
+ __extends(LabColor, _super);
18
+ function LabColor(value) {
19
+ var _this = _super.call(this, value) || this;
20
+ _this.l = 0;
21
+ _this.a = -128;
22
+ _this.b = -128;
23
+ _this.alpha = 0;
24
+ if (value == null)
25
+ return _this;
26
+ var incorrectLabColorMessage = "Incorrect LabColor format: " + JSON.stringify(value);
27
+ if (typeof value == "string") {
28
+ if (!_this._tryInitFromString(value))
29
+ console.warn(incorrectLabColorMessage);
30
+ else
31
+ _this._previewFromServer = Utils.isValidRgbColor(_this.preview);
32
+ }
33
+ else {
34
+ try {
35
+ _this._init(value);
36
+ }
37
+ catch (e) {
38
+ console.warn(incorrectLabColorMessage);
39
+ }
40
+ }
41
+ return _this;
42
+ }
43
+ Object.defineProperty(LabColor.prototype, "type", {
44
+ get: function () { return "LabColor"; },
45
+ enumerable: true,
46
+ configurable: true
47
+ });
48
+ LabColor.prototype._tryInitFromString = function (value) {
49
+ LabColor._lab.lastIndex = 0;
50
+ var match = LabColor._lab.exec(value);
51
+ if (match != null && match.length === 8) {
52
+ this._init({
53
+ l: +match[1],
54
+ a: +match[2],
55
+ b: +match[3],
56
+ alpha: match[5] != null ? Utils.convertPercentToByte(match[5]) : 255,
57
+ preview: match[7] != null ? match[7] : null
58
+ });
59
+ return true;
60
+ }
61
+ return false;
62
+ };
63
+ LabColor.prototype.clone = function () {
64
+ return new LabColor(this);
65
+ };
66
+ LabColor.prototype.equals = function (color) {
67
+ if (color instanceof LabColor) {
68
+ var baseEquals = _super.prototype.equals.call(this, color);
69
+ return baseEquals && color instanceof LabColor &&
70
+ this.l === color.l &&
71
+ this.a === color.a &&
72
+ this.b === color.b &&
73
+ this.alpha === color.alpha;
74
+ }
75
+ return false;
76
+ };
77
+ LabColor.prototype.toString = function () {
78
+ var result = "lab(" + this.l + "," + this.a + "," + this.b + "," + Utils.convertByteToPercent(this.alpha);
79
+ if (this.preview != null)
80
+ result += "," + this.preview;
81
+ result += ")";
82
+ return result;
83
+ };
84
+ LabColor.prototype.getData = function () {
85
+ var data = _super.prototype.getData.call(this);
86
+ data.l = this.l;
87
+ data.a = this.a;
88
+ data.b = this.b;
89
+ data.alpha = this.alpha;
90
+ return data;
91
+ };
92
+ LabColor.prototype._getPreview = function () {
93
+ return this.preview;
94
+ };
95
+ LabColor.prototype._init = function (colorObject) {
96
+ _super.prototype._init.call(this, colorObject);
97
+ colorObject.alpha = colorObject.alpha != null ? colorObject.alpha : 255;
98
+ this._validateNumber(colorObject.l);
99
+ this._validateNumber(colorObject.a, -128, 127);
100
+ this._validateNumber(colorObject.b, -128, 127);
101
+ this._validateNumber(colorObject.alpha);
102
+ this.l = colorObject.l;
103
+ this.a = colorObject.a;
104
+ this.b = colorObject.b;
105
+ this.alpha = colorObject.alpha;
106
+ };
107
+ LabColor._lab = /^\s*lab\(\s*(\d{1,3})\s*,\s*(-*\d{1,3})\s*,\s*(-*\d{1,3})\s*(,\s*(\d{1,3})%)?\s*(\,\s*(.*)\s*)?\)\s*;{0,1}\s*$/g;
108
+ return LabColor;
109
+ }(Color));
110
+ export { LabColor };
111
+ //# sourceMappingURL=LabColor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LabColor.js","sourceRoot":"","sources":["../../../src/design-atoms-model/ColorsOld/LabColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAU,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAShC;IAA8B,4BAAK;IAG/B,kBAAY,KAAwB;QAApC,YACI,kBAAM,KAAK,CAAC,SAmBf;QAID,OAAC,GAAG,CAAC,CAAC;QACN,OAAC,GAAG,CAAC,GAAG,CAAC;QACT,OAAC,GAAG,CAAC,GAAG,CAAC;QACT,WAAK,GAAG,CAAC,CAAC;QAxBN,IAAI,KAAK,IAAI,IAAI;yBACN;QAEX,IAAM,wBAAwB,GAAG,gCAA8B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAG,CAAC;QAEvF,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;YAC1B,IAAI,CAAC,KAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;gBAC/B,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;;gBAEvC,KAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,eAAe,CAAC,KAAI,CAAC,OAAO,CAAC,CAAC;SACrE;aAAM;YACH,IAAI;gB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CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/C,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/C,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAExC,IAAI,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;IACnC,CAAC;IAvGc,aAAI,GAAG,iHAAiH,CAAC;IAwG5I,eAAC;CAAA,AAzGD,CAA8B,KAAK,GAyGlC;SAzGY,QAAQ"}
@@ -0,0 +1,39 @@
1
+ import { Color, IColor } from "./Color";
2
+ export interface IRgbColor extends IColor {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ a?: number;
7
+ }
8
+ export declare class RgbColor extends Color implements IRgbColor {
9
+ private static _rgba;
10
+ private static _rgb;
11
+ constructor(value?: IRgbColor | string);
12
+ private _parseNamedColor;
13
+ private _tryInitFromRgba;
14
+ private _tryInitFromRgb;
15
+ private _tryInitFromHex;
16
+ get type(): string;
17
+ private _r;
18
+ get r(): number;
19
+ set r(value: number);
20
+ private _g;
21
+ get g(): number;
22
+ set g(value: number);
23
+ private _b;
24
+ get b(): number;
25
+ set b(value: number);
26
+ private _a;
27
+ get a(): number;
28
+ set a(value: number);
29
+ get alpha(): number;
30
+ static matchRgba(string: string): RegExpExecArray;
31
+ static matchRgb(string: string): RegExpExecArray;
32
+ getData(): IRgbColor;
33
+ clone(): RgbColor;
34
+ toString(): string;
35
+ equals(other: Color): boolean;
36
+ protected _getPreview(): string;
37
+ protected _init(colorObject: IRgbColor): void;
38
+ private _updatePreview;
39
+ }
@@ -0,0 +1,209 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import { Color } from "./Color";
15
+ var RgbColor = /** @class */ (function (_super) {
16
+ __extends(RgbColor, _super);
17
+ function RgbColor(value) {
18
+ var _this = _super.call(this, value) || this;
19
+ _this._r = 0;
20
+ _this._g = 0;
21
+ _this._b = 0;
22
+ _this._a = 0;
23
+ if (value == null)
24
+ return _this;
25
+ var incorrectRgbColorMessage = "Incorrect RgbColor format: " + JSON.stringify(value);
26
+ if (typeof value == "string") {
27
+ var colorString = value;
28
+ if (value.indexOf("#") !== 0 && value.indexOf("rgb") !== 0) {
29
+ colorString = _this._parseNamedColor(value);
30
+ if (colorString == null)
31
+ console.warn("Unknown rgb color name: " + value);
32
+ }
33
+ if (_this._tryInitFromRgba(colorString))
34
+ return _this;
35
+ if (_this._tryInitFromRgb(colorString))
36
+ return _this;
37
+ if (!_this._tryInitFromHex(colorString))
38
+ console.warn(incorrectRgbColorMessage);
39
+ }
40
+ else {
41
+ try {
42
+ _this._init(value);
43
+ }
44
+ catch (e) {
45
+ console.warn(incorrectRgbColorMessage);
46
+ }
47
+ }
48
+ return _this;
49
+ }
50
+ RgbColor.prototype._parseNamedColor = function (value) {
51
+ if (window.getComputedStyle) {
52
+ var div = document.createElement("div");
53
+ div.style.color = value;
54
+ document.body.appendChild(div);
55
+ var result = window.getComputedStyle(div).color;
56
+ document.body.removeChild(div);
57
+ return result;
58
+ }
59
+ else {
60
+ console.warn("Unable to parse rgb color string " + value);
61
+ return null;
62
+ }
63
+ };
64
+ RgbColor.prototype._tryInitFromRgba = function (value) {
65
+ var match = RgbColor.matchRgba(value);
66
+ if (match != null && match.length === 6) {
67
+ var a = parseInt((parseFloat(match[4]) * 255).toFixed(0));
68
+ a = Math.max(a, 0);
69
+ a = Math.min(a, 255);
70
+ this._init({
71
+ r: +match[1],
72
+ g: +match[2],
73
+ b: +match[3],
74
+ a: a
75
+ });
76
+ return true;
77
+ }
78
+ return false;
79
+ };
80
+ RgbColor.prototype._tryInitFromRgb = function (value) {
81
+ var match = RgbColor.matchRgb(value);
82
+ if (match != null && match.length === 4) {
83
+ this._init({
84
+ r: +match[1],
85
+ g: +match[2],
86
+ b: +match[3],
87
+ a: 255
88
+ });
89
+ return true;
90
+ }
91
+ return false;
92
+ };
93
+ RgbColor.prototype._tryInitFromHex = function (value) {
94
+ var shortHex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
95
+ value = value.replace(shortHex, function (m, r, g, b) { return r + r + g + g + b + b; });
96
+ var standardHex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
97
+ var match = standardHex.exec(value);
98
+ if (match != null && match.length === 4) {
99
+ this._init({
100
+ r: parseInt(match[1], 16),
101
+ g: parseInt(match[2], 16),
102
+ b: parseInt(match[3], 16),
103
+ a: 255
104
+ });
105
+ return true;
106
+ }
107
+ return false;
108
+ };
109
+ Object.defineProperty(RgbColor.prototype, "type", {
110
+ get: function () { return "RgbColor"; },
111
+ enumerable: true,
112
+ configurable: true
113
+ });
114
+ Object.defineProperty(RgbColor.prototype, "r", {
115
+ get: function () { return this._r; },
116
+ set: function (value) { this._r = value; this._updatePreview(); },
117
+ enumerable: true,
118
+ configurable: true
119
+ });
120
+ ;
121
+ ;
122
+ Object.defineProperty(RgbColor.prototype, "g", {
123
+ get: function () { return this._g; },
124
+ set: function (value) { this._g = value; this._updatePreview(); },
125
+ enumerable: true,
126
+ configurable: true
127
+ });
128
+ ;
129
+ ;
130
+ Object.defineProperty(RgbColor.prototype, "b", {
131
+ get: function () { return this._b; },
132
+ set: function (value) { this._b = value; this._updatePreview(); },
133
+ enumerable: true,
134
+ configurable: true
135
+ });
136
+ ;
137
+ ;
138
+ Object.defineProperty(RgbColor.prototype, "a", {
139
+ get: function () { return this._a; },
140
+ set: function (value) { this._a = value; this._updatePreview(); },
141
+ enumerable: true,
142
+ configurable: true
143
+ });
144
+ ;
145
+ ;
146
+ Object.defineProperty(RgbColor.prototype, "alpha", {
147
+ get: function () { return this.a; },
148
+ enumerable: true,
149
+ configurable: true
150
+ });
151
+ RgbColor.matchRgba = function (string) {
152
+ RgbColor._rgba.lastIndex = 0;
153
+ return RgbColor._rgba.exec(string);
154
+ };
155
+ RgbColor.matchRgb = function (string) {
156
+ RgbColor._rgb.lastIndex = 0;
157
+ return RgbColor._rgb.exec(string);
158
+ };
159
+ RgbColor.prototype.getData = function () {
160
+ var data = _super.prototype.getData.call(this);
161
+ data.r = this.r;
162
+ data.g = this.g;
163
+ data.b = this.b;
164
+ data.a = this.a;
165
+ return data;
166
+ };
167
+ RgbColor.prototype.clone = function () {
168
+ return new RgbColor(this);
169
+ };
170
+ RgbColor.prototype.toString = function () {
171
+ return this._getPreview();
172
+ };
173
+ RgbColor.prototype.equals = function (other) {
174
+ if (other instanceof RgbColor) {
175
+ return _super.prototype.equals.call(this, other);
176
+ }
177
+ return false;
178
+ };
179
+ RgbColor.prototype._getPreview = function () {
180
+ if (this.a === 255) {
181
+ return "rgb(" + this.r + "," + this.g + "," + this.b + ")";
182
+ }
183
+ else {
184
+ var a = (this.a / 255).toFixed(7);
185
+ return "rgba(" + this.r + "," + this.g + "," + this.b + "," + a + ")";
186
+ }
187
+ };
188
+ RgbColor.prototype._init = function (colorObject) {
189
+ _super.prototype._init.call(this, colorObject);
190
+ colorObject.a = colorObject.a != null ? colorObject.a : 255;
191
+ this._validateNumber(colorObject.r);
192
+ this._validateNumber(colorObject.g);
193
+ this._validateNumber(colorObject.b);
194
+ this._validateNumber(colorObject.a);
195
+ this.r = colorObject.r;
196
+ this.g = colorObject.g;
197
+ this.b = colorObject.b;
198
+ this.a = colorObject.a;
199
+ this._updatePreview();
200
+ };
201
+ RgbColor.prototype._updatePreview = function () {
202
+ this.preview = this._getPreview();
203
+ };
204
+ RgbColor._rgba = /^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\,\s*(\d{1,}(\.\d{1,})?)\s*\)\s*;{0,1}\s*$/g;
205
+ RgbColor._rgb = /^\s*rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)\s*;{0,1}\s*$/g;
206
+ return RgbColor;
207
+ }(Color));
208
+ export { RgbColor };
209
+ //# sourceMappingURL=RgbColor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RgbColor.js","sourceRoot":"","sources":["../../../src/design-atoms-model/ColorsOld/RgbColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAU,MAAM,SAAS,CAAC;AASxC;IAA8B,4BAAK;IAI/B,kBAAY,KAA0B;QAAtC,YACI,kBAAM,KAAK,CAAC,SAgCf;QAyEO,QAAE,GAAG,CAAC,CAAC;QAIP,QAAE,GAAG,CAAC,CAAC;QAIP,QAAE,GAAG,CAAC,CAAC;QAIP,QAAE,GAAG,CAAC,CAAC;QAnHX,IAAI,KAAK,IAAI,IAAI;yBACN;QAEX,IAAM,wBAAwB,GAAG,gCAA8B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAG,CAAC;QAEvF,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;YAC1B,IAAI,WAAW,GAAG,KAAK,CAAC;YAExB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACxD,WAAW,GAAG,KAAI,CAAC,gBA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AI,CAAC,cAAc,EAAE,CAAC;IAC1B,CAAC;IAEO,iCAAc,GAAtB;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAjMc,cAAK,GAAG,sGAAsG,CAAC;IAC/G,aAAI,GAAG,0EAA0E,CAAC;IAiMrG,eAAC;CAAA,AAnMD,CAA8B,KAAK,GAmMlC;SAnMY,QAAQ"}
@@ -0,0 +1,25 @@
1
+ import { Color, IColor } from "./Color";
2
+ export interface ISpotColor extends IColor {
3
+ inkName: string;
4
+ inkColor: IColor;
5
+ inkSolidity: number;
6
+ alpha?: number;
7
+ tint?: number;
8
+ }
9
+ export declare class SpotColor extends Color implements ISpotColor {
10
+ private static _spot;
11
+ constructor(value: ISpotColor | string);
12
+ get type(): string;
13
+ inkName: string;
14
+ inkColor: Color;
15
+ inkSolidity: number;
16
+ alpha: number;
17
+ tint: number;
18
+ private _tryInitFromString;
19
+ toString(): string;
20
+ clone(): SpotColor;
21
+ equals(color: any): boolean;
22
+ getData(): ISpotColor;
23
+ protected _getPreview(): string;
24
+ protected _init(colorObject: ISpotColor): void;
25
+ }
@@ -0,0 +1,112 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import { Color } from "./Color";
15
+ import { Utils } from "./Utils";
16
+ import { ColorFactory } from "./ColorFactory";
17
+ var SpotColor = /** @class */ (function (_super) {
18
+ __extends(SpotColor, _super);
19
+ function SpotColor(value) {
20
+ var _this = _super.call(this, value) || this;
21
+ if (value == null)
22
+ return _this;
23
+ var incorrectSpotColorMessage = "Incorrect SpotColor format: " + JSON.stringify(value);
24
+ if (typeof value == "string") {
25
+ if (!_this._tryInitFromString(value))
26
+ console.warn(incorrectSpotColorMessage);
27
+ else
28
+ _this._previewFromServer = Utils.isValidRgbColor(_this.preview);
29
+ }
30
+ else {
31
+ try {
32
+ _this._init(value);
33
+ }
34
+ catch (e) {
35
+ console.warn(incorrectSpotColorMessage);
36
+ }
37
+ }
38
+ return _this;
39
+ }
40
+ Object.defineProperty(SpotColor.prototype, "type", {
41
+ get: function () { return "SpotColor"; },
42
+ enumerable: true,
43
+ configurable: true
44
+ });
45
+ SpotColor.prototype._tryInitFromString = function (value) {
46
+ SpotColor._spot.lastIndex = 0;
47
+ var match = SpotColor._spot.exec(value);
48
+ if (match != null && match.length === 10) {
49
+ this._init({
50
+ inkName: match[1].replace(/'/g, "").replace(/\"/g, ""),
51
+ inkColor: ColorFactory.createColor(match[2]),
52
+ inkSolidity: match[4] != null ? +match[4] : 1,
53
+ tint: match[7] != null ? Utils.convertPercentToByte(match[7]) : 255,
54
+ preview: match[9] != null ? match[9] : null
55
+ });
56
+ return true;
57
+ }
58
+ return false;
59
+ };
60
+ SpotColor.prototype.toString = function () {
61
+ var inkColorWithoutPreview = this.inkColor.clone();
62
+ inkColorWithoutPreview.preview = null;
63
+ return "spot('" + this.inkName + "'," + inkColorWithoutPreview.toString() + "," + this.inkSolidity + "," + Utils.convertByteToPercent(this.tint) + "," + this.preview + ")";
64
+ };
65
+ SpotColor.prototype.clone = function () {
66
+ return new SpotColor(this);
67
+ };
68
+ SpotColor.prototype.equals = function (color) {
69
+ if (color instanceof SpotColor) {
70
+ var baseEquals = _super.prototype.equals.call(this, color);
71
+ return baseEquals && color instanceof SpotColor &&
72
+ this.inkName === color.inkName &&
73
+ this.inkColor.equals(color.inkColor) &&
74
+ this.inkSolidity === color.inkSolidity &&
75
+ this.alpha === color.alpha &&
76
+ this.tint === color.tint;
77
+ }
78
+ return false;
79
+ };
80
+ SpotColor.prototype.getData = function () {
81
+ var data = _super.prototype.getData.call(this);
82
+ data.inkName = this.inkName;
83
+ data.inkColor = this.inkColor.getData();
84
+ data.inkSolidity = this.inkSolidity;
85
+ data.alpha = this.alpha;
86
+ data.tint = this.tint;
87
+ return data;
88
+ };
89
+ SpotColor.prototype._getPreview = function () {
90
+ return this.preview;
91
+ };
92
+ SpotColor.prototype._init = function (colorObject) {
93
+ _super.prototype._init.call(this, colorObject);
94
+ colorObject.alpha = colorObject.alpha != null ? colorObject.alpha : 255;
95
+ colorObject.tint = colorObject.tint != null ? colorObject.tint : 255;
96
+ var inkColor = ColorFactory.createColor(colorObject.inkColor, true);
97
+ this._validateString(colorObject.inkName);
98
+ this._validateNumber(colorObject.inkSolidity, 0, 1);
99
+ this._validateNumber(colorObject.alpha);
100
+ this._validateNumber(colorObject.tint);
101
+ this.inkName = colorObject.inkName;
102
+ this.inkColor = inkColor;
103
+ this.inkSolidity = colorObject.inkSolidity;
104
+ this.alpha = colorObject.alpha;
105
+ this.tint = colorObject.tint;
106
+ };
107
+ SpotColor._spot = /^\s*spot\(\s*([^()]*)\s*,\s*(.{3,4}\([^()]*\))\s*(,\s*(\d{1}(\.\d{1,})?))?\s*(,\s*(\d{1,3})%)?\s*(,\s*(.*)\s*)?\)\s*;{0,1}\s*$/g;
108
+ return SpotColor;
109
+ }(Color));
110
+ export { SpotColor };
111
+ ColorFactory.registerColor("SpotColor", "spot", SpotColor);
112
+ //# sourceMappingURL=SpotColor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpotColor.js","sourceRoot":"","sources":["../../../src/design-atoms-model/ColorsOld/SpotColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAA4B,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU9C;IAA+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AAG,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAG,CAAC;IAChD,CAAC;IACL,YAAC;AAAD,CAAC,AAZD,IAYC"}
@@ -1,9 +1,8 @@
1
- export * from "./CmykColor";
2
1
  export * from "./Color";
3
- export * from "./GrayscaleColor";
4
- export * from "./Ink";
5
- export * from "./Palette";
6
- export * from "./ProcessColor";
7
2
  export * from "./RgbColor";
3
+ export * from "./CmykColor";
4
+ export * from "./GrayscaleColor";
5
+ export * from "./LabColor";
6
+ export * from "./ColorFactory";
8
7
  export * from "./SpotColor";
9
- export * from "./Swatch";
8
+ export * from "./Utils";
@@ -0,0 +1,9 @@
1
+ export * from "./Color";
2
+ export * from "./RgbColor";
3
+ export * from "./CmykColor";
4
+ export * from "./GrayscaleColor";
5
+ export * from "./LabColor";
6
+ export * from "./ColorFactory";
7
+ export * from "./SpotColor";
8
+ export * from "./Utils";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/design-atoms-model/ColorsOld/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,51 @@
1
+ export interface IEquatable<T> {
2
+ equals(other: T): boolean;
3
+ }
4
+ /**
5
+ * Represents a dictionary which key supports comparison through equals() method
6
+ */
7
+ export declare class EquatableKeyDictionary<TKey extends IEquatable<TKey>, TValue> {
8
+ private readonly _dictionary;
9
+ constructor(entries?: Iterable<[TKey, TValue]>);
10
+ /**
11
+ * Indicates whether an element with the key equal to given {@link keyValue} exists or not.
12
+ */
13
+ hasEqual(keyValue: TKey): boolean;
14
+ /**
15
+ * Tries to find a key in the dictionary that is equal to given {@link keyValue}.
16
+ *
17
+ * Returns:
18
+ *
19
+ * hasKey - indicates whether such a key was found in the dictionary;
20
+ *
21
+ * key - contains key that is equal to {@link keyValue} or null if such key was not found.
22
+ */
23
+ tryGetKeyEqualTo(keyValue: TKey): {
24
+ hasKey: boolean;
25
+ key?: TKey;
26
+ };
27
+ /**
28
+ * Tries to find a value in the dictionary corresponding to the key equal to given {@link keyValue}.
29
+ *
30
+ * Returns:
31
+ *
32
+ * hasValue - indicates whether the value with such key was found;
33
+ *
34
+ * value - contains value with the key equal to {@link keyValue} or null if such key was not found.
35
+ */
36
+ tryGetValueOf(keyValue: TKey): {
37
+ hasValue: boolean;
38
+ value: TValue;
39
+ };
40
+ clear(): void;
41
+ delete(key: TKey): boolean;
42
+ forEach(callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void, thisArg?: any): void;
43
+ get(key: TKey): TValue;
44
+ has(key: TKey): boolean;
45
+ set(key: TKey, value: TValue): this;
46
+ get size(): number;
47
+ entries(): IterableIterator<[TKey, TValue]>;
48
+ keys(): IterableIterator<TKey>;
49
+ values(): IterableIterator<TValue>;
50
+ [Symbol.iterator](): IterableIterator<[TKey, TValue]>;
51
+ }