@lucca-front/ng 10.0.0 → 10.0.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucca-front/ng",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "A library of icons made by the team @Lucca",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@angular/common": "^14.0.0",
|
|
30
30
|
"@angular/core": "^14.0.0",
|
|
31
31
|
"@angular/cdk": "^14.0.0",
|
|
32
|
-
"@lucca-front/icons": "v10.0.
|
|
33
|
-
"@lucca-front/scss": "v10.0.
|
|
32
|
+
"@lucca-front/icons": "v10.0.1",
|
|
33
|
+
"@lucca-front/scss": "v10.0.1",
|
|
34
34
|
"rxjs": "^6.0.0 || ^7.0.0"
|
|
35
35
|
},
|
|
36
36
|
"bugs": {
|
|
@@ -58,8 +58,13 @@ function updateCssClassNames(content, oldClassToNewClass, lib) {
|
|
|
58
58
|
const updates = [];
|
|
59
59
|
const root = new HtmlAst(content, lib);
|
|
60
60
|
const classesToFind = Object.keys(oldClassToNewClass);
|
|
61
|
+
const visitedAttributes = new Set();
|
|
61
62
|
root.visitAttribute('class', (classAttr) => {
|
|
62
63
|
const offset = classAttr.valueSpan?.start.offset;
|
|
64
|
+
if (visitedAttributes.has(classAttr)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
visitedAttributes.add(classAttr);
|
|
63
68
|
if (classesToFind.some((cl) => classAttr.value.includes(cl)) && offset !== undefined) {
|
|
64
69
|
updates.push({
|
|
65
70
|
position: offset,
|
|
@@ -70,6 +75,10 @@ function updateCssClassNames(content, oldClassToNewClass, lib) {
|
|
|
70
75
|
});
|
|
71
76
|
for (const cl of classesToFind) {
|
|
72
77
|
root.visitBoundAttribute(cl, (boundAttr) => {
|
|
78
|
+
if (visitedAttributes.has(boundAttr)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
visitedAttributes.add(boundAttr);
|
|
73
82
|
updates.push({
|
|
74
83
|
position: boundAttr.keySpan.start.offset,
|
|
75
84
|
oldContent: boundAttr.keySpan.details || '',
|
|
@@ -81,6 +90,10 @@ function updateCssClassNames(content, oldClassToNewClass, lib) {
|
|
|
81
90
|
if (!(boundAttr.value instanceof lib.ASTWithSource)) {
|
|
82
91
|
return;
|
|
83
92
|
}
|
|
93
|
+
if (visitedAttributes.has(boundAttr)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
visitedAttributes.add(boundAttr);
|
|
84
97
|
const { source } = boundAttr.value;
|
|
85
98
|
if (classesToFind.some((cl) => source?.includes(cl))) {
|
|
86
99
|
updates.push({
|
|
@@ -96,7 +109,7 @@ exports.updateCssClassNames = updateCssClassNames;
|
|
|
96
109
|
function extractAllCssClassNames(content, lib) {
|
|
97
110
|
const allClasses = new Set();
|
|
98
111
|
const root = new HtmlAst(content, lib);
|
|
99
|
-
root.visitAttribute('class', (classAttr) => allClasses.add(
|
|
112
|
+
root.visitAttribute('class', (classAttr) => classAttr.value.split(' ').forEach((cls) => allClasses.add(cls)));
|
|
100
113
|
root.visitBoundAttribute(/.*/, (boundAttr) => {
|
|
101
114
|
if (boundAttr.keySpan.details?.startsWith('class.')) {
|
|
102
115
|
allClasses.add(boundAttr.name);
|
|
@@ -44,7 +44,7 @@ const classWithImports = [
|
|
|
44
44
|
{ cssClass: 'section', cssImport: '@lucca-front/scss/src/components/section' },
|
|
45
45
|
{ cssClass: 'switch', cssImport: '@lucca-front/scss/src/components/switch' },
|
|
46
46
|
{ cssClass: 'table', cssImport: '@lucca-front/scss/src/components/table' },
|
|
47
|
-
{ cssClass: /^mod-layoutFixed
|
|
47
|
+
{ cssClass: /^mod-layoutFixed-.*/, cssImport: '@lucca-front/scss/src/components/tableFixed' },
|
|
48
48
|
{ cssClass: 'mod-sortable', cssImport: '@lucca-front/scss/src/components/tableSorted' },
|
|
49
49
|
{ cssClass: 'table-head-row-cell-sortableButton', cssImport: '@lucca-front/scss/src/components/tableSorted' },
|
|
50
50
|
{ cssClass: 'mod-stickyColumn', cssImport: '@lucca-front/scss/src/components/tableSticked' },
|
|
@@ -53,9 +53,9 @@ const classWithImports = [
|
|
|
53
53
|
{ cssClass: 'textfield', cssImport: '@lucca-front/scss/src/components/textfield' },
|
|
54
54
|
{ cssClass: 'timeline', cssImport: '@lucca-front/scss/src/components/timeline' },
|
|
55
55
|
{ cssClass: 'title', cssImport: '@lucca-front/scss/src/components/title' },
|
|
56
|
-
{ cssClass: 'toasts', cssImport: '@lucca-front/scss/src/components/
|
|
56
|
+
{ cssClass: 'toasts', cssImport: '@lucca-front/scss/src/components/toast' },
|
|
57
57
|
{ cssClass: 'tableOfContent', cssImport: '@lucca-front/scss/src/components/tableOfContent' },
|
|
58
|
-
{ cssClass: /^u
|
|
58
|
+
{ cssClass: /^u-.*/, cssImport: '@lucca-front/scss/src/components/util' },
|
|
59
59
|
];
|
|
60
60
|
function getCssImports(allVisitedClasses) {
|
|
61
61
|
const exactCssClasses = {};
|
|
@@ -71,7 +71,7 @@ function getCssImports(allVisitedClasses) {
|
|
|
71
71
|
}
|
|
72
72
|
const imports = new Set();
|
|
73
73
|
for (const visitedClass of allVisitedClasses) {
|
|
74
|
-
const newImport = exactCssClasses[visitedClass] || regexpCssTests.map((test) => test(visitedClass))
|
|
74
|
+
const newImport = exactCssClasses[visitedClass] || regexpCssTests.map((test) => test(visitedClass)).find(Boolean);
|
|
75
75
|
if (newImport) {
|
|
76
76
|
imports.add(newImport);
|
|
77
77
|
}
|
|
@@ -110,16 +110,20 @@ describe('CSS Vars Migration', () => {
|
|
|
110
110
|
it('should add optimized global imports', async () => {
|
|
111
111
|
const tree = new testing_1.UnitTestTree(schematics_1.Tree.empty());
|
|
112
112
|
tree.create('app.component.html', '<button type="button" class="button">Test</button>');
|
|
113
|
-
tree.create('table.component.html', '<table class="table" [class.mod-stickyColumn]="true"></table>');
|
|
113
|
+
tree.create('table.component.html', '<table class="table mod-sortable" [class.mod-stickyColumn]="true"></table>');
|
|
114
|
+
tree.create('util.component.html', '<div class="u-marginTopStandard">LOL</div>');
|
|
114
115
|
tree.create('styles.scss', "@import '@lucca-front/scss/src/main.overridable';");
|
|
115
116
|
const schematicRunner = new testing_1.SchematicTestRunner('migrations', collectionPath);
|
|
116
117
|
// migration-v10-css-vars is the name of the migration, which is defined in the migration.json file
|
|
117
118
|
await schematicRunner.runSchematicAsync('migration-v10-css-vars', { skipInstallation: true }, tree).toPromise();
|
|
118
119
|
const expectedImports = [
|
|
120
|
+
`@forward '@lucca-front/icons/src/main';`,
|
|
119
121
|
`@forward '@lucca-front/scss/src/main';`,
|
|
120
122
|
`@forward '@lucca-front/scss/src/components/button';`,
|
|
121
123
|
`@forward '@lucca-front/scss/src/components/table';`,
|
|
124
|
+
`@forward '@lucca-front/scss/src/components/tableSorted';`,
|
|
122
125
|
`@forward '@lucca-front/scss/src/components/tableSticked';`,
|
|
126
|
+
`@forward '@lucca-front/scss/src/components/util';`,
|
|
123
127
|
];
|
|
124
128
|
expect(tree.readContent('styles.scss')).toBe(expectedImports.join('\n'));
|
|
125
129
|
});
|
|
@@ -30,6 +30,7 @@ function updateMainImport(root, postCss, postCssValueParser) {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
if (hasMainScss) {
|
|
33
|
+
(0, scss_ast_js_1.addForwardRule)(root, '@lucca-front/icons/src/main', postCss);
|
|
33
34
|
(0, scss_ast_js_1.addForwardRule)(root, '@lucca-front/scss/src/main', postCss);
|
|
34
35
|
}
|
|
35
36
|
if (hasMainNg) {
|