UNPKG

@aurigma/design-atoms-model

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

769 lines 34.7 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; import { RectangleItem } from "./RectangleItem"; import { Color, RgbColors } from "../../Colors"; import { StrokeSettings } from "./StrokeSettings"; import { ShadowSettings } from "./ShadowSettings"; import { TextPermissions } from "./TextPermissions"; import { ArgumentException } from "../../Exception"; import * as Utils from "../../Utils/Utils"; import * as _ from "underscore"; import * as Math from "../../Math/index"; import { TextAlignment } from "./TextEnums"; import { EventWithSenderArg } from "../../EventObject"; import { Collection } from "../../Collection"; import { equals, arrayEquals } from "../../Utils/Utils"; import { Property } from "../Decorators/Property"; import { SimplePropertyFactory, ObjectPropertyFactory } from "../Decorators/Factory"; import { ModelComponent } from "../ModelComponent"; import { TextViolationSettings } from "./TextViolationSettings"; var BaseTextItem = /** @class */ (function (_super) { __extends(BaseTextItem, _super); function BaseTextItem(text, fontPostScriptName, fontSize) { var _this = _super.call(this) || this; _this._text = ""; _this._originalText = ""; _this._underline = false; _this._color = RgbColors.black; _this._alignment = TextAlignment.Left; _this._tracking = 0; _this._leading = 0; _this._checkTextCrop = true; _this._overlapLinesEnabled = false; _this._verticalScale = 1; _this._horizontalScale = 1; _this._stroke = null; _this._shadow = null; _this._previewScale = 1; _this._placeholders = new Collection(); _this._displayText = null; _this._colorPalette = new Collection(); _this._baselineShift = 0; _this._overprintText = false; _this.values = []; _this._characterLimit = null; _this._maxLineLength = null; _this._maxLineCount = null; _this.isTextPlaceholder = false; _this.textColorForAbnormalRendering = RgbColors.black; _this.type = BaseTextItem.type; _this._onFontPropertyChanged = function (s, p) { _this._propertyChanged.notify(_this, "font"); }; _this._onShadowPropertyChanged = function (s, p) { _this._propertyChanged.notify(_this, "shadow"); }; _this._onStrokePropertyChanged = function (s, p) { _this._propertyChanged.notify(_this, "stroke"); }; _this.borderWidth = 0; _this.fillColor = RgbColors.transparent; _this.text = (text != null) ? text : ""; _this._font = new BaseTextItem.FontSettings(fontPostScriptName, (fontSize != null) ? fontSize : 10); _this._subscribeFontPropertyChanged(); _this.textPermissions = new TextPermissions(); _this._setViolationSettings(new TextViolationSettings(), true); var textUpdatedFunc = function () { _this._displayText = null; _this._propertyChanged.notify(_this, "text"); }; _this._placeholders.add_itemAdded(function (data) { return data.item.addPropertyChanged(textUpdatedFunc); }); _this._placeholders.add_itemRemoved(function (data) { return data.item.removePropertyChanged(textUpdatedFunc); }); _this._ignorePermissionsChange = true; _this.itemPermissions.allowRemoveOnLayoutChange = true; _this.itemPermissions.itemToolbarPermissions.showEditButton = true; _this._ignorePermissionsChange = false; return _this; } Object.defineProperty(BaseTextItem.prototype, "characterLimit", { get: function () { return this._characterLimit; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._characterLimit, value)) return; this._characterLimit = value; if (value != null) this._propertyChanged.notify(this, "characterLimit"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "maxLineCount", { get: function () { return this._maxLineCount; }, set: function (value) { if (this._maxLineCount === value) return; this._maxLineCount = value; this._displayText = null; this._propertyChanged.notify(this, "maxLineCount"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "maxLineLength", { get: function () { return this._maxLineLength; }, set: function (value) { if (this._maxLineLength === value) return; this._maxLineLength = value; this._displayText = null; this._propertyChanged.notify(this, "maxLineLength"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "previewScale", { get: function () { return this._previewScale; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._previewScale, value)) return; this._previewScale = value; this._propertyChanged.notify(this, "previewScale"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "stroke", { get: function () { return this._stroke; }, set: function (value) { if (StrokeSettings.equals(this._stroke, value)) return; this._unsubscribeStrokePropertyChanged(); this._stroke = value; this._subscribeStrokePropertyChanged(); this._propertyChanged.notify(this, "stroke"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "shadow", { get: function () { return this._shadow; }, set: function (value) { if (this._shadow == null && value == null || (value != null && value.equals(this._shadow))) return; this._unsubscribeShadowPropertyChanged(); this._shadow = value; this._subscribeShadowPropertyChanged(); this._propertyChanged.notify(this, "shadow"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "horizontalScale", { get: function () { return this._horizontalScale; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._horizontalScale, value)) return; this._horizontalScale = value; this._propertyChanged.notify(this, "horizontalScale"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "verticalScale", { get: function () { return this._verticalScale; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._verticalScale, value)) return; this._verticalScale = value; this._propertyChanged.notify(this, "verticalScale"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "checkTextCrop", { get: function () { return this._checkTextCrop; }, set: function (value) { if (this._checkTextCrop === value) return; this._checkTextCrop = value; this._propertyChanged.notify(this, "checkTextCrop"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "overlapLinesEnabled", { get: function () { return this._overlapLinesEnabled; }, set: function (value) { if (this._overlapLinesEnabled === value) return; this._overlapLinesEnabled = value; this._propertyChanged.notify(this, "overlapLinesEnabled"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "alignment", { get: function () { return this._alignment; }, set: function (value) { if (this._alignment === value) return; this._alignment = value; this._propertyChanged.notify(this, "alignment"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "tracking", { get: function () { return this._tracking; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._tracking, value)) return; this._tracking = value; this._propertyChanged.notify(this, "tracking"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "leading", { get: function () { return this._leading; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._leading, value)) return; this._leading = value; this._propertyChanged.notify(this, "leading"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "originalText", { get: function () { return this._originalText != null ? this._originalText : ""; }, set: function (value) { this._originalText = value; }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "underline", { get: function () { return this._underline; }, set: function (value) { if (this._underline === value) return; this._underline = value; this._propertyChanged.notify(this, "underline"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "font", { get: function () { return this._font; }, set: function (value) { if (BaseTextItem.FontSettings.equals(this._font, value)) return; this._unsubscribeFontPropertyChanged(); this._font = value; this._subscribeFontPropertyChanged(); this._propertyChanged.notify(this, "font"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "text", { get: function () { if (this._displayText == null) this._displayText = this.getUpdatedText(this._text); this._text = this._displayText; return this._text; }, set: function (value) { if (this._text === value) return; this._text = value; this._displayText = null; this._propertyChanged.notify(this, "text"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "color", { get: function () { return this._color; }, set: function (value) { if (Color.equals(this._color, value)) return; this._color = value; this._propertyChanged.notify(this, "color"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "baselineShift", { get: function () { return this._baselineShift; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._baselineShift, value)) return; this._baselineShift = value; this._propertyChanged.notify(this, "baselineShift"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "overprintText", { get: function () { return this._overprintText; }, set: function (value) { if (value == this._overprintText) return; this._overprintText = value; this._propertyChanged.notify(this, "overprintText"); }, enumerable: true, configurable: true }); BaseTextItem.prototype.getUpdatedText = function (text) { var updatedText = text; if (this.placeholders.length > 0) updatedText = this._replaceInStringPlaceholders(); return updatedText; }; Object.defineProperty(BaseTextItem.prototype, "placeholders", { get: function () { return this._placeholders; }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "colorPalette", { get: function () { return this._colorPalette; }, enumerable: true, configurable: true }); BaseTextItem.prototype._canSetIsVariable = function () { return true; }; Object.defineProperty(BaseTextItem.prototype, "previewFontSize", { get: function () { return this.font.size * this.previewScale; }, set: function (value) { this.font.size = value / this.previewScale; }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "previewLeading", { get: function () { return this.leading * this.previewScale; }, set: function (value) { this.leading = value / this.previewScale; }, enumerable: true, configurable: true }); BaseTextItem.prototype.applyPermissionsConstrain = function () { _super.prototype.applyPermissionsConstrain.call(this); this.itemPermissions.itemToolbarPermissions.showSelectButton = false; if (this.textPermissions != null && !this.textPermissions.allowChangeText) this.itemPermissions.itemToolbarPermissions.showEditButtonConstraint = false; else this.itemPermissions.itemToolbarPermissions.showEditButtonConstraint = null; if (this.isRenderTypeIsNormal) return; this.textPermissions.allowChangeFontColor = false; this.textPermissions.allowChangeShadow = false; this.textPermissions.allowChangeStroke = false; }; Object.defineProperty(BaseTextItem.prototype, "textPermissions", { get: function () { return this._textPermissions; }, set: function (value) { if (value == null) throw new ArgumentException("textPermissions cannot be null"); if (equals(this._textPermissions, value)) return; if (this._textPermissions != null) this._textPermissions.propertyChanged.remove(this._onPermissionsChanged); this._textPermissions = value; this.applyPermissionsConstrain(); this._textPermissions.propertyChanged.add(this._onPermissionsChanged); this._propertyChanged.notify(this, "textPermissions"); }, enumerable: true, configurable: true }); Object.defineProperty(BaseTextItem.prototype, "violationSettings", { get: function () { return this._violationSettings; }, set: function (value) { this._setViolationSettings(value); }, enumerable: true, configurable: true }); BaseTextItem.prototype._setViolationSettings = function (value, skipTypeCheck) { if (skipTypeCheck === void 0) { skipTypeCheck = false; } if (!skipTypeCheck && !(value instanceof TextViolationSettings)) throw new ArgumentException("Shape ViolationSettings property must has TextViolationSettings type!"); _super.prototype._setViolationSettings.call(this, value, skipTypeCheck); }; BaseTextItem.prototype._subscribeFontPropertyChanged = function () { if (this._font != null) this._font.addPropertyChanged(this._onFontPropertyChanged); }; BaseTextItem.prototype._unsubscribeFontPropertyChanged = function () { if (this._font != null) this._font.removePropertyChanged(this._onFontPropertyChanged); }; BaseTextItem.prototype._subscribeShadowPropertyChanged = function () { if (this._shadow != null) this._shadow.addPropertyChanged(this._onShadowPropertyChanged); }; BaseTextItem.prototype._unsubscribeShadowPropertyChanged = function () { if (this._shadow != null) this._shadow.removePropertyChanged(this._onShadowPropertyChanged); }; BaseTextItem.prototype._subscribeStrokePropertyChanged = function () { if (this._stroke != null) this._stroke.addPropertyChanged(this._onStrokePropertyChanged); }; BaseTextItem.prototype._unsubscribeStrokePropertyChanged = function () { if (this._stroke != null) this._stroke.removePropertyChanged(this._onStrokePropertyChanged); }; BaseTextItem.prototype.getSimplifiedObject = function (omitProperties) { var simplified = _super.prototype.getSimplifiedObject.call(this, ["_placeholders", "currentTextImage", "textPermissions", "textForTextWhizz", "shadow", "stroke"].concat(omitProperties)); simplified["placeholders"] = this.placeholders.toArray(); simplified["textPermissions"] = this.textPermissions.getSimplifiedObject(); simplified["font"] = this.font.getSimplifiedObject(); simplified["shadow"] = this.shadow != null ? this.shadow.getSimplifiedObject() : null; simplified["stroke"] = this.stroke != null ? this.stroke.getSimplifiedObject() : null; return simplified; }; BaseTextItem.prototype._replaceInStringPlaceholders = function () { return Utils.isValidXml(this.originalText) ? this._replaceInStringPlaceholdersValueInRichText() : this._replaceInStringPlaceholdersValueInPlainText(); }; BaseTextItem.prototype._replaceInStringPlaceholdersValueInPlainText = function () { var value = this.originalText; this.placeholders.forEach(function (p) { value = value.replace(p.id, p.value === "" ? p.name : p.value); }); return value; }; BaseTextItem.prototype._replaceInStringPlaceholdersValueInRichText = function () { if (this._originalTextDom == null) { var domParser = new DOMParser(); this._originalTextDom = domParser.parseFromString("<xml>" + this.originalText + "</xml>", "text/xml"); } var xmlDom = this._originalTextDom.cloneNode(true); var spans = xmlDom.getElementsByTagName("span"); this.placeholders.forEach(function (p) { if (spans != null && spans.length) { for (var i = 0; i < spans.length; i++) { var span = spans[i]; if (span.textContent != null) { span.textContent = span.textContent.replace(p.id, p.value === "" ? p.name : p.value); } } } }); var serializer = new XMLSerializer(); var str = serializer.serializeToString(xmlDom); return str.substr(0, str.length - 6).substr(5); // without <xml> and </xml> }; BaseTextItem.prototype._copy = function (source, destination, generateNewIds, appropriateParentContainer) { var e_1, _a; _super.prototype._copy.call(this, source, destination, generateNewIds, appropriateParentContainer); destination.textPermissions = source._textPermissions.clone(); destination.placeholders.setRange(source.placeholders.toArray().map(function (p) { return p.clone(); })); destination.color = source._color.clone(); destination.text = source._text; destination.font = source._font.clone(); destination.underline = source._underline; destination.originalText = source._originalText; destination.leading = source._leading; destination.tracking = source._tracking; destination.alignment = source._alignment; destination.checkTextCrop = source._checkTextCrop; destination.verticalScale = source._verticalScale; destination.horizontalScale = source._horizontalScale; destination.shadow = source._shadow != null ? source._shadow.clone() : null; destination.stroke = source._stroke != null ? source._stroke.clone() : null; destination.previewScale = source._previewScale; destination._maxLineCount = source._maxLineCount; destination.isTextPlaceholder = source.isTextPlaceholder; destination.maxLineLength = source.maxLineLength; destination.overlapLinesEnabled = source.overlapLinesEnabled; destination.colorPalette.setRange(source.colorPalette.toArray().map(function (c) { return c.clone(); })); destination.baselineShift = source.baselineShift; destination.overprintText = source.overprintText; destination.listStyles = source.listStyles; destination.characterLimit = source.characterLimit; if (source.values != null) { destination.values = []; try { for (var _b = __values(source.values), _c = _b.next(); !_c.done; _c = _b.next()) { var i = _c.value; destination.values.push(i.clone()); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } } }; BaseTextItem.prototype.equals = function (other) { var superEq = _super.prototype.equals.call(this, other); var textPermissionsEq = equals(this._textPermissions, other._textPermissions); var placeholdersEq = arrayEquals(this._placeholders.toArray(), other._placeholders.toArray()); var colorEq = equals(this._color, other._color); var textEq = equals(this._text, other._text); var fontEq = equals(this._font, other._font); var underlineEq = equals(this._underline, other._underline); var originalTextEq = equals(this._originalText, other._originalText); var leadingEq = equals(this._leading, other._leading); var trackingEq = equals(this._tracking, other._tracking); var alignmentEq = equals(this._alignment, other._alignment); var checkTextCropEq = equals(this._checkTextCrop, other._checkTextCrop); var verticalScaleEq = equals(this._verticalScale, other._verticalScale); var previewScaleEq = equals(this._previewScale, other._previewScale); var maxLineCountEq = equals(this._maxLineCount, other._maxLineCount); var isTextPlaceholderEq = equals(this.isTextPlaceholder, other.isTextPlaceholder); var maxLineLengthEq = equals(this._maxLineLength, other._maxLineLength); var overlapLinesEnabledEq = equals(this._overlapLinesEnabled, other._overlapLinesEnabled); var strokeEq = equals(this._stroke, other._stroke); var valuesEq = arrayEquals(this.values, other.values); var colorPaletteEq = arrayEquals(this._colorPalette.toArray(), other._colorPalette.toArray()); var baselineShiftEq = equals(this._baselineShift, other._baselineShift); var overprintTextEq = equals(this._overprintText, other._overprintText); var listStylesEq = equals(this.listStyles, other.listStyles); var characterLimitEq = equals(this.characterLimit, other.characterLimit); return superEq && textPermissionsEq && placeholdersEq && colorEq && textEq && fontEq && underlineEq && originalTextEq && leadingEq && trackingEq && alignmentEq && checkTextCropEq && verticalScaleEq && previewScaleEq && maxLineCountEq && isTextPlaceholderEq && maxLineLengthEq && overlapLinesEnabledEq && strokeEq && valuesEq && colorPaletteEq && baselineShiftEq && overprintTextEq && listStylesEq && characterLimitEq; }; BaseTextItem.prototype.isEmptyText = function () { return this.text === ""; }; BaseTextItem.prototype.isEmptyXmlText = function () { return this.text === "<p></p>" || this.text === "<p><span></span></p>"; }; BaseTextItem.prototype.isEmpty = function () { return !this.isTextPlaceholder && (this.isEmptyText() || this.isEmptyXmlText()); }; BaseTextItem.type = "baseText"; __decorate([ Property({ factory: new SimplePropertyFactory(50), displayName: "Character Limit" }), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], BaseTextItem.prototype, "characterLimit", null); __decorate([ Property({ factory: new SimplePropertyFactory(1), displayName: "Max line count" }), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], BaseTextItem.prototype, "maxLineCount", null); __decorate([ Property({ factory: new SimplePropertyFactory(50), displayName: "Max line length" }), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], BaseTextItem.prototype, "maxLineLength", null); __decorate([ Property({ factory: new ObjectPropertyFactory(StrokeSettings), displayName: "Stroke" }), __metadata("design:type", StrokeSettings), __metadata("design:paramtypes", [StrokeSettings]) ], BaseTextItem.prototype, "stroke", null); __decorate([ Property({ factory: new ObjectPropertyFactory(ShadowSettings), displayName: "Shadow" }), __metadata("design:type", ShadowSettings), __metadata("design:paramtypes", [ShadowSettings]) ], BaseTextItem.prototype, "shadow", null); __decorate([ Property({ enumObject: TextAlignment }), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], BaseTextItem.prototype, "alignment", null); __decorate([ Property({ type: "string" }), __metadata("design:type", String) ], BaseTextItem.prototype, "listStyles", void 0); return BaseTextItem; }(RectangleItem)); export { BaseTextItem }; (function (BaseTextItem) { var FontSettings = /** @class */ (function (_super) { __extends(FontSettings, _super); function FontSettings(postScriptName, size) { if (size === void 0) { size = 10; } var _this = _super.call(this) || this; _this._fauxBold = false; _this._fauxItalic = false; _this._allCaps = false; _this._openTypeFeatures = []; _this.$_propertyChanged = new EventWithSenderArg(); _this._postScriptName = postScriptName; _this._size = size; return _this; } FontSettings.prototype.clone = function () { var clone = new FontSettings(this._postScriptName, this._size); clone._openTypeFeatures = _.clone(this._openTypeFeatures); clone.allCaps = this._allCaps; clone.fauxItalic = this._fauxItalic; clone.fauxBold = this._fauxBold; return clone; }; Object.defineProperty(FontSettings.prototype, "fauxBold", { get: function () { return this._fauxBold; }, set: function (value) { if (this._fauxBold === value) return; this._fauxBold = value; this.$_propertyChanged.notify(this, "fauxBold"); }, enumerable: true, configurable: true }); Object.defineProperty(FontSettings.prototype, "fauxItalic", { get: function () { return this._fauxItalic; }, set: function (value) { if (this._fauxItalic === value) return; this._fauxItalic = value; this.$_propertyChanged.notify(this, "fauxItalic"); }, enumerable: true, configurable: true }); Object.defineProperty(FontSettings.prototype, "allCaps", { get: function () { return this._allCaps; }, set: function (value) { if (this._allCaps === value) return; this._allCaps = value; this.$_propertyChanged.notify(this, "allCaps"); }, enumerable: true, configurable: true }); Object.defineProperty(FontSettings.prototype, "openTypeFeatures", { get: function () { return this._openTypeFeatures; }, set: function (value) { if (this._openTypeFeatures === value) return; this._openTypeFeatures = value; this.$_propertyChanged.notify(this, "openTypeFeatures"); }, enumerable: true, configurable: true }); Object.defineProperty(FontSettings.prototype, "postScriptName", { get: function () { return this._postScriptName; }, set: function (value) { if (this._postScriptName === value) return; this._postScriptName = value; this.$_propertyChanged.notify(this, "postScriptName"); }, enumerable: true, configurable: true }); Object.defineProperty(FontSettings.prototype, "size", { get: function () { return this._size; }, set: function (value) { if (Math.EqualsOfFloatNumbers(this._size, value)) return; this._size = value; this.$_propertyChanged.notify(this, "size"); }, enumerable: true, configurable: true }); FontSettings.prototype.addPropertyChanged = function (listener) { this.$_propertyChanged.add(listener); }; FontSettings.prototype.removePropertyChanged = function (listener) { this.$_propertyChanged.remove(listener); }; FontSettings.equals = function (a, b) { if (a == null && b == null) return true; if (a == null || b == null) return false; return a.equals(b); }; FontSettings.prototype.equals = function (other) { return this.postScriptName === other.postScriptName && this.size === other.size && this.fauxBold === other.fauxBold && this.fauxItalic === other.fauxItalic && this.allCaps === other.allCaps && _.isEqual(this.openTypeFeatures, other.openTypeFeatures); }; FontSettings.prototype.getSimplifiedObject = function () { return { "allCaps": this.allCaps, "fauxBold": this.fauxBold, "fauxItalic": this.fauxItalic, "openTypeFeatures": this.openTypeFeatures, "postScriptName": this.postScriptName, "size": this.size }; }; return FontSettings; }(ModelComponent)); BaseTextItem.FontSettings = FontSettings; var BaseTextValue = /** @class */ (function () { function BaseTextValue(name, text) { this.name = name; this.text = text; } BaseTextValue.prototype.equals = function (other) { return other != null && equals(this.name, other.name) && equals(this.text, other.text); }; BaseTextValue.prototype.clone = function () { return new BaseTextValue(this.name, this.text); }; return BaseTextValue; }()); BaseTextItem.BaseTextValue = BaseTextValue; })(BaseTextItem || (BaseTextItem = {})); //# sourceMappingURL=BaseTextItem.js.map