UNPKG

@aurigma/design-atoms

Version:

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

52 lines 4.01 kB
import { ImageQualityViolation } from "./Violations/ImageQualityViolation"; import { SafetyLineViolation } from "./Violations/SafetyLineViolation"; import { BleedViolation } from "./Violations/BleedViolation"; import { RegionViolation } from "./Violations/RegionViolation"; import { TextCropViolation } from "./Violations/TextCropViolation"; import { ViolationService } from "./ViolationService"; import { FrontEndLogger, LogSource } from "../FrontEndLogger"; import { TextInPlaceViolation } from "./Violations/TextInPlaceViolation"; import { FontSizeViolation } from "./Violations/FontSizeViolation"; import { RasterElementsViolation } from "./Violations/RasterElementsViolation"; var ViolationServiceFactory = /** @class */ (function () { function ViolationServiceFactory(_conf, _messages, _eventManager, _productHandler) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; this._conf = _conf; this._messages = _messages; this._eventManager = _eventManager; this._productHandler = _productHandler; this._renderingDpi = (_c = (_b = (_a = this._conf) === null || _a === void 0 ? void 0 : _a.qualityMeter) === null || _b === void 0 ? void 0 : _b.renderingDpi) !== null && _c !== void 0 ? _c : 300; if (this._conf.safetyLineViolationWarningEnabled != null) console.warn("ViolationService: safetyLineViolationWarningEnabled is deprecated. Use safetyLines.enabled instead."); var safetyLinesEnabled = ((_d = this._conf.safetyLineViolationWarningEnabled) !== null && _d !== void 0 ? _d : true) && ((_g = (_f = (_e = this._conf) === null || _e === void 0 ? void 0 : _e.safetyLines) === null || _f === void 0 ? void 0 : _f.enabled) !== null && _g !== void 0 ? _g : true); this._violations = [ ((_h = this._conf.qualityMeter) === null || _h === void 0 ? void 0 : _h.enabled) ? new ImageQualityViolation(this._productHandler, this._conf.qualityMeter, this._messages, this._renderingDpi, this._eventManager) : null, safetyLinesEnabled ? new SafetyLineViolation(this._productHandler, this._messages, _conf) : null, this._conf.bleedViolationWarningEnabled ? new BleedViolation(this._productHandler, this._messages, _conf) : null, this._conf.regionViolationWarningEnabled ? new RegionViolation(this._productHandler, this._messages) : null, this._conf.textCropViolationWarningEnabled ? new TextCropViolation(this._productHandler, this._messages) : null, this._conf.inPlaceNotSupportedWarningEnabled ? new TextInPlaceViolation(this._productHandler, this._messages) : null, ((_j = this._conf.minFontSize) === null || _j === void 0 ? void 0 : _j.enabled) ? new FontSizeViolation(this._productHandler, this._messages, _conf) : null, ((_k = this._conf.rasterElements) === null || _k === void 0 ? void 0 : _k.enabled) ? new RasterElementsViolation(this._messages, _conf) : null, ].filter(function (v) { return v != null; }); } ViolationServiceFactory.prototype.create = function () { return new ViolationService(this._violations, this._eventManager, this._productHandler); }; Object.defineProperty(ViolationServiceFactory.prototype, "renderingDpi", { get: function () { return this._renderingDpi; }, set: function (value) { this._renderingDpi = value; FrontEndLogger.debugLog("Set dpi: <span style=\"color: rgb(0,255,255)\">" + value + "</span>", LogSource.ViolationService); var imageQualityViolation = this._violations.find(function (v) { return v instanceof ImageQualityViolation; }); if (imageQualityViolation == null) return; imageQualityViolation.renderingDpi = value; }, enumerable: true, configurable: true }); return ViolationServiceFactory; }()); export { ViolationServiceFactory }; //# sourceMappingURL=ViolationServiceFactory.js.map