UNPKG

igniteui-angular

Version:

Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps

64 lines (63 loc) 2.59 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const UpdateChanges_1 = require("../common/UpdateChanges"); const version = '18.2.0'; exports.default = () => (host, context) => __awaiter(void 0, void 0, void 0, function* () { context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`); const update = new UpdateChanges_1.UpdateChanges(__dirname, host, context); const IG_COLORS = [ 'primary-', 'primary-A', 'secondary-', 'secondary-A', 'gray-', 'surface-', 'surface-A', 'info-', 'info-A', 'success-', 'success-A', 'warn-', 'warn-A', 'error-', 'error-A' ]; const hslaColor = 'hsla?\\(var\\(--ig-attr(\\d)00\\)\\)'; for (const entryPath of update.sassFiles) { let content = host.read(entryPath).toString(); IG_COLORS.forEach(color => { let prop = hslaColor.replace('attr', color); const regex = new RegExp(prop, 'g'); if (regex.test(content)) { let newColor = prop.replace(/hsla\?\\\(var\\\(--ig-/g, 'var\(--ig-'); newColor = newColor.replace('(\\d)', '$1'); newColor = newColor.replace('\\)\\)', ')'); content = content.replace(regex, newColor); host.overwrite(entryPath, content); } }); } update.addValueTransform('filterable_to_disableFiltering', (args) => { args.bindingType = UpdateChanges_1.InputPropertyType.EVAL; switch (args.value) { case 'true': args.value = 'false'; break; case 'false': args.value = 'true'; break; default: args.value = `!(${args.value})`; } }); update.applyChanges(); });