Skip to content

Commit 318373c

Browse files
committed
chore: add coreui-icons-angular to the monorepo
1 parent 82613cb commit 318373c

33 files changed

+1190
-3
lines changed

angular.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,51 @@
9898
}
9999
}
100100
}
101+
},
102+
"coreui-icons-angular": {
103+
"projectType": "library",
104+
"schematics": {
105+
"@schematics/angular:component": {
106+
"style": "scss"
107+
}
108+
},
109+
"root": "projects/coreui-icons-angular",
110+
"sourceRoot": "projects/coreui-icons-angular/src",
111+
"prefix": "c",
112+
"architect": {
113+
"build": {
114+
"builder": "@angular-devkit/build-angular:ng-packagr",
115+
"options": {
116+
"project": "projects/coreui-icons-angular/ng-package.json"
117+
},
118+
"configurations": {
119+
"production": {
120+
"tsConfig": "projects/coreui-icons-angular/tsconfig.lib.prod.json"
121+
},
122+
"development": {
123+
"tsConfig": "projects/coreui-icons-angular/tsconfig.lib.json"
124+
}
125+
},
126+
"defaultConfiguration": "production"
127+
},
128+
"test": {
129+
"builder": "@angular-devkit/build-angular:karma",
130+
"options": {
131+
"main": "projects/coreui-icons-angular/src/test.ts",
132+
"tsConfig": "projects/coreui-icons-angular/tsconfig.spec.json",
133+
"karmaConfig": "projects/coreui-icons-angular/karma.conf.js"
134+
}
135+
},
136+
"lint": {
137+
"builder": "@angular-eslint/builder:lint",
138+
"options": {
139+
"lintFilePatterns": [
140+
"projects/coreui-icons-angular/**/*.ts",
141+
"projects/coreui-icons-angular/**/*.html"
142+
]
143+
}
144+
}
145+
}
101146
}
102147
}
103148
}

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build:lib:prod": "ng build coreui-angular",
1111
"test:lib:dev": "ng test coreui-angular",
1212
"test:lib:prod": "ng test coreui-angular --karma-config=projects/coreui-angular/karma.conf.github.js",
13-
"prepublish:lib": "ng lint coreui-angular && ng test coreui-angular --watch=false && ng build coreui-angular",
13+
"prepublish:lib": "ng build coreui-icons-angular && ng lint coreui-angular && ng test coreui-angular --watch=false && ng build coreui-angular",
1414
"publish:lib": "cd dist/coreui-angular/ && npm publish --tag next --dry-run",
1515
"lint:lib": "ng lint coreui-angular",
1616
"link:lib": "cd dist/coreui-angular/ && npm link",
@@ -22,7 +22,16 @@
2222
"prepublish:chartjs": "ng lint coreui-angular-chartjs && ng test coreui-angular-chartjs --watch=false && ng build coreui-angular-chartjs",
2323
"publish:chartjs": "cd dist/coreui-angular-chartjs/ && npm publish --tag next --dry-run",
2424
"lint:chartjs": "ng lint coreui-angular-chartjs",
25-
"link:chartjs": "cd dist/coreui-angular-chartjs/ && npm link"
25+
"link:chartjs": "cd dist/coreui-angular-chartjs/ && npm link",
26+
"icons": "ng",
27+
"watch:icons:dev": "ng build coreui-icons-angular --watch --configuration development",
28+
"build:icons:prod": "ng build coreui-icons-angular",
29+
"test:icons:dev": "ng test coreui-icons-angular",
30+
"test:icons:prod": "ng test coreui-icons-angular --karma-config=projects/coreui-icons-angular/karma.conf.github.js",
31+
"prepublish:icons": "ng lint coreui-icons-angular && ng test coreui-icons-angular --watch=false && ng build coreui-icons-angular",
32+
"publish:icons": "cd dist/coreui-icons-angular/ && npm publish --tag next --dry-run",
33+
"lint:icons": "ng lint coreui-icons-angular",
34+
"link:icons": "cd dist/coreui-icons-angular/ && npm link"
2635
},
2736
"private": true,
2837
"dependencies": {
@@ -37,7 +46,6 @@
3746
"@angular/platform-browser-dynamic": "^14.0.0",
3847
"@angular/router": "^14.0.0",
3948
"@coreui/chartjs": "^3.0.0",
40-
"@coreui/icons-angular": "^3.0.0",
4149
"@popperjs/core": "~2.11.5",
4250
"chart.js": "^3.7.1",
4351
"rxjs": "~7.5.0",
@@ -54,6 +62,7 @@
5462
"@angular/cli": "^14.0.0",
5563
"@angular/compiler-cli": "^14.0.0",
5664
"@angular/language-service": "^14.0.0",
65+
"@coreui/icons": "^2.1.0",
5766
"@types/jasmine": "~4.0.0",
5867
"@types/lodash-es": "^4.17.6",
5968
"@types/node": "^16.11.43",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
"ignorePatterns": [
4+
"!**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"./tsconfig.json"
14+
],
15+
"createDefaultProgram": true
16+
},
17+
"rules": {
18+
"@angular-eslint/directive-selector": [
19+
"error",
20+
{
21+
"type": "attribute",
22+
"prefix": "c",
23+
"style": "camelCase"
24+
}
25+
],
26+
"@angular-eslint/component-selector": [
27+
"warn",
28+
{
29+
"type": "element",
30+
"prefix": "c",
31+
"style": "kebab-case"
32+
}
33+
],
34+
"@angular-eslint/no-input-rename": [
35+
"warn"
36+
]
37+
}
38+
},
39+
{
40+
"files": [
41+
"*.html"
42+
],
43+
"rules": {}
44+
}
45+
]
46+
}
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<p align="center">
2+
<a href="https://coreui.io/">
3+
<img
4+
src="https://coreui.io/images/brand/coreui-signet.svg"
5+
alt="CoreUI logo"
6+
width="200"
7+
/>
8+
</a>
9+
</p>
10+
11+
<h3 align="center">CoreUI Icons for Angular</h3>
12+
13+
<p align="center">
14+
<br>
15+
<a href="https://coreui.io/angular/docs/icons"><strong>Explore CoreUI for Angular docs »</strong></a>
16+
<br>
17+
<br>
18+
<a href="https://icons.coreui.io/"><strong>CoreUI Icons »</strong></a>
19+
<br>
20+
<br>
21+
<a href="https://github.com/coreui/coreui-icons-angular/issues/new?template=bug_report.md">Report a bug</a>
22+
·
23+
<a href="https://github.com/coreui/coreui-icons-angular/issues/new?template=feature_request.md">Request a feature</a>
24+
·
25+
<a href="https://blog.coreui.io/">Blog</a>
26+
</p>
27+
28+
# CoreUI Icons Angular
29+
30+
![angular][angular-badge]
31+
[![NPM](https://img.shields.io/npm/v/@coreui/icons-angular/latest?style=flat-square&color=brightgreen)][coreui-angular-icons-npm]
32+
[![npm-coreui-angular-next][npm-coreui-icons-angular-next]][coreui-angular-icons-npm]
33+
[![Downloads](https://img.shields.io/npm/dm/@coreui/icons-angular.svg?style=flat-square)][coreui-angular-icons-npm]
34+
[![License](https://img.shields.io/npm/l/@coreui/angular?style=flat-square)][coreui]
35+
36+
[coreui]: https://coreui.io/icons
37+
[coreui-angular-icons-npm]: https://www.npmjs.com/package/@coreui/icons-angular
38+
[npm-coreui-icons-angular-next]: https://img.shields.io/npm/v/@coreui/icons-angular/next.png?style=flat-square&color=red
39+
[angular-badge]: https://img.shields.io/badge/angular-^14.0.0-lightgrey.svg?style=flat-square&logo=angular
40+
41+
## `cIcon` directive
42+
43+
Angular directive for [CoreUI Icons SVG set](https://coreui.io/icons/).
44+
45+
### Features
46+
47+
- Load icons:
48+
- stored in Angular root service,
49+
- directly passed SVG content,
50+
- Reduce icons bundle size when imported as single icons,
51+
- Full functionality of `<svg>` tag,
52+
- Clean API
53+
54+
For directive description visit [https://coreui.io/angular/docs/](https://coreui.io/angular/docs/4.0/)
55+
56+
### Installation
57+
58+
```shell
59+
npm install @coreui/icons
60+
npm install @coreui/icons-angular
61+
```
62+
63+
### Usage
64+
65+
```ts
66+
// app NgModule
67+
68+
import { IconModule, IconSetService } from '@coreui/icons-angular';
69+
70+
@NgModule({
71+
imports: [
72+
IconModule,
73+
...
74+
providers: [IconSetService],
75+
...
76+
```
77+
78+
```ts
79+
// app component
80+
81+
import { cilEnvelopeOpen, flagSet } from '@coreui/icons';
82+
import { IconSetService } from '@coreui/icons-angular';
83+
84+
@Component({
85+
...
86+
})
87+
export class AppComponent implements OnInit {
88+
constructor(public iconSet: IconSetService) {
89+
// iconSet singleton
90+
iconSet.icons = { cilEnvelopeOpen, ...flagSet };
91+
}
92+
...
93+
```
94+
95+
```jsx
96+
<svg cIcon name="cil-envelope-open" size="lg"></svg>
97+
<svg cIcon name="cifAu"></svg>
98+
```
99+
100+
### API
101+
102+
#### Icon _directive_
103+
> Use one of `name` or `content` prop as it defines the way of icon import
104+
105+
##### Inputs
106+
107+
proprerty | type | default | description
108+
---|---|---|---
109+
`name` | string | undefined | name of SVG icon stored in IconSetService
110+
`content` | string, string[] | undefined | SVG content
111+
`size` | `custom`, `custom-size`, `sm`, `lg`, `xl`, `xxl`, `3xl`, `4xl`, `5xl`, `6xl`, `7xl`, `8xl`, `9xl` | '' | Size of icon
112+
`title` | string | undefined |
113+
`customClasses` | string | undefined | Overwrites default `.icon` classes
114+
`viewBox` | string | undefined | SVG `viewbox`
115+
`width` | string | undefined | SVG `width`
116+
`height` | string | undefined | SVG `height`
117+
118+
---
119+
120+
#### IconSet _service_
121+
122+
##### Props
123+
124+
| proprerty | type | default | description|
125+
| --- | --- | --- | --- |
126+
| `getIcon()` | `(string): any[] ` | | returns an icon |
127+
| `icons` | `IIconSet` | undefined | IconSet object |
128+
| `iconNames` | `[key: string]: string` | _undefined_ | returns icon name from key |
129+
130+
---
131+
132+
## Support CoreUI Development
133+
134+
CoreUI is an MIT-licensed open source project and is completely free to use. However, the amount of effort needed to maintain and develop new features for the project is not sustainable without proper financial backing. You can support development by buying the [CoreUI PRO](https://coreui.io/pricing/) or by becoming a sponsor via [Open Collective](https://opencollective.com/coreui/).
135+
136+
<!--- StartOpenCollectiveBackers -->
137+
138+
### Platinum Sponsors
139+
140+
Support this project by [becoming a Platinum Sponsor](https://opencollective.com/coreui/contribute/platinum-sponsor-40959/). A large company logo will be added here with a link to your website.
141+
142+
<a href="https://opencollective.com/coreui/contribute/platinum-sponsor-40959/checkout"><img src="https://opencollective.com/coreui/tiers/platinum-sponsor/0/avatar.svg?avatarHeight=100"></a>
143+
144+
### Gold Sponsors
145+
146+
Support this project by [becoming a Gold Sponsor](https://opencollective.com/coreui/contribute/gold-sponsor-40960/). A big company logo will be added here with a link to your website.
147+
148+
<a href="https://opencollective.com/coreui/contribute/gold-sponsor-40960/checkout"><img src="https://opencollective.com/coreui/tiers/gold-sponsor/0/avatar.svg?avatarHeight=100"></a>
149+
150+
### Silver Sponsors
151+
152+
Support this project by [becoming a Silver Sponsor](https://opencollective.com/coreui/contribute/silver-sponsor-40967/). A medium company logo will be added here with a link to your website.
153+
154+
<a href="https://opencollective.com/coreui/contribute/silver-sponsor-40967/checkout"><img src="https://opencollective.com/coreui/tiers/gold-sponsor/0/avatar.svg?avatarHeight=100"></a>
155+
156+
### Bronze Sponsors
157+
158+
Support this project by [becoming a Bronze Sponsor](https://opencollective.com/coreui/contribute/bronze-sponsor-40966/). The company avatar will show up here with a link to your OpenCollective Profile.
159+
160+
<a href="https://opencollective.com/coreui/contribute/bronze-sponsor-40966/checkout"><img src="https://opencollective.com/coreui/tiers/bronze-sponsor/0/avatar.svg?avatarHeight=100"></a>
161+
162+
### Backers
163+
164+
Thanks to all the backers and sponsors! Support this project by [becoming a backer](https://opencollective.com/coreui/contribute/backer-40965/).
165+
166+
<a href="https://opencollective.com/coreui/contribute/backer-40965/checkout" target="_blank" rel="noopener"><img src="https://opencollective.com/coreui/backers.svg?width=890"></a>
167+
168+
<!--- EndOpenCollectiveBackers -->
169+
170+
## Copyright and license
171+
172+
Copyright 2022 creativeLabs Łukasz Holeczek. Code released under the [MIT License](https://github.com/coreui/coreui-angular/blob/main/LICENSE). Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/).
173+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, '../../coverage/coreui-icons-angular'),
29+
subdir: '.',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text-summary' }
33+
]
34+
},
35+
reporters: ['progress', 'kjhtml'],
36+
port: 9876,
37+
colors: true,
38+
logLevel: config.LOG_INFO,
39+
autoWatch: false,
40+
browsers: ['ChromeHeadless'],
41+
singleRun: true,
42+
restartOnFileChange: false
43+
});
44+
};

0 commit comments

Comments
 (0)