@aurigma/design-atoms-model 6.5.45 → 6.6.1
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.
- package/Collection.d.ts +1 -0
- package/Collection.js.map +1 -1
- package/Colors/CmykColor.d.ts +16 -20
- package/Colors/CmykColor.js +43 -131
- package/Colors/CmykColor.js.map +1 -1
- package/Colors/Color.d.ts +7 -19
- package/Colors/Color.js +12 -49
- package/Colors/Color.js.map +1 -1
- package/Colors/ColorSpace.d.ts +7 -0
- package/Colors/ColorSpace.js +9 -0
- package/Colors/ColorSpace.js.map +1 -0
- package/Colors/GrayscaleColor.d.ts +10 -13
- package/Colors/GrayscaleColor.js +19 -52
- package/Colors/GrayscaleColor.js.map +1 -1
- package/Colors/HsbColor.d.ts +30 -9
- package/Colors/HsbColor.js +97 -41
- package/Colors/HsbColor.js.map +1 -1
- package/{ColorsNew → Colors}/Ink.d.ts +7 -6
- package/{ColorsNew → Colors}/Ink.js +16 -9
- package/Colors/Ink.js.map +1 -0
- package/Colors/LabColor.d.ts +15 -17
- package/Colors/LabColor.js +36 -78
- package/Colors/LabColor.js.map +1 -1
- package/Colors/Palette.js.map +1 -0
- package/Colors/ProcessColor.d.ts +16 -0
- package/{ColorsNew → Colors}/ProcessColor.js +24 -6
- package/Colors/ProcessColor.js.map +1 -0
- package/Colors/RgbColor.d.ts +11 -28
- package/Colors/RgbColor.js +31 -164
- package/Colors/RgbColor.js.map +1 -1
- package/Colors/SpotColor.d.ts +17 -20
- package/Colors/SpotColor.js +44 -79
- package/Colors/SpotColor.js.map +1 -1
- package/{ColorsNew → Colors}/Swatch.d.ts +3 -1
- package/{ColorsNew → Colors}/Swatch.js +10 -0
- package/Colors/Swatch.js.map +1 -0
- package/Colors/ValidationUtils.d.ts +2 -0
- package/Colors/ValidationUtils.js +17 -0
- package/Colors/ValidationUtils.js.map +1 -0
- package/Colors/index.d.ts +9 -5
- package/Colors/index.js +9 -5
- package/Colors/index.js.map +1 -1
- package/ColorsOld/CmykColor.d.ts +30 -0
- package/ColorsOld/CmykColor.js +173 -0
- package/ColorsOld/CmykColor.js.map +1 -0
- package/ColorsOld/Color.d.ts +25 -0
- package/ColorsOld/Color.js +67 -0
- package/ColorsOld/Color.js.map +1 -0
- package/ColorsOld/ColorFactory.js.map +1 -0
- package/ColorsOld/GrayscaleColor.d.ts +18 -0
- package/ColorsOld/GrayscaleColor.js +82 -0
- package/ColorsOld/GrayscaleColor.js.map +1 -0
- package/ColorsOld/HsbColor.d.ts +14 -0
- package/ColorsOld/HsbColor.js +74 -0
- package/ColorsOld/HsbColor.js.map +1 -0
- package/ColorsOld/LabColor.d.ts +23 -0
- package/ColorsOld/LabColor.js +111 -0
- package/ColorsOld/LabColor.js.map +1 -0
- package/ColorsOld/RgbColor.d.ts +39 -0
- package/ColorsOld/RgbColor.js +209 -0
- package/ColorsOld/RgbColor.js.map +1 -0
- package/ColorsOld/SpotColor.d.ts +25 -0
- package/ColorsOld/SpotColor.js +112 -0
- package/ColorsOld/SpotColor.js.map +1 -0
- package/ColorsOld/Utils.js.map +1 -0
- package/{ColorsNew → ColorsOld}/index.d.ts +5 -6
- package/ColorsOld/index.js +9 -0
- package/ColorsOld/index.js.map +1 -0
- package/EquatableKeyDictionary.d.ts +51 -0
- package/EquatableKeyDictionary.js +183 -0
- package/EquatableKeyDictionary.js.map +1 -0
- package/EventObject.js.map +1 -1
- package/Math/Common.d.ts +1 -1
- package/Math/Common.js.map +1 -1
- package/Math/Matrix.d.ts +10 -7
- package/Math/Matrix.js +68 -49
- package/Math/Matrix.js.map +1 -1
- package/Math/Transform.js +2 -2
- package/Math/Transform.js.map +1 -1
- package/Product/Container.js.map +1 -1
- package/Product/CropMark.js +1 -1
- package/Product/CropMark.js.map +1 -1
- package/Product/Decorators/Factory/ColorFactory.js +6 -10
- package/Product/Decorators/Factory/ColorFactory.js.map +1 -1
- package/Product/Items/ArchedTextItem.js +0 -1
- package/Product/Items/ArchedTextItem.js.map +1 -1
- package/Product/Items/AutoScaledTextItem.js +6 -2
- package/Product/Items/AutoScaledTextItem.js.map +1 -1
- package/Product/Items/BarcodeFormat.js +0 -5
- package/Product/Items/BarcodeFormat.js.map +1 -1
- package/Product/Items/BarcodeItem.js +2 -2
- package/Product/Items/BarcodeItem.js.map +1 -1
- package/Product/Items/BarcodePermissions.js.map +1 -1
- package/Product/Items/BaseItem.js.map +1 -1
- package/Product/Items/BaseTextItem.js +3 -13
- package/Product/Items/BaseTextItem.js.map +1 -1
- package/Product/Items/BoundedTextItem.js +39 -13
- package/Product/Items/BoundedTextItem.js.map +1 -1
- package/Product/Items/ClipartItem.d.ts +2 -2
- package/Product/Items/ClipartItem.js +14 -14
- package/Product/Items/ClipartItem.js.map +1 -1
- package/Product/Items/ContentItem.js +4 -2
- package/Product/Items/ContentItem.js.map +1 -1
- package/Product/Items/ContentPermissions.js.map +1 -1
- package/Product/Items/CurvedTextItem.js +18 -6
- package/Product/Items/CurvedTextItem.js.map +1 -1
- package/Product/Items/DashedLineItem.js +10 -4
- package/Product/Items/DashedLineItem.js.map +1 -1
- package/Product/Items/FrontEndPermissions.js.map +1 -1
- package/Product/Items/GridItem.js +29 -11
- package/Product/Items/GridItem.js.map +1 -1
- package/Product/Items/GroupItem.js +12 -4
- package/Product/Items/GroupItem.js.map +1 -1
- package/Product/Items/GroupItemPermissions.js.map +1 -1
- package/Product/Items/ImageEffect.js.map +1 -1
- package/Product/Items/ImageItem.d.ts +1 -1
- package/Product/Items/ImageItem.js +58 -35
- package/Product/Items/ImageItem.js.map +1 -1
- package/Product/Items/ImagePermissions.js.map +1 -1
- package/Product/Items/InStringPlaceholder.js +9 -3
- package/Product/Items/InStringPlaceholder.js.map +1 -1
- package/Product/Items/Item.js +44 -27
- package/Product/Items/Item.js.map +1 -1
- package/Product/Items/ItemPermissions.js.map +1 -1
- package/Product/Items/ItemToolbarPermissions.js.map +1 -1
- package/Product/Items/LayoutItem.js +21 -7
- package/Product/Items/LayoutItem.js.map +1 -1
- package/Product/Items/LineItem.js +17 -9
- package/Product/Items/LineItem.js.map +1 -1
- package/Product/Items/LinePermissions.js.map +1 -1
- package/Product/Items/ManipulationPermissions.js +5 -1
- package/Product/Items/ManipulationPermissions.js.map +1 -1
- package/Product/Items/OverlayEffect.js +3 -1
- package/Product/Items/OverlayEffect.js.map +1 -1
- package/Product/Items/PathBoundedTextItem.js +21 -7
- package/Product/Items/PathBoundedTextItem.js.map +1 -1
- package/Product/Items/PathBoundedTextPermissions.js +3 -1
- package/Product/Items/PathBoundedTextPermissions.js.map +1 -1
- package/Product/Items/PlaceholderItem.js +40 -18
- package/Product/Items/PlaceholderItem.js.map +1 -1
- package/Product/Items/PlaceholderPermissions.js.map +1 -1
- package/Product/Items/PlainTextItem.js +6 -2
- package/Product/Items/PlainTextItem.js.map +1 -1
- package/Product/Items/PolylineItem.js +10 -4
- package/Product/Items/PolylineItem.js.map +1 -1
- package/Product/Items/RectangleItem.js +0 -1
- package/Product/Items/RectangleItem.js.map +1 -1
- package/Product/Items/ResizeGripsPermissions.js +5 -1
- package/Product/Items/ResizeGripsPermissions.js.map +1 -1
- package/Product/Items/ShadowSettings.d.ts +0 -1
- package/Product/Items/ShadowSettings.js +15 -17
- package/Product/Items/ShadowSettings.js.map +1 -1
- package/Product/Items/ShapeItem.js +14 -16
- package/Product/Items/ShapeItem.js.map +1 -1
- package/Product/Items/ShapePermissions.js.map +1 -1
- package/Product/Items/SmartItem.js.map +1 -1
- package/Product/Items/StrokeSettings.d.ts +0 -1
- package/Product/Items/StrokeSettings.js +12 -15
- package/Product/Items/StrokeSettings.js.map +1 -1
- package/Product/Items/ThemeBinding.js.map +1 -1
- package/Product/Items/VisualizationPermissions.js.map +1 -1
- package/Product/ItemsData/ItemData.js.map +1 -1
- package/Product/ModelComponent.js +3 -1
- package/Product/ModelComponent.js.map +1 -1
- package/Product/Product.d.ts +1 -1
- package/Product/Product.js +4 -5
- package/Product/Product.js.map +1 -1
- package/Product/SafetyLine.js +29 -11
- package/Product/SafetyLine.js.map +1 -1
- package/Product/Surface.js +15 -6
- package/Product/Surface.js.map +1 -1
- package/Product/SurfaceMockup.d.ts +4 -4
- package/Product/SurfaceMockup.js +5 -5
- package/Product/SurfaceMockup.js.map +1 -1
- package/Product/Uuid.d.ts +1 -1
- package/Product/Uuid.js +7 -7
- package/Product/Uuid.js.map +1 -1
- package/Version.d.ts +1 -1
- package/Version.js +1 -1
- package/Version.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/Colors/ColorFactory.js.map +0 -1
- package/Colors/Utils.js.map +0 -1
- package/ColorsNew/CmykColor.d.ts +0 -17
- package/ColorsNew/CmykColor.js +0 -71
- package/ColorsNew/CmykColor.js.map +0 -1
- package/ColorsNew/Color.d.ts +0 -7
- package/ColorsNew/Color.js +0 -23
- package/ColorsNew/Color.js.map +0 -1
- package/ColorsNew/GrayscaleColor.d.ts +0 -11
- package/ColorsNew/GrayscaleColor.js +0 -50
- package/ColorsNew/GrayscaleColor.js.map +0 -1
- package/ColorsNew/Ink.js.map +0 -1
- package/ColorsNew/Palette.js.map +0 -1
- package/ColorsNew/ProcessColor.d.ts +0 -10
- package/ColorsNew/ProcessColor.js.map +0 -1
- package/ColorsNew/RgbColor.d.ts +0 -15
- package/ColorsNew/RgbColor.js +0 -64
- package/ColorsNew/RgbColor.js.map +0 -1
- package/ColorsNew/SpotColor.d.ts +0 -15
- package/ColorsNew/SpotColor.js +0 -68
- package/ColorsNew/SpotColor.js.map +0 -1
- package/ColorsNew/Swatch.js.map +0 -1
- package/ColorsNew/index.js +0 -10
- package/ColorsNew/index.js.map +0 -1
- /package/{ColorsNew → Colors}/Palette.d.ts +0 -0
- /package/{ColorsNew → Colors}/Palette.js +0 -0
- /package/{Colors → ColorsOld}/ColorFactory.d.ts +0 -0
- /package/{Colors → ColorsOld}/ColorFactory.js +0 -0
- /package/{Colors → ColorsOld}/Utils.d.ts +0 -0
- /package/{Colors → ColorsOld}/Utils.js +0 -0
|
@@ -12,30 +12,43 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
};
|
|
13
13
|
})();
|
|
14
14
|
import { Color } from "./Color";
|
|
15
|
+
import { validateComponent, validateStringProperty } from "./ValidationUtils";
|
|
15
16
|
var ProcessColor = /** @class */ (function (_super) {
|
|
16
17
|
__extends(ProcessColor, _super);
|
|
17
18
|
function ProcessColor(alpha, profile) {
|
|
19
|
+
if (profile === void 0) { profile = null; }
|
|
18
20
|
var _this = _super.call(this) || this;
|
|
19
|
-
_this._alpha = alpha;
|
|
20
|
-
_this._profile = profile;
|
|
21
|
+
_this._alpha = validateComponent(alpha);
|
|
22
|
+
_this._profile = _this._validateProfile(profile);
|
|
21
23
|
return _this;
|
|
22
24
|
}
|
|
23
25
|
Object.defineProperty(ProcessColor.prototype, "alpha", {
|
|
24
|
-
get: function () {
|
|
26
|
+
get: function () {
|
|
27
|
+
return this._alpha;
|
|
28
|
+
},
|
|
25
29
|
enumerable: true,
|
|
26
30
|
configurable: true
|
|
27
31
|
});
|
|
28
32
|
Object.defineProperty(ProcessColor.prototype, "profile", {
|
|
29
|
-
get: function () {
|
|
33
|
+
get: function () {
|
|
34
|
+
return this._profile;
|
|
35
|
+
},
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(ProcessColor.prototype, "isTransparent", {
|
|
40
|
+
get: function () {
|
|
41
|
+
return this.alpha === 0;
|
|
42
|
+
},
|
|
30
43
|
enumerable: true,
|
|
31
44
|
configurable: true
|
|
32
45
|
});
|
|
33
|
-
;
|
|
34
46
|
ProcessColor.prototype.equals = function (other) {
|
|
35
47
|
if (!_super.prototype.equals.call(this, other))
|
|
36
48
|
return false;
|
|
37
49
|
var processOther = other;
|
|
38
|
-
return this.profile
|
|
50
|
+
return this.profile === processOther.profile
|
|
51
|
+
&& this.alpha === processOther.alpha;
|
|
39
52
|
};
|
|
40
53
|
ProcessColor.prototype.getData = function () {
|
|
41
54
|
var data = _super.prototype.getData.call(this);
|
|
@@ -43,6 +56,11 @@ var ProcessColor = /** @class */ (function (_super) {
|
|
|
43
56
|
data.alpha = this.alpha;
|
|
44
57
|
return data;
|
|
45
58
|
};
|
|
59
|
+
ProcessColor.prototype._validateProfile = function (profile) {
|
|
60
|
+
if (profile != null)
|
|
61
|
+
return validateStringProperty(profile);
|
|
62
|
+
return null;
|
|
63
|
+
};
|
|
46
64
|
return ProcessColor;
|
|
47
65
|
}(Color));
|
|
48
66
|
export { ProcessColor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcessColor.js","sourceRoot":"","sources":["../../../src/design-atoms-model/Colors/ProcessColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAU,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAO9E;IAA2C,gCAAK;IAK5C,sBAAY,KAAa,EAAE,OAAsB;QAAtB,wBAAA,EAAA,cAAsB;QAAjD,YACI,iBAAO,SAIV;QAFG,KAAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACvC,KAAI,CAAC,QAAQ,GAAG,KAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;;IACnD,CAAC;IAED,sBAAI,+BAAK;aAAT;YACI,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;;;OAAA;IAED,sBAAI,iCAAO;aAAX;YACI,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IAED,sBAAI,uCAAa;aAAjB;YACI,OAAO,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC;QAC5B,CAAC;;;OAAA;IAED,6BAAM,GAAN,UAAO,KAAY;QACf,IAAI,CAAC,iBAAM,MAAM,YAAC,KAAK,CAAC;YACpB,OAAO,KAAK,CAAC;QAEjB,IAAM,YAAY,GAAiB,KAAK,CAAC;QACzC,OAAO,IAAI,CAAC,OAAO,KAAK,YAAY,CAAC,OAAO;eACrC,IAAI,CAAC,KAAK,KAAK,YAAY,CAAC,KAAK,CAAC;IAC7C,CAAC;IAED,8BAAO,GAAP;QACI,IAAM,IAAI,GAAG,iBAAM,OAAO,WAAmB,CAAC;QAE9C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAExB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,uCAAgB,GAAxB,UAAyB,OAAe;QACpC,IAAG,OAAO,IAAI,IAAI;YACd,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAE3C,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,mBAAC;AAAD,CAAC,AAhDD,CAA2C,KAAK,GAgD/C"}
|
package/Colors/RgbColor.d.ts
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
|
-
import { Color
|
|
2
|
-
|
|
1
|
+
import { Color } from "./Color";
|
|
2
|
+
import { ColorSpace } from "./ColorSpace";
|
|
3
|
+
import { ProcessColor, IProcessColor } from "./ProcessColor";
|
|
4
|
+
export interface IRgbColor extends IProcessColor {
|
|
3
5
|
r: number;
|
|
4
6
|
g: number;
|
|
5
7
|
b: number;
|
|
6
|
-
a?: number;
|
|
7
8
|
}
|
|
8
|
-
export declare class RgbColor extends
|
|
9
|
-
|
|
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;
|
|
9
|
+
export declare class RgbColor extends ProcessColor {
|
|
10
|
+
protected readonly _colorSpace: ColorSpace;
|
|
17
11
|
private _r;
|
|
18
|
-
get r(): number;
|
|
19
|
-
set r(value: number);
|
|
20
12
|
private _g;
|
|
21
|
-
get g(): number;
|
|
22
|
-
set g(value: number);
|
|
23
13
|
private _b;
|
|
14
|
+
constructor(r: number, g: number, b: number, alpha: number, profile?: string);
|
|
15
|
+
get r(): number;
|
|
16
|
+
get g(): number;
|
|
24
17
|
get b(): number;
|
|
25
|
-
|
|
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;
|
|
18
|
+
equals(other: Color): boolean;
|
|
33
19
|
clone(): RgbColor;
|
|
20
|
+
getData(): IRgbColor;
|
|
34
21
|
toString(): string;
|
|
35
|
-
equals(other: Color): boolean;
|
|
36
|
-
protected _getPreview(): string;
|
|
37
|
-
protected _init(colorObject: IRgbColor): void;
|
|
38
|
-
private _updatePreview;
|
|
39
22
|
}
|
package/Colors/RgbColor.js
CHANGED
|
@@ -11,199 +11,66 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
11
11
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
12
|
};
|
|
13
13
|
})();
|
|
14
|
-
import {
|
|
14
|
+
import { ColorSpace } from "./ColorSpace";
|
|
15
|
+
import { ProcessColor } from "./ProcessColor";
|
|
16
|
+
import { validateComponent } from "./ValidationUtils";
|
|
15
17
|
var RgbColor = /** @class */ (function (_super) {
|
|
16
18
|
__extends(RgbColor, _super);
|
|
17
|
-
function RgbColor(
|
|
18
|
-
|
|
19
|
-
_this
|
|
20
|
-
_this.
|
|
21
|
-
_this.
|
|
22
|
-
_this.
|
|
23
|
-
|
|
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
|
-
}
|
|
19
|
+
function RgbColor(r, g, b, alpha, profile) {
|
|
20
|
+
if (profile === void 0) { profile = null; }
|
|
21
|
+
var _this = _super.call(this, alpha, profile) || this;
|
|
22
|
+
_this._colorSpace = ColorSpace.Rgb;
|
|
23
|
+
_this._r = validateComponent(r);
|
|
24
|
+
_this._g = validateComponent(g);
|
|
25
|
+
_this._b = validateComponent(b);
|
|
48
26
|
return _this;
|
|
49
27
|
}
|
|
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
28
|
Object.defineProperty(RgbColor.prototype, "r", {
|
|
115
|
-
get: function () {
|
|
116
|
-
|
|
29
|
+
get: function () {
|
|
30
|
+
return this._r;
|
|
31
|
+
},
|
|
117
32
|
enumerable: true,
|
|
118
33
|
configurable: true
|
|
119
34
|
});
|
|
120
|
-
;
|
|
121
|
-
;
|
|
122
35
|
Object.defineProperty(RgbColor.prototype, "g", {
|
|
123
|
-
get: function () {
|
|
124
|
-
|
|
36
|
+
get: function () {
|
|
37
|
+
return this._g;
|
|
38
|
+
},
|
|
125
39
|
enumerable: true,
|
|
126
40
|
configurable: true
|
|
127
41
|
});
|
|
128
|
-
;
|
|
129
|
-
;
|
|
130
42
|
Object.defineProperty(RgbColor.prototype, "b", {
|
|
131
|
-
get: function () {
|
|
132
|
-
|
|
43
|
+
get: function () {
|
|
44
|
+
return this._b;
|
|
45
|
+
},
|
|
133
46
|
enumerable: true,
|
|
134
47
|
configurable: true
|
|
135
48
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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);
|
|
49
|
+
RgbColor.prototype.equals = function (other) {
|
|
50
|
+
var rgbOther = other;
|
|
51
|
+
return _super.prototype.equals.call(this, other)
|
|
52
|
+
&& this.r === rgbOther.r
|
|
53
|
+
&& this.g === rgbOther.g
|
|
54
|
+
&& this.b === rgbOther.b;
|
|
154
55
|
};
|
|
155
|
-
RgbColor.
|
|
156
|
-
RgbColor.
|
|
157
|
-
return RgbColor._rgb.exec(string);
|
|
56
|
+
RgbColor.prototype.clone = function () {
|
|
57
|
+
return new RgbColor(this.r, this.g, this.b, this.alpha, this.profile);
|
|
158
58
|
};
|
|
159
59
|
RgbColor.prototype.getData = function () {
|
|
160
60
|
var data = _super.prototype.getData.call(this);
|
|
161
61
|
data.r = this.r;
|
|
162
62
|
data.g = this.g;
|
|
163
63
|
data.b = this.b;
|
|
164
|
-
data.a = this.a;
|
|
165
64
|
return data;
|
|
166
65
|
};
|
|
167
|
-
RgbColor.prototype.clone = function () {
|
|
168
|
-
return new RgbColor(this);
|
|
169
|
-
};
|
|
170
66
|
RgbColor.prototype.toString = function () {
|
|
171
|
-
|
|
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) {
|
|
67
|
+
if (this.alpha === 255) {
|
|
181
68
|
return "rgb(" + this.r + "," + this.g + "," + this.b + ")";
|
|
182
69
|
}
|
|
183
|
-
|
|
184
|
-
|
|
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();
|
|
70
|
+
var a = (this.alpha / 255).toFixed(7);
|
|
71
|
+
return "rgba(" + this.r + "," + this.g + "," + this.b + "," + a + ")";
|
|
203
72
|
};
|
|
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
73
|
return RgbColor;
|
|
207
|
-
}(
|
|
74
|
+
}(ProcessColor));
|
|
208
75
|
export { RgbColor };
|
|
209
76
|
//# sourceMappingURL=RgbColor.js.map
|
package/Colors/RgbColor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RgbColor.js","sourceRoot":"","sources":["../../../src/design-atoms-model/Colors/RgbColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"RgbColor.js","sourceRoot":"","sources":["../../../src/design-atoms-model/Colors/RgbColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQtD;IAA8B,4BAAY;IAQtC,kBAAmB,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa,EAAE,OAAsB;QAAtB,wBAAA,EAAA,cAAsB;QAAzF,YACI,kBAAM,KAAK,EAAE,OAAO,CAAC,SAKxB;QAZkB,iBAAW,GAAe,UAAU,CAAC,GAAG,CAAC;QASxD,KAAI,CAAC,EAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC/B,KAAI,CAAC,EAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC/B,KAAI,CAAC,EAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;;IACnC,CAAC;IAED,sBAAI,uBAAC;aAAL;YACI,OAAO,IAAI,CAAC,EAAE,CAAC;QACnB,CAAC;;;OAAA;IAED,sBAAI,uBAAC;aAAL;YACI,OAAO,IAAI,CAAC,EAAE,CAAC;QACnB,CAAC;;;OAAA;IAED,sBAAI,uBAAC;aAAL;YACI,OAAO,IAAI,CAAC,EAAE,CAAC;QACnB,CAAC;;;OAAA;IAED,yBAAM,GAAN,UAAO,KAAY;QACf,IAAM,QAAQ,GAAa,KAAK,CAAC;QAEjC,OAAO,iBAAM,MAAM,YAAC,KAAK,CAAC;eACnB,IAAI,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;eACrB,IAAI,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;eACrB,IAAI,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC;IACjC,CAAC;IAED,wBAAK,GAAL;QACI,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED,0BAAO,GAAP;QACI,IAAM,IAAI,GAAG,iBAAM,OAAO,WAAe,CAAC;QAE1C,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAEhB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,2BAAQ,GAAR;QACI,IAAG,IAAI,CAAC,KAAK,KAAK,GAAG,EAAE;YACnB,OAAO,SAAO,IAAI,CAAC,CAAC,SAAI,IAAI,CAAC,CAAC,SAAI,IAAI,CAAC,CAAC,MAAG,CAAC;SAC/C;QAED,IAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAExC,OAAO,UAAQ,IAAI,CAAC,CAAC,SAAI,IAAI,CAAC,CAAC,SAAI,IAAI,CAAC,CAAC,SAAI,CAAC,MAAG,CAAC;IACtD,CAAC;IACL,eAAC;AAAD,CAAC,AA5DD,CAA8B,YAAY,GA4DzC"}
|
package/Colors/SpotColor.d.ts
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { Color, IColor } from "./Color";
|
|
2
|
+
import { ColorSpace } from "./ColorSpace";
|
|
3
|
+
import { IInk, Ink } from "./Ink";
|
|
2
4
|
export interface ISpotColor extends IColor {
|
|
3
|
-
|
|
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;
|
|
5
|
+
ink: IInk;
|
|
17
6
|
tint: number;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
alpha: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class SpotColor extends Color {
|
|
10
|
+
protected readonly _colorSpace: ColorSpace;
|
|
11
|
+
private _ink;
|
|
12
|
+
private _tint;
|
|
13
|
+
private _alpha;
|
|
14
|
+
constructor(ink: Ink, tint: number, alpha?: number);
|
|
15
|
+
get ink(): Ink;
|
|
16
|
+
get tint(): number;
|
|
17
|
+
get alpha(): number;
|
|
18
|
+
get isTransparent(): boolean;
|
|
19
|
+
equals(other: Color): boolean;
|
|
20
|
+
clone(): Color;
|
|
22
21
|
getData(): ISpotColor;
|
|
23
|
-
protected _getPreview(): string;
|
|
24
|
-
protected _init(colorObject: ISpotColor): void;
|
|
25
22
|
}
|
package/Colors/SpotColor.js
CHANGED
|
@@ -12,101 +12,66 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
};
|
|
13
13
|
})();
|
|
14
14
|
import { Color } from "./Color";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { ColorSpace } from "./ColorSpace";
|
|
16
|
+
import { Ink } from "./Ink";
|
|
17
|
+
import { validateComponent } from "./ValidationUtils";
|
|
17
18
|
var SpotColor = /** @class */ (function (_super) {
|
|
18
19
|
__extends(SpotColor, _super);
|
|
19
|
-
function SpotColor(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
}
|
|
20
|
+
function SpotColor(ink, tint, alpha) {
|
|
21
|
+
if (alpha === void 0) { alpha = 255; }
|
|
22
|
+
var _this = _super.call(this) || this;
|
|
23
|
+
_this._colorSpace = ColorSpace.Spot;
|
|
24
|
+
_this._ink = ink;
|
|
25
|
+
_this._tint = validateComponent(tint);
|
|
26
|
+
_this._alpha = validateComponent(alpha);
|
|
38
27
|
return _this;
|
|
39
28
|
}
|
|
40
|
-
Object.defineProperty(SpotColor.prototype, "
|
|
41
|
-
get: function () {
|
|
29
|
+
Object.defineProperty(SpotColor.prototype, "ink", {
|
|
30
|
+
get: function () {
|
|
31
|
+
return this._ink;
|
|
32
|
+
},
|
|
42
33
|
enumerable: true,
|
|
43
34
|
configurable: true
|
|
44
35
|
});
|
|
45
|
-
SpotColor.prototype
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
36
|
+
Object.defineProperty(SpotColor.prototype, "tint", {
|
|
37
|
+
get: function () {
|
|
38
|
+
return this._tint;
|
|
39
|
+
},
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(SpotColor.prototype, "alpha", {
|
|
44
|
+
get: function () {
|
|
45
|
+
return this._alpha;
|
|
46
|
+
},
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(SpotColor.prototype, "isTransparent", {
|
|
51
|
+
get: function () {
|
|
52
|
+
return this.alpha === 0;
|
|
53
|
+
},
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true
|
|
56
|
+
});
|
|
57
|
+
SpotColor.prototype.equals = function (other) {
|
|
58
|
+
var spotOther = other;
|
|
59
|
+
return _super.prototype.equals.call(this, other)
|
|
60
|
+
&& Ink.equals(this.ink, spotOther.ink)
|
|
61
|
+
&& this.tint === spotOther.tint
|
|
62
|
+
&& this.alpha === spotOther.alpha;
|
|
64
63
|
};
|
|
65
64
|
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;
|
|
65
|
+
return new SpotColor(this.ink.clone(), this.tint, this.alpha);
|
|
79
66
|
};
|
|
80
67
|
SpotColor.prototype.getData = function () {
|
|
81
68
|
var data = _super.prototype.getData.call(this);
|
|
82
|
-
data.
|
|
83
|
-
data.inkColor = this.inkColor.getData();
|
|
84
|
-
data.inkSolidity = this.inkSolidity;
|
|
85
|
-
data.alpha = this.alpha;
|
|
69
|
+
data.ink = this.ink.getData();
|
|
86
70
|
data.tint = this.tint;
|
|
71
|
+
data.alpha = this.alpha;
|
|
87
72
|
return data;
|
|
88
73
|
};
|
|
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
74
|
return SpotColor;
|
|
109
75
|
}(Color));
|
|
110
76
|
export { SpotColor };
|
|
111
|
-
ColorFactory.registerColor("SpotColor", "spot", SpotColor);
|
|
112
77
|
//# sourceMappingURL=SpotColor.js.map
|
package/Colors/SpotColor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotColor.js","sourceRoot":"","sources":["../../../src/design-atoms-model/Colors/SpotColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"SpotColor.js","sourceRoot":"","sources":["../../../src/design-atoms-model/Colors/SpotColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAU,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAQ,GAAG,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQtD;IAA+B,6BAAK;IAQhC,mBAAY,GAAQ,EAAE,IAAY,EAAE,KAAmB;QAAnB,sBAAA,EAAA,WAAmB;QAAvD,YACI,iBAAO,SAKV;QAZkB,iBAAW,GAAe,UAAU,CAAC,IAAI,CAAC;QASzD,KAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,KAAI,CAAC,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACrC,KAAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;;IAC3C,CAAC;IAED,sBAAI,0BAAG;aAAP;YACI,OAAO,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC;;;OAAA;IAED,sBAAI,2BAAI;aAAR;YACI,OAAO,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;;;OAAA;IAED,sBAAI,4BAAK;aAAT;YACI,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;;;OAAA;IAED,sBAAI,oCAAa;aAAjB;YACI,OAAO,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC;QAC5B,CAAC;;;OAAA;IAED,0BAAM,GAAN,UAAO,KAAY;QACf,IAAM,SAAS,GAAc,KAAK,CAAC;QAEnC,OAAO,iBAAM,MAAM,YAAC,KAAK,CAAC;eACnB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC;eACnC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;eAC5B,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,KAAK,CAAC;IAC1C,CAAC;IAED,yBAAK,GAAL;QACI,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAClE,CAAC;IAED,2BAAO,GAAP;QACI,IAAM,IAAI,GAAG,iBAAM,OAAO,WAAgB,CAAC;QAE3C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAExB,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,gBAAC;AAAD,CAAC,AAtDD,CAA+B,KAAK,GAsDnC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ModelComponent } from "../Product/ModelComponent";
|
|
2
2
|
import { Color } from "./Color";
|
|
3
3
|
export declare class Swatch extends ModelComponent {
|
|
4
|
-
|
|
4
|
+
private _color;
|
|
5
|
+
get color(): Color;
|
|
6
|
+
set color(value: Color);
|
|
5
7
|
clone(generateNewIds?: boolean): Swatch;
|
|
6
8
|
equals(other: Swatch): boolean;
|
|
7
9
|
protected _copy(source: Swatch, destination: Swatch, generateNewIds: boolean): void;
|
|
@@ -18,6 +18,16 @@ var Swatch = /** @class */ (function (_super) {
|
|
|
18
18
|
function Swatch() {
|
|
19
19
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
20
20
|
}
|
|
21
|
+
Object.defineProperty(Swatch.prototype, "color", {
|
|
22
|
+
get: function () {
|
|
23
|
+
return this._color;
|
|
24
|
+
},
|
|
25
|
+
set: function (value) {
|
|
26
|
+
this._color = value;
|
|
27
|
+
},
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true
|
|
30
|
+
});
|
|
21
31
|
Swatch.prototype.clone = function (generateNewIds) {
|
|
22
32
|
if (generateNewIds === void 0) { generateNewIds = false; }
|
|
23
33
|
var result = new Swatch();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Swatch.js","sourceRoot":"","sources":["../../../src/design-atoms-model/Colors/Swatch.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;IAA4B,0BAAc;IAA1C;;IA8BA,CAAC;IA1BG,sBAAI,yBAAK;aAAT;YACI,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;aAED,UAAU,KAAY;YAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACxB,CAAC;;;OAJA;IAMD,sBAAK,GAAL,UAAM,cAA+B;QAA/B,+BAAA,EAAA,sBAA+B;QACjC,IAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;QACzC,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,uBAAM,GAAN,UAAO,KAAa;QAChB,IAAI,CAAC,iBAAM,MAAM,YAAC,KAAK,CAAC;YACpB,OAAO,KAAK,CAAC;QAEjB,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAES,sBAAK,GAAf,UAAgB,MAAc,EAAE,WAAmB,EAAE,cAAuB;;QACxE,iBAAM,KAAK,YAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QAEjD,WAAW,CAAC,KAAK,SAAG,MAAM,CAAC,KAAK,0CAAE,KAAK,EAAE,CAAC;IAC9C,CAAC;IACL,aAAC;AAAD,CAAC,AA9BD,CAA4B,cAAc,GA8BzC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ArgumentException } from "../Exception";
|
|
2
|
+
import { isNullOrEmptyOrWhiteSpace } from "../Utils/Utils";
|
|
3
|
+
export function validateStringProperty(value) {
|
|
4
|
+
if (isNullOrEmptyOrWhiteSpace(value))
|
|
5
|
+
throw new ArgumentException("Value must be a non-empty string");
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
export function validateComponent(value, min, max) {
|
|
9
|
+
if (min === void 0) { min = 0; }
|
|
10
|
+
if (max === void 0) { max = 255; }
|
|
11
|
+
if (typeof value != "number")
|
|
12
|
+
throw new ArgumentException("Value must be a number");
|
|
13
|
+
if (value < min || value > max)
|
|
14
|
+
throw new ArgumentException("Value must be in range [" + min + ", " + max + "]");
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ValidationUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationUtils.js","sourceRoot":"","sources":["../../../src/design-atoms-model/Colors/ValidationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,UAAU,sBAAsB,CAAE,KAAa;IACjD,IAAI,yBAAyB,CAAC,KAAK,CAAC;QAChC,MAAM,IAAI,iBAAiB,CAAC,kCAAkC,CAAC,CAAC;IAEpE,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,GAAe,EAAE,GAAiB;IAAlC,oBAAA,EAAA,OAAe;IAAE,oBAAA,EAAA,SAAiB;IAC/E,IAAI,OAAO,KAAK,IAAI,QAAQ;QACxB,MAAM,IAAI,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;IAE1D,IAAI,KAAK,GAAG,GAAG,IAAI,KAAK,GAAG,GAAG;QAC1B,MAAM,IAAI,iBAAiB,CAAC,6BAA2B,GAAG,UAAK,GAAG,MAAG,CAAC,CAAC;IAE3E,OAAO,KAAK,CAAC;AACjB,CAAC"}
|