Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): remove ng-less-javascript-enabled-patch #1806

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
"build_artifacts": "bash scripts/ci/build-artifacts.sh",
"analyze": "npm run ng-high-memory build -- --source-map",
"analyze:view": "source-map-explorer src/dist/browser/*.js",
"site:gen": "node scripts/site/main init",
"site:gen:TODO": "node scripts/site/main init && ng-alain-plugin-theme -t=themeCss && ng-alain-plugin-theme -t=colorLess",
"site:gen": "node scripts/site/main init && ng-alain-plugin-theme -t=themeCss && ng-alain-plugin-theme -t=colorLess",
"site:build": "npm run site:gen && ng b site && npm run site:ngsw && npm run site:minify && npm run site:sitemap && npm run site:helper",
"site:helper": "bash scripts/ci/helper.sh",
"site:minify": "node scripts/build/minify.js",
Expand Down Expand Up @@ -153,9 +152,8 @@
"mark-twain": "^2.0.3",
"mockjs": "^1.1.0",
"mustache": "^4.2.0",
"ng-alain-plugin-theme": "^16.0.2",
"ng-alain-plugin-theme": "^18.0.0",
"ng-alain-sts": "^0.0.2",
"ng-less-javascript-enabled-patch": "17.0.2",
"ng-packagr": "^18.0.0",
"parse5": "^7.1.2",
"plyr": "^3.7.8",
Expand Down
49 changes: 49 additions & 0 deletions packages/theme/system/mixins/_freak.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module.exports = {
install: function (less, pluginManager, functions) {
functions.add('genComment', function (value, ...comments) {
return (
'/* AUTOGENERATE: ' +
comments
.map(c => c.value)
.join('|SPLIT|')
.replace(/(\{0\})/g, '"' + value.value + '"') +
'*/'
);
});
functions.add('genCommentColor', function (color, ...comments) {
var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.value.substring(1) + '/fff.png&text=+)';
return (
'/* AUTOGENERATE: ' +
comments
.map(c => c.value + imgColor)
.join('|SPLIT|')
.replace(/(\{0\})/g, '"' + color.value + '"') +
'*/'
);
});
functions.add('genCommentTypeColor', function (type, color) {
var comments = [];
switch (type.value) {
case 'text':
comments = ['Set the text color to {0}', '设置文本颜色为 {0}'];
break;
case 'background':
comments = ['Set the background light color to {0}', '设置背景颜色为 {0}'];
break;
case 'hoverBackground':
comments = ['Set the hover background color to {0}', '设置悬停时背景颜色为 {0}'];
break;
}
if (comments.length === 0) return '';
var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.value.substring(1) + '/fff.png&text=+)';
return (
'/* AUTOGENERATE: ' +
comments
.map(c => c + imgColor)
.join('|SPLIT|')
.replace(/(\{0\})/g, '"' + color.value + '"') +
'*/'
);
});
}
};
58 changes: 1 addition & 57 deletions packages/theme/system/mixins/_freak.less
Original file line number Diff line number Diff line change
@@ -1,57 +1 @@
.freakMixin() {
@functions: ~`(function() {
function toColorList(list) {
list = list.slice(1, list.length - 1).split(',');
var ret = [];
for (var i = 0, c = list.length; i < c; i++) {
ret.push(list[i].trim().split(' '));
}
return ret;
}

var catchColors;
function _initColor(list) {
if (!catchColors) catchColors = toColorList(list);
}

this.getColor = function(list, name, position) {
_initColor(list);
var ret = '';
for (var i = 0, c = catchColors.length; i < c; i++) {
if (catchColors[i][0] === name) {
ret = catchColors[i][position - 1];
break;
}
}
return ret;
}

this.genComment = function(value, ...comments) {
return '/* AUTOGENERATE: ' + comments.join('|SPLIT|').replace(/(\{0\})/g, '"' + value + '"') + '*/';
}

this.genCommentColor = function(color, ...comments) {
var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.substring(1) + '/fff.png&text=+)';
return '/* AUTOGENERATE: ' + comments.map(c => c + imgColor).join('|SPLIT|').replace(/(\{0\})/g, '"' + color + '"') + '*/';
}

this.genCommentTypeColor = function(type, color) {
var comments = [];
switch (type) {
case 'text':
comments = ['Set the text color to {0}', '设置文本颜色为 {0}'];
break;
case 'background':
comments = ['Set the background light color to {0}', '设置背景颜色为 {0}'];
break;
case 'hoverBackground':
comments = ['Set the hover background color to {0}', '设置悬停时背景颜色为 {0}'];
break;
}
if (comments.length === 0) return '';
var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.substring(1) + '/fff.png&text=+)';
return '/* AUTOGENERATE: ' + comments.map(c => c + imgColor).join('|SPLIT|').replace(/(\{0\})/g, '"' + color + '"') + '*/';
}
})()`;
}
.freakMixin();
@plugin "./_freak";
41 changes: 27 additions & 14 deletions packages/theme/system/utils/_border.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,42 @@
}

@border-width-list: 0, 1;

.for(@border-width-list, {
.border-css-mixin(@i) when(@i > 0) {
@css-value-comment: ~'1px';
@css-value: ~'@{i}px solid @{border-color}';
}

.border-css-mixin(@i) when(default()) {
@css-value-comment: ~'0px';
@css-value: 0;
}

.border-css-mixin(@adIndex);

.border-@{adIndex} {
e(~`genComment('@{css-value-comment}', 'Set the border size to {0}', '设置边框大小为 {0}')`);
genComment('@{css-value-comment}', 'Set the border size to {0}', '设置边框大小为 {0}');
border: @css-value !important;
}

.border-top-@{adIndex} {
e(~`genComment('@{css-value-comment}', 'Set the top border size to {0}', '设置上边框大小为 {0}')`);
genComment('@{css-value-comment}', 'Set the top border size to {0}', '设置上边框大小为 {0}');
border-top: @css-value !important;
}

.border-right-@{adIndex} {
e(~`genComment('@{css-value-comment}', 'Set the right border size to {0}', '设置右边框大小为 {0}')`);
genComment('@{css-value-comment}', 'Set the right border size to {0}', '设置右边框大小为 {0}');
border-right: @css-value !important;
}

.border-bottom-@{adIndex} {
e(~`genComment('@{css-value-comment}', 'Set the bottom border size to {0}', '设置下边框大小为 {0}')`);
genComment('@{css-value-comment}', 'Set the bottom border size to {0}', '设置下边框大小为 {0}');
border-bottom: @css-value !important;
}

.border-left-@{adIndex} {
e(~`genComment('@{css-value-comment}', 'Set the left border size to {0}', '设置左边框大小为 {0}')`);
genComment('@{css-value-comment}', 'Set the left border size to {0}', '设置左边框大小为 {0}');
border-left: @css-value !important;
}
});
Expand All @@ -49,38 +56,42 @@
.for-each(@colors, {
.border-@{adKey} {
@border-colors-color: extract(@adItem, @color-basic-position);
e(~`genCommentColor('@{border-colors-color}', 'Set the border color to {0}', '设置边框颜色为 {0}')`);
genCommentColor('@{border-colors-color}', 'Set the border color to {0}', '设置边框颜色为 {0}');
border-color: @border-colors-color !important;
}
});

.for-each(@aliasColors, {
.border-@{adKey} {
e(~`genComment('@{adValue}', 'Set the border color to {0}', '设置边框颜色为 {0}')`);
genComment('@{adValue}', 'Set the border color to {0}', '设置边框颜色为 {0}');
border-color: @adValue !important;
}
});

// Border-radius
.for-each(@border-grids, {
.rounded-@{adKey} {
e(~`genComment('@{adValue}', 'Set the border radius to {0}', '设置边框圆角为 {0}')`);
genComment('@{adValue}', 'Set the border radius to {0}', '设置边框圆角为 {0}');
border-radius: @adValue;
}

.rounded-top-left-@{adKey} {
e(~`genComment('@{adValue}', 'Set the border top-left corner to {0}', '设置左上角边框圆角为 {0}')`);
genComment('@{adValue}', 'Set the border top-left corner to {0}', '设置左上角边框圆角为 {0}');
border-top-left-radius: @adValue;
}

.rounded-top-right-@{adKey} {
e(~`genComment('@{adValue}', 'Set the border top-right corner to {0}', '设置右上角边框圆角为 {0}')`);
genComment('@{adValue}', 'Set the border top-right corner to {0}', '设置右上角边框圆角为 {0}');
border-top-right-radius: @adValue;
}

.rounded-bottom-left-@{adKey} {
e(~`genComment('@{adValue}', 'Set the border bottom-left corner to {0}', '设置左下角边框圆角为 {0}')`);
genComment('@{adValue}', 'Set the border bottom-left corner to {0}', '设置左下角边框圆角为 {0}');
border-bottom-left-radius: @adValue;
}

.rounded-bottom-right-@{adKey} {
e(~`genComment('@{adValue}', 'Set the border bottom-right corner to {0}', '设置右下角边框圆角为 {0}')`);
genComment('@{adValue}', 'Set the border bottom-right corner to {0}', '设置右下角边框圆角为 {0}');
border-bottom-right-radius: @adValue;
}
});
Expand Down Expand Up @@ -117,11 +128,13 @@
*/
.rotate-loop(@i) when (@i > 0) {
@num: @i * 15;

.rotate-@{num} {
e(~`genComment('@{num}', 'Element transform to {0} degree', '元素旋转 {0} 度')`);
genComment('@{num}', 'Element transform to {0} degree', '元素旋转 {0} 度');
transform: rotate(~'@{num}deg');
}

.rotate-loop(@i - 1);
}

.rotate-loop(@rotate-count);
.rotate-loop(@rotate-count);
Loading
Loading