@lucca-front/ng 10.0.0-rc.1 → 10.0.0-rc.2

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/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "@lucca-front/ng",
3
- "version": "10.0.0-rc.1",
3
+ "version": "10.0.0-rc.2",
4
4
  "description": "A library of icons made by the team @Lucca",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/LuccaSA/lucca-front.git"
8
8
  },
9
9
  "schematics": "./schematics/collection.json",
10
+ "ng-update": {
11
+ "migrations": "./schematics/migrations.json",
12
+ "packageGroup": [
13
+ "@lucca-front/ng",
14
+ "@lucca-front/scss",
15
+ "@lucca-front/icons"
16
+ ]
17
+ },
10
18
  "license": "MIT",
11
19
  "public": true,
12
20
  "keywords": [
@@ -23,7 +31,9 @@
23
31
  "@angular/cdk": "^13.0.0 || ^12.0.0",
24
32
  "@lucca-front/icons": ">=8.0.0 <9.0.0",
25
33
  "@lucca-front/scss": ">=8.0.0 <9.0.0",
26
- "rxjs": "^6.0.0 || ^7.0.0"
34
+ "rxjs": "^6.0.0 || ^7.0.0",
35
+ "postcss-scss": "^4.0.0",
36
+ "postcss": "^8.0.0"
27
37
  },
28
38
  "bugs": {
29
39
  "url": "https://github.com/LuccaSA/lucca-front/issues"
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const migration_1 = require("./migration");
4
+ exports.default = () => {
5
+ return (tree) => {
6
+ tree.visit((path, entry) => {
7
+ if (!path.endsWith('.scss') || path.includes('node_modules') || !entry) {
8
+ return;
9
+ }
10
+ tree.overwrite(path, (0, migration_1.migrateFile)(entry.content.toString()));
11
+ });
12
+ };
13
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateFile = void 0;
4
+ const postcss_scss_1 = require("postcss-scss");
5
+ const mixin_registry_1 = require("./mixin-registry");
6
+ const color_1 = require("./updaters/color");
7
+ const elevation_1 = require("./updaters/elevation");
8
+ const get_set_1 = require("./updaters/get-set");
9
+ const ie11_1 = require("./updaters/ie11");
10
+ const main_import_1 = require("./updaters/main-import");
11
+ const mixins_1 = require("./updaters/mixins");
12
+ const remove_scss_placeholder_1 = require("./updaters/remove-scss-placeholder");
13
+ const theme_1 = require("./updaters/theme");
14
+ const utils_1 = require("./utils");
15
+ function migrateFile(content) {
16
+ const root = (0, postcss_scss_1.parse)(content);
17
+ root.walkAtRules('import', (rule) => {
18
+ ['@lucca-front/scss/src/mixins', '@lucca-front/icons/src/mixins', 'theming', 'theme'].some((name) => (0, utils_1.removeImportNode)(rule, name));
19
+ });
20
+ (0, remove_scss_placeholder_1.removeScssPlaceholders)(root);
21
+ (0, ie11_1.removeIE11ThemeSupport)(root);
22
+ (0, color_1.updateColorMixin)(root);
23
+ (0, theme_1.updateThemeMixin)(root);
24
+ (0, get_set_1.updateGetSetFunctions)(root);
25
+ (0, elevation_1.updateElevation)(root);
26
+ (0, main_import_1.updateMainImport)(root);
27
+ root.walkAtRules('include', (atRule) => {
28
+ if (atRule.params === 'ie11') {
29
+ atRule.remove();
30
+ }
31
+ });
32
+ root.walkDecls('$noCssVar', (node) => {
33
+ node.remove();
34
+ });
35
+ root.walkAtRules('include', (atRule) => {
36
+ if (atRule.params.startsWith('generateCSSVarsFromTheme')) {
37
+ const parent = atRule.parent;
38
+ atRule.remove();
39
+ (0, utils_1.removeContainerIfEmpty)(parent);
40
+ }
41
+ });
42
+ (0, mixins_1.replaceMixin)(root, mixin_registry_1.mixinRegistry);
43
+ return root.toResult().css;
44
+ }
45
+ exports.migrateFile = migrateFile;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ const schematics_1 = require("@angular-devkit/schematics");
32
+ const testing_1 = require("@angular-devkit/schematics/testing");
33
+ const fs = __importStar(require("fs"));
34
+ const path = __importStar(require("path"));
35
+ const migration_1 = require("./migration");
36
+ const collectionPath = path.normalize(path.join(__dirname, '..', '../migrations.json'));
37
+ const testsRoot = path.join(__dirname, 'tests');
38
+ const files = fs.readdirSync(testsRoot);
39
+ const inputFiles = files.filter((f) => f.endsWith('.input.scss'));
40
+ const outputFiles = files.filter((f) => f.endsWith('.output.scss'));
41
+ const cases = inputFiles.map((f) => f.replace('.input.scss', ''));
42
+ describe('Migration', () => {
43
+ for (const testCase of cases) {
44
+ it('should handle ' + testCase, () => {
45
+ // Arrange
46
+ const input = fs
47
+ .readFileSync(path.join(testsRoot, `${testCase}.input.scss`))
48
+ .toString()
49
+ .replace(/\r/g, '');
50
+ const expected = fs
51
+ .readFileSync(path.join(testsRoot, `${testCase}.output.scss`))
52
+ .toString()
53
+ .replace(/\r/g, '');
54
+ // Act
55
+ const actual = (0, migration_1.migrateFile)(input);
56
+ //Assert
57
+ expect(stripLastNewLine(actual)).toBe(stripLastNewLine(expected));
58
+ });
59
+ }
60
+ });
61
+ describe('CSS Vars Migration', () => {
62
+ it('should update style files', () => __awaiter(void 0, void 0, void 0, function* () {
63
+ const tree = new testing_1.UnitTestTree(schematics_1.Tree.empty());
64
+ for (const file of inputFiles) {
65
+ tree.create(file.replace('.input.', '.'), fs.readFileSync(path.join(testsRoot, file)).toString().replace(/\r/g, ''));
66
+ }
67
+ const schematicRunner = new testing_1.SchematicTestRunner('migrations', collectionPath);
68
+ // migration-v9-css-vars is the name of the migration, which is defined in the migration.json file
69
+ yield schematicRunner.runSchematicAsync('migration-v9-css-vars', {}, tree).toPromise();
70
+ expect(tree.files.length).toBe(inputFiles.length);
71
+ for (const file of outputFiles) {
72
+ const filePath = file.replace('.output.', '.');
73
+ expect(tree.exists(filePath)).toBe(true);
74
+ const actualContent = tree.readContent(filePath);
75
+ const expectedContent = fs.readFileSync(path.join(testsRoot, file)).toString().replace(/\r/g, '');
76
+ expect(stripLastNewLine(actualContent)).toBe(stripLastNewLine(expectedContent));
77
+ }
78
+ }));
79
+ });
80
+ function stripLastNewLine(input) {
81
+ return input.endsWith('\n') ? input.slice(0, -1) : input;
82
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mixinRegistry = exports.MixinRegistry = void 0;
4
+ class MixinRegistry {
5
+ constructor() {
6
+ this._mixins = {};
7
+ }
8
+ registerMixin(mixins, mixinsImport, namespace) {
9
+ const mixinNames = Array.isArray(mixins) ? mixins : Object.keys(mixins);
10
+ for (const mixin of mixinNames) {
11
+ this._mixins[mixin] = {
12
+ newName: Array.isArray(mixins) ? mixin : mixins[mixin],
13
+ import: mixinsImport,
14
+ namespace,
15
+ prefix: namespace !== null && namespace !== void 0 ? namespace : mixinsImport.split('/').reverse()[0],
16
+ };
17
+ }
18
+ return this;
19
+ }
20
+ getByName(name) {
21
+ var _a;
22
+ return (_a = this._mixins[name]) !== null && _a !== void 0 ? _a : null;
23
+ }
24
+ }
25
+ exports.MixinRegistry = MixinRegistry;
26
+ const mixinRegistry = new MixinRegistry();
27
+ exports.mixinRegistry = mixinRegistry;
28
+ mixinRegistry
29
+ .registerMixin(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], '@lucca-front/scss/src/components/title')
30
+ .registerMixin({ loading: 'spinner' }, '@lucca-front/scss/src/commons/utils/loading')
31
+ .registerMixin(['makeIcon'], '@lucca-front/icons/src/_mixins', 'icon')
32
+ .registerMixin({
33
+ media_larger_than: 'largerThan',
34
+ media_smaller_than: 'smallerThan',
35
+ }, '@lucca-front/scss/src/commons/utils/media')
36
+ .registerMixin({
37
+ listReset: 'list',
38
+ buttonReset: 'button',
39
+ definitionListReset: 'list($list: "dl")',
40
+ }, '@lucca-front/scss/src/commons/utils/reset')
41
+ .registerMixin(['mask'], '@lucca-front/scss/src/commons/utils/a11y');
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateColorMixin = void 0;
4
+ const utils_1 = require("../utils");
5
+ const legacyLevelToLevel = {
6
+ 'see-through': '50',
7
+ darker: '900',
8
+ dark: '800',
9
+ color: '700',
10
+ light: '500',
11
+ lighter: '200',
12
+ lightest: '100',
13
+ default: '700',
14
+ };
15
+ function updateColorMixin(root) {
16
+ root.walkDecls((decl) => {
17
+ const valueNode = new utils_1.ValueNode(decl.value);
18
+ valueNode.walkFunction('_color', (funcNode) => {
19
+ var _a, _b, _c;
20
+ const [color, legacyLevel] = funcNode.nodes[0].value.split('.');
21
+ funcNode.value = 'var';
22
+ if (color === 'white') {
23
+ funcNode.nodes = new utils_1.ValueNode(`--colors-${color}-color`).nodes;
24
+ }
25
+ else {
26
+ let level = (_b = legacyLevel !== null && legacyLevel !== void 0 ? legacyLevel : (_a = funcNode.nodes[2]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '700';
27
+ level = (_c = legacyLevelToLevel[level]) !== null && _c !== void 0 ? _c : level;
28
+ funcNode.nodes = new utils_1.ValueNode(`--palettes-${color}-${level}`).nodes;
29
+ }
30
+ });
31
+ decl.value = valueNode.toString();
32
+ });
33
+ }
34
+ exports.updateColorMixin = updateColorMixin;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateElevation = void 0;
4
+ const postcss_1 = require("postcss");
5
+ const utils_1 = require("../utils");
6
+ function updateElevation(root) {
7
+ root.walkAtRules('include', (atRule) => {
8
+ const valueNode = new utils_1.ValueNode(atRule.params);
9
+ valueNode.walkFunction('elevate', (funcNode) => {
10
+ const level = funcNode.nodes[0].value;
11
+ atRule.before(new postcss_1.Declaration({
12
+ prop: 'box-shadow',
13
+ value: `var(--commons-elevation-elevation-${level})`,
14
+ }));
15
+ atRule.remove();
16
+ });
17
+ });
18
+ }
19
+ exports.updateElevation = updateElevation;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateGetSetFunctions = void 0;
4
+ const utils_1 = require("../utils");
5
+ function updateGetSetFunctions(root) {
6
+ root.walkAtRules((atRule) => {
7
+ new utils_1.ValueNode(atRule.params).walkFunction('_getMap', () => {
8
+ (0, utils_1.commentNode)(atRule, 'Passer directement par des variables CSS.');
9
+ return false;
10
+ });
11
+ });
12
+ root.walkDecls((decl) => {
13
+ const valueNode = new utils_1.ValueNode(decl.value);
14
+ valueNode.walkFunction('_safeGet', () => {
15
+ (0, utils_1.commentNode)(decl, 'Passer directement par des variables CSS.');
16
+ return false;
17
+ });
18
+ decl.value = valueNode.toString();
19
+ });
20
+ }
21
+ exports.updateGetSetFunctions = updateGetSetFunctions;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeIE11ThemeSupport = void 0;
4
+ const utils_1 = require("../utils");
5
+ function removeIE11ThemeSupport(root) {
6
+ root.walkDecls((decl) => {
7
+ const valueNode = new utils_1.ValueNode(decl.value);
8
+ valueNode.walkFunction(/(_theme|_color|_safeGet)/, (funcNode) => {
9
+ var _a;
10
+ const hasModeIE = ((_a = funcNode.nodes[funcNode.nodes.length - 1]) === null || _a === void 0 ? void 0 : _a.value) === 'true';
11
+ if (hasModeIE) {
12
+ const { parent } = decl;
13
+ decl.remove();
14
+ (0, utils_1.removeContainerIfEmpty)(parent);
15
+ return false;
16
+ }
17
+ return undefined;
18
+ });
19
+ });
20
+ }
21
+ exports.removeIE11ThemeSupport = removeIE11ThemeSupport;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateMainImport = void 0;
4
+ const postcss_1 = require("postcss");
5
+ const utils_1 = require("../utils");
6
+ function updateMainImport(root) {
7
+ let hasMainScss = false;
8
+ let hasMainNg = false;
9
+ root.walkAtRules('import', (atRule) => {
10
+ if (atRule.params.includes('scss/src/theming.overridable')) {
11
+ (0, utils_1.removeImportNode)(atRule, 'scss/src/theming.overridable');
12
+ }
13
+ if (atRule.params.includes('scss/src/main.overridable')) {
14
+ (0, utils_1.removeImportNode)(atRule, 'scss/src/main.overridable');
15
+ hasMainScss = true;
16
+ }
17
+ if (atRule.params.includes('ng/style/main.overridable')) {
18
+ (0, utils_1.removeImportNode)(atRule, 'ng/style/main.overridable');
19
+ hasMainNg = true;
20
+ }
21
+ });
22
+ if (hasMainScss) {
23
+ addForwardRule(root, '@lucca-front/scss/src/commons');
24
+ addForwardRule(root, '@lucca-front/scss/src/components');
25
+ }
26
+ if (hasMainNg) {
27
+ addForwardRule(root, '@lucca-front/ng/style/main');
28
+ }
29
+ }
30
+ exports.updateMainImport = updateMainImport;
31
+ function addForwardRule(root, name) {
32
+ var _a;
33
+ let lastForwardRule;
34
+ root.walkAtRules('forward', (rule) => {
35
+ lastForwardRule = rule;
36
+ });
37
+ let afterNode = lastForwardRule;
38
+ if (!afterNode && ((_a = root.first) === null || _a === void 0 ? void 0 : _a.type) === 'comment') {
39
+ afterNode = root.first;
40
+ }
41
+ (0, utils_1.addImport)(root, new postcss_1.AtRule({ name: 'forward', params: `'${name}'` }), afterNode);
42
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.replaceMixin = void 0;
7
+ const postcss_value_parser_1 = __importDefault(require("postcss-value-parser"));
8
+ const utils_1 = require("../utils");
9
+ function replaceMixin(root, registry) {
10
+ const neededNamespaceByImport = {};
11
+ root.walkAtRules('include', (rule) => {
12
+ rule.params = (0, postcss_value_parser_1.default)(rule.params)
13
+ .walk((node) => {
14
+ if (!['function', 'word'].includes(node.type)) {
15
+ return undefined;
16
+ }
17
+ const mixin = registry.getByName(node.value);
18
+ if (mixin) {
19
+ neededNamespaceByImport[mixin.import] = mixin.namespace;
20
+ node.value = `${mixin.prefix}.${mixin.newName}`;
21
+ return false;
22
+ }
23
+ (0, utils_1.commentNode)(rule, 'Mixins non gérée par la migration auto.');
24
+ return false;
25
+ })
26
+ .toString();
27
+ });
28
+ for (const [neededImport, namespace] of Object.entries(neededNamespaceByImport)) {
29
+ (0, utils_1.addMixinImport)(root, neededImport, namespace);
30
+ }
31
+ }
32
+ exports.replaceMixin = replaceMixin;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeScssPlaceholders = void 0;
4
+ const utils_1 = require("../utils");
5
+ /**
6
+ * Replace: calc(100vh - #{_theme(\"commons.banner-height\")} - 3.5rem)
7
+ * With: calc(100vh - _theme(\"commons.banner-height\") - 3.5rem)
8
+ */
9
+ function removeScssPlaceholders(root) {
10
+ root.walkDecls((decl) => {
11
+ const valueNode = new utils_1.ValueNode(decl.value);
12
+ valueNode.walkFunction(/.*/, (func) => {
13
+ func.value = func.value.replace(/#\{/g, '');
14
+ func.nodes = func.nodes.filter((child) => child.type !== 'word' || child.value !== '}');
15
+ });
16
+ decl.value = valueNode.toString();
17
+ });
18
+ }
19
+ exports.removeScssPlaceholders = removeScssPlaceholders;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateThemeMixin = void 0;
4
+ const utils_1 = require("../utils");
5
+ function updateThemeMixin(root) {
6
+ root.walkDecls((decl) => {
7
+ const valueNode = new utils_1.ValueNode(decl.value);
8
+ valueNode.walkFunction('_theme', (funcNode) => {
9
+ const isUnsupported = funcNode.nodes.length > 1;
10
+ if (isUnsupported) {
11
+ (0, utils_1.commentNode)(decl, 'Utilisation de _theme non gérée par la migration automatique');
12
+ return false;
13
+ }
14
+ const themeVar = funcNode.nodes[0].value.replace(/\./g, '-');
15
+ funcNode.value = 'var';
16
+ funcNode.nodes = new utils_1.ValueNode(`--${themeVar}`).nodes;
17
+ return undefined;
18
+ });
19
+ decl.value = valueNode.toString();
20
+ });
21
+ }
22
+ exports.updateThemeMixin = updateThemeMixin;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ValueNode = exports.commentNode = exports.removeImportNode = exports.addImport = exports.addMixinImport = exports.removeContainerIfEmpty = void 0;
7
+ const postcss_1 = require("postcss");
8
+ const postcss_value_parser_1 = __importDefault(require("postcss-value-parser"));
9
+ function removeContainerIfEmpty(node) {
10
+ if (!node) {
11
+ return;
12
+ }
13
+ if (!node.nodes.length) {
14
+ const { parent } = node;
15
+ node.remove();
16
+ if (parent instanceof postcss_1.Document) {
17
+ return;
18
+ }
19
+ removeContainerIfEmpty(parent);
20
+ }
21
+ }
22
+ exports.removeContainerIfEmpty = removeContainerIfEmpty;
23
+ function addMixinImport(root, mixin, namespace = '') {
24
+ let lastImportRule;
25
+ root.walkAtRules(/(import|use)/, (rule) => {
26
+ lastImportRule = rule;
27
+ });
28
+ let importStr = `'${mixin}'`;
29
+ if (namespace) {
30
+ importStr += ` as ${namespace}`;
31
+ }
32
+ const newImportRule = new postcss_1.AtRule({ name: 'use', params: importStr });
33
+ addImport(root, newImportRule, lastImportRule);
34
+ }
35
+ exports.addMixinImport = addMixinImport;
36
+ function addImport(root, atRule, afterNode) {
37
+ var _a;
38
+ if (afterNode) {
39
+ atRule.raws.before = '\n';
40
+ afterNode.after(atRule);
41
+ }
42
+ else {
43
+ const firstNode = root.first;
44
+ (_a = root.first) === null || _a === void 0 ? void 0 : _a.before(atRule);
45
+ if (firstNode) {
46
+ firstNode.raws.before = '\n\n';
47
+ }
48
+ }
49
+ }
50
+ exports.addImport = addImport;
51
+ /**
52
+ * @returns {boolean} returns true if whole node is deleted
53
+ */
54
+ function removeImportNode(atRule, name) {
55
+ var _a, _b;
56
+ if (atRule.params.includes(name)) {
57
+ const parsed = (0, postcss_value_parser_1.default)(atRule.params);
58
+ const imports = parsed.nodes.filter((n) => n.type === 'string');
59
+ if (imports.length === 1) {
60
+ // Remove the whole import
61
+ atRule.remove();
62
+ return true;
63
+ }
64
+ // Remove node matching condition
65
+ parsed.nodes = parsed.nodes.filter((n) => n.type !== 'string' || !n.value.includes(name));
66
+ // Remove first node if divider
67
+ if (((_a = parsed.nodes[0]) === null || _a === void 0 ? void 0 : _a.type) === 'div') {
68
+ parsed.nodes = parsed.nodes.slice(1);
69
+ }
70
+ // Remove last node if divider
71
+ if (((_b = parsed.nodes[parsed.nodes.length - 1]) === null || _b === void 0 ? void 0 : _b.type) === 'div') {
72
+ parsed.nodes = parsed.nodes.slice(0, -1);
73
+ }
74
+ // Remove consecutive divider nodes
75
+ parsed.nodes = parsed.nodes.filter((n, index) => { var _a; return n.type !== 'div' || ((_a = parsed.nodes[index + 1]) === null || _a === void 0 ? void 0 : _a.type) !== 'div'; });
76
+ atRule.params = parsed.toString();
77
+ }
78
+ return false;
79
+ }
80
+ exports.removeImportNode = removeImportNode;
81
+ function commentNode(node, comment) {
82
+ const commentNode = new postcss_1.Comment({ text: `[LF NEXT] ${comment}` });
83
+ node.before(commentNode);
84
+ commentNode.after(new postcss_1.Comment({ text: node.toString() }));
85
+ node.remove();
86
+ }
87
+ exports.commentNode = commentNode;
88
+ class ValueNode {
89
+ constructor(value) {
90
+ this.parsed = (0, postcss_value_parser_1.default)(value);
91
+ }
92
+ get nodes() {
93
+ return this.parsed.nodes;
94
+ }
95
+ toString() {
96
+ return this.parsed.toString();
97
+ }
98
+ walkFunction(functionFilter, callback) {
99
+ this.parsed.walk((node) => {
100
+ if (node.type !== 'function') {
101
+ return;
102
+ }
103
+ if (!this.matchFilter(node.value, functionFilter)) {
104
+ return;
105
+ }
106
+ return callback(node);
107
+ });
108
+ }
109
+ matchFilter(value, filter) {
110
+ return typeof filter === 'string' ? value === filter : !!value.match(filter);
111
+ }
112
+ }
113
+ exports.ValueNode = ValueNode;
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "migration-v9-css-vars": {
5
+ "version": "9.0.0-alpha",
6
+ "description": "Remove LF <= 8 theming system and import to use new scss syntax and CSS Vars everywhere",
7
+ "factory": "./migrations/css-vars/index"
8
+ }
9
+ }
10
+ }