Skip to content

Commit

Permalink
feat(angular-icons): update icons (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation authored May 13, 2019
1 parent 7b73b5e commit a579e74
Show file tree
Hide file tree
Showing 996 changed files with 19,953 additions and 5,442 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[*.md]
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Auto detect text files and perform LF normalization
* text=input
6 changes: 3 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package-lock.json
dist
angular.json
.vscode/*
projects/*/*/schematics/*/index.js
projects/*/*/schematics/*/files
projects/**/schematics/*/index.js
projects/**/schematics/*/files
projects/angular-showcase/src/assets/**/*
projects/angular-showcase/src/docs/**/*
tools
coverage
**/icon-*.module.ts
**/svg-icons/**/icon-*.module.ts
**/*.svg
**/*.properties
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@
"projects/sbb-esta/angular-icons/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
"**/node_modules/**",
"**/schematics/*/files/**/*"
]
}
}
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 34 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,37 @@
"ng": "ng",
"start": "ng serve",
"clean": "rimraf dist coverage lintReport.json",
"lint": "ng lint angular-showcase",
"test": "ng test angular-showcase -c ci",
"build": "ng build angular-showcase --prod",
"build:angular-icons": "cd projects/sbb-esta/angular-icons && npm run build",
"build:angular-icons:license": "cd projects/sbb-esta/angular-icons && npm run build:license",
"build:angular-icons:schematics": "cd projects/sbb-esta/angular-icons && npm run build:schematics",
"build:angular-public": "cd projects/sbb-esta/angular-public && npm run build",
"e2e": "ng e2e angular-showcase",
"docs": "gulp docs"
"build": "run-s angular-icons angular-public angular-showcase",
"angular-icons": "run-s angular-icons:*",
"angular-icons:lint": "ng lint @sbb-esta/angular-icons",
"angular-icons:build": "run-s angular-icons:build:*",
"angular-icons:build:ng": "ng build @sbb-esta/angular-icons",
"angular-icons:build:license": "copyfiles LICENSE ./dist/sbb-esta/angular-icons/",
"angular-icons:build:schematics": "cd projects/sbb-esta/angular-icons && rollup --config rollup.config.js",
"angular-icons:build:schematics:generate-icons": "cd projects/sbb-esta/angular-icons && schematics .:generate-icon-modules --dist src/lib --debug false",
"angular-business": "run-s angular-business:*",
"angular-business:lint": "ng lint @sbb-esta/angular-business",
"angular-business:test": "ng test @sbb-esta/angular-business -c ci",
"angular-business:build": "run-s angular-business:build:*",
"angular-business:build:ng": "ng build @sbb-esta/angular-business",
"angular-business:build:license": "copyfiles LICENSE ./dist/sbb-esta/angular-business/",
"angular-public": "run-s angular-public:lint angular-public:test angular-public:build",
"angular-public:lint": "run-p angular-public:lint:*",
"angular-public:lint:console": "ng lint @sbb-esta/angular-icons",
"angular-public:lint:report": "ng lint @sbb-esta/angular-icons > lintReport.json",
"angular-public:test": "ng test @sbb-esta/angular-public -c ci",
"angular-public:sonar": "cross-env-shell \"sonar-scanner -Dsonar.projectVersion=$npm_package_version -Dsonar.branch.name=$BRANCH_NAME\"",
"angular-public:build": "run-s angular-public:build:*",
"angular-public:build:ng": "ng build @sbb-esta/angular-public",
"angular-public:build:styles": "scss-bundle -e ./projects/sbb-esta/angular-public/src/styles/main.scss -d ./dist/sbb-esta/angular-public/styles.scss",
"angular-public:build:typography": "node-sass ./projects/sbb-esta/angular-public/src/typography.scss ./dist/sbb-esta/angular-public/typography.css",
"angular-public:build:license": "copyfiles LICENSE ./dist/sbb-esta/angular-public/",
"angular-showcase": "run-s angular-showcase:lint angular-showcase:test angular-showcase:build",
"angular-showcase:lint": "ng lint angular-showcase",
"angular-showcase:test": "ng test angular-showcase -c ci",
"angular-showcase:build": "ng build angular-showcase --prod",
"angular-showcase:e2e": "ng e2e angular-showcase",
"angular-showcase:docs": "gulp docs"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -101,6 +123,7 @@
"prettier": "1.17.0",
"protractor": "^5.4.2",
"rollup": "^1.9.0",
"rollup-plugin-copy-glob": "^0.3.0",
"rollup-plugin-typescript2": "^0.20.1",
"run-sequence": "^2.2.1",
"scss-bundle": "^2.4.0",
Expand All @@ -126,6 +149,7 @@
},
"prettier": {
"singleQuote": true,
"endOfLine": "lf",
"overrides": [
{
"files": "*.html",
Expand All @@ -142,7 +166,7 @@
},
"lint-staged": {
"*.{js,ts,css,scss,json,md,html}": [
"prettier --write",
"npx prettier --write",
"git add",
"npx ng lint @sbb-esta/angular-public"
]
Expand Down
4 changes: 2 additions & 2 deletions projects/angular-showcase/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MonacoEditorModule } from 'ngx-monaco-editor';
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
import {
IconCollectionModule,
iconComponentList
ICON_COMPONENT_LIST
} from '@sbb-esta/angular-icons';

import { AppRoutingModule } from './app-routing.module';
Expand Down Expand Up @@ -135,7 +135,7 @@ import { TypographyComponent } from './typography/typography.component';
BreadcrumbShowcaseComponent,
GhettoboxShowcaseComponent,
BadgeShowcaseComponent,
...iconComponentList
...ICON_COMPONENT_LIST
]
})
export class AppModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
OnChanges,
ViewContainerRef
} from '@angular/core';
import { iconComponentsMetaInformation } from '@sbb-esta/angular-icons';
import { ICON_COMPONENT_META_INFORMATION } from '@sbb-esta/angular-icons';

import { UiIcon } from '../shared/ui-icon';

Expand All @@ -24,7 +24,7 @@ export class IconViewerDirective implements OnChanges {
) {}

loadIconComponent(): void {
const component = iconComponentsMetaInformation.find(
const component = ICON_COMPONENT_META_INFORMATION.find(
i => i.name === this.sbbIconViewer.name
).component;
const componentFactory = this._resolver.resolveComponentFactory(component);
Expand Down
74 changes: 38 additions & 36 deletions projects/angular-showcase/src/app/services/icon-ui.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { iconComponentsMetaInformation } from '@sbb-esta/angular-icons';
import { ICON_COMPONENT_META_INFORMATION } from '@sbb-esta/angular-icons';

import { UiComponent } from '../shared/ui-component';
import { UiIcon } from '../shared/ui-icon';
Expand All @@ -9,21 +9,21 @@ import { UiIcon } from '../shared/ui-icon';
})
export class IconUiService {
getUiIconByRouterLink(name: any): UiIcon {
return iconComponentsMetaInformation
.map(item => new UiIcon(item.name, item.selector, item.modules))
.find(
uiIcon =>
uiIcon.name.localeCompare(name, 'en', { sensitivity: 'base' }) === 0
);
return ICON_COMPONENT_META_INFORMATION.map(
item => new UiIcon(item.name, item.selector, item.modules)
).find(
uiIcon =>
uiIcon.name.localeCompare(name, 'en', { sensitivity: 'base' }) === 0
);
}

getUiComponentByRouterLink(name: any): UiComponent {
const foundUiIcon: UiIcon = iconComponentsMetaInformation
.map(item => new UiIcon(item.name, item.selector, item.modules))
.find(
uiIcon =>
uiIcon.name.localeCompare(name, 'en', { sensitivity: 'base' }) === 0
);
const foundUiIcon: UiIcon = ICON_COMPONENT_META_INFORMATION.map(
item => new UiIcon(item.name, item.selector, item.modules)
).find(
uiIcon =>
uiIcon.name.localeCompare(name, 'en', { sensitivity: 'base' }) === 0
);
return new UiComponent(
foundUiIcon.name,
foundUiIcon.name,
Expand All @@ -39,33 +39,35 @@ export class IconUiService {
}

getUiIconsBySearchValue(searchValue: any) {
if (searchValue.length > 0) {
return iconComponentsMetaInformation
.filter(
uiIcon =>
new RegExp(searchValue, 'ig').test(uiIcon.name) ||
new RegExp(searchValue, 'ig').test(uiIcon.selector) ||
uiIcon.modules.find(tag => new RegExp(searchValue, 'ig').test(tag))
)
.map(item => new UiIcon(item.name, item.selector, item.modules))
.map(uiIcon => {
if (new RegExp(searchValue, 'ig').test(uiIcon.name)) {
uiIcon.label = uiIcon.label.replace(
new RegExp(searchValue, 'ig'),
m => `<b>${m}</b>`
);
}
return uiIcon;
})
.sort((a, b) => a.name.localeCompare(b.name));
if (!searchValue) {
return this.getAll();
}

return this.getAll();
const searchRegex = new RegExp(searchValue, 'ig');
return ICON_COMPONENT_META_INFORMATION.filter(
icon =>
searchRegex.test(icon.name) ||
searchRegex.test(icon.selector) ||
icon.modules.find(tag => searchRegex.test(tag))
)
.sort((a, b) => a.name.localeCompare(b.name))
.concat(
ICON_COMPONENT_META_INFORMATION.filter(icon =>
icon.meta.some(m => searchRegex.test(m))
)
)
.map(icon => new UiIcon(icon.name, icon.selector, icon.modules))
.map(icon => {
if (searchRegex.test(icon.name)) {
icon.label = icon.label.replace(searchRegex, m => `<b>${m}</b>`);
}
return icon;
});
}

getAll(): Array<UiIcon> {
return iconComponentsMetaInformation
.map(item => new UiIcon(item.name, item.selector, item.modules))
.sort((a, b) => a.name.localeCompare(b.name));
return ICON_COMPONENT_META_INFORMATION.map(
item => new UiIcon(item.name, item.selector, item.modules)
).sort((a, b) => a.name.localeCompare(b.name));
}
}
8 changes: 0 additions & 8 deletions projects/sbb-esta/angular-business/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
{
"name": "@sbb-esta/angular-business",
"version": "0.0.0-PLACEHOLDER",
"scripts": {
"lint": "ng lint @sbb-esta/angular-business",
"test": "ng test @sbb-esta/angular-business -c ci",
"build": "run-s build:ng build:license",
"build:ng": "ng build @sbb-esta/angular-business",
"build:license": "cd ../../../ && copyfiles LICENSE ./dist/sbb-esta/angular-business/",
"build:schematics": "rollup --config rollup.config.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SchweizerischeBundesbahnen/sbb-angular.git"
Expand Down
8 changes: 0 additions & 8 deletions projects/sbb-esta/angular-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
{
"name": "@sbb-esta/angular-icons",
"version": "0.0.0-PLACEHOLDER",
"scripts": {
"lint": "ng lint @sbb-esta/angular-icons",
"test": "ng test @sbb-esta/angular-icons -c ci",
"build": "run-s build:ng build:license",
"build:ng": "ng build @sbb-esta/angular-icons",
"build:license": "cd ../../../ && copyfiles LICENSE ./dist/sbb-esta/angular-icons/",
"build:schematics": "rollup --config rollup.config.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SchweizerischeBundesbahnen/sbb-angular.git"
Expand Down
34 changes: 27 additions & 7 deletions projects/sbb-esta/angular-icons/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import typescript from 'rollup-plugin-typescript2';
import copy from 'rollup-plugin-copy-glob';
import { join } from 'path';

export default {
input: './schematics/generate-icon-modules/index.ts',
output: {
file: './schematics/generate-icon-modules/index.js',
format: 'cjs'
},
input: join(__dirname, 'schematics/generate-icon-modules/index.ts'),
output: [
{
file: join(__dirname, 'schematics/generate-icon-modules/index.js'),
format: 'cjs'
},
{
file: join(
__dirname,
'../../../dist/sbb-esta/angular-icons/schematics/generate-icon-modules/index.js'
),
format: 'cjs'
}
],
external: [
'@angular-devkit/schematics',
'@angular-devkit/core',
Expand All @@ -14,8 +25,17 @@ export default {
],
plugins: [
typescript({
tsconfig: 'tsconfig.schematics.json',
tsconfig: join(__dirname, 'tsconfig.schematics.json'),
cacheRoot: `${require('os').tmpdir()}/.rpt2_cache_seai_schematics`
})
}),
copy([
{
files: join(__dirname, 'schematics/generate-icon-modules/files/**/*.*'),
dest: join(
__dirname,
'../../../dist/sbb-esta/angular-icons/schematics/generate-icon-modules/files'
)
}
])
]
};
4 changes: 2 additions & 2 deletions projects/sbb-esta/angular-icons/schematics/collection.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
"$schema": "../../../../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"generate-icon-modules": {
"description": "A blank schematic.",
"description": "Generate icon modules.",
"factory": "./generate-icon-modules/index#generateIconModules",
"schema": "./generate-icon-modules/schema.json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const iconComponentsMetaInformation = [<% for (let icon of icons) { %>
sizes: [<% for (let size of icon.sizes) { %>
'<%= size %>',<% } %>
],
meta: [<% for (let meta of icon.meta) { %>
'<%= meta %>',<% } %>
],
component: Icon<%= classify(icon.name) %>Component,
},<% } %>
];
Expand Down

This file was deleted.

Loading

0 comments on commit a579e74

Please sign in to comment.