├── .editorconfig
├── .gitignore
├── README.md
├── angular.json
├── e2e
├── protractor.conf.js
├── src
│ ├── app.e2e-spec.ts
│ └── app.po.ts
└── tsconfig.e2e.json
├── package-lock.json
├── package.json
├── src
├── app
│ ├── app.component.html
│ ├── app.component.scss
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── dinos
│ │ ├── brachio
│ │ │ ├── brachio.component.html
│ │ │ ├── brachio.component.scss
│ │ │ └── brachio.component.ts
│ │ ├── dinos.scss
│ │ ├── ptero
│ │ │ ├── ptero.component.html
│ │ │ ├── ptero.component.scss
│ │ │ └── ptero.component.ts
│ │ ├── stego
│ │ │ ├── stego.component.html
│ │ │ ├── stego.component.scss
│ │ │ └── stego.component.ts
│ │ ├── trex
│ │ │ ├── trex.component.html
│ │ │ ├── trex.component.scss
│ │ │ └── trex.component.ts
│ │ └── trice
│ │ │ ├── trice.component.html
│ │ │ ├── trice.component.scss
│ │ │ └── trice.component.ts
│ └── theme.directive.ts
├── assets
│ └── .gitkeep
├── browserslist
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── karma.conf.js
├── main.ts
├── polyfills.ts
├── styles.scss
├── test.ts
├── tsconfig.app.json
├── tsconfig.spec.json
└── tslint.json
├── tsconfig.json
└── tslint.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 |
8 | # dependencies
9 | /node_modules
10 |
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | .c9/
16 | *.launch
17 | .settings/
18 | *.sublime-workspace
19 |
20 | # IDE - VSCode
21 | .vscode/*
22 | !.vscode/settings.json
23 | !.vscode/tasks.json
24 | !.vscode/launch.json
25 | !.vscode/extensions.json
26 |
27 | # misc
28 | /.sass-cache
29 | /connect.lock
30 | /coverage
31 | /libpeerconnection.log
32 | npm-debug.log
33 | yarn-error.log
34 | testem.log
35 | /typings
36 |
37 | # System Files
38 | .DS_Store
39 | Thumbs.db
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DinoThemes
2 |
3 | A demonstration of theming Angular applications using _CSS Custom Properties_.
4 |
5 | Read the description of the technique in the article: [Theming Angular](https://medium.com/@tomsu/theming-angular-c869827738c3).
6 |
7 | #### License
8 |
9 | The images used here are acquired under a commercial license and you are not allowed to redistribute them.
10 | However I strongly encourage you to visit the creator's Etsy shop where you can buy this and similar works: [etsy.com/shop/DigitalDownloadShop](https://www.etsy.com/shop/DigitalDownloadShop?ref=sulco)
11 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "dino-themes": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "dt",
11 | "schematics": {
12 | "@schematics/angular:component": {
13 | "styleext": "scss",
14 | "spec": false
15 | },
16 | "@schematics/angular:class": {
17 | "spec": false
18 | },
19 | "@schematics/angular:directive": {
20 | "spec": false
21 | },
22 | "@schematics/angular:guard": {
23 | "spec": false
24 | },
25 | "@schematics/angular:module": {
26 | "spec": false
27 | },
28 | "@schematics/angular:pipe": {
29 | "spec": false
30 | },
31 | "@schematics/angular:service": {
32 | "spec": false
33 | }
34 | },
35 | "architect": {
36 | "build": {
37 | "builder": "@angular-devkit/build-angular:browser",
38 | "options": {
39 | "outputPath": "dist/dino-themes",
40 | "index": "src/index.html",
41 | "main": "src/main.ts",
42 | "polyfills": "src/polyfills.ts",
43 | "tsConfig": "src/tsconfig.app.json",
44 | "assets": [
45 | "src/favicon.ico",
46 | "src/assets"
47 | ],
48 | "styles": [
49 | "src/styles.scss"
50 | ],
51 | "scripts": []
52 | },
53 | "configurations": {
54 | "production": {
55 | "fileReplacements": [
56 | {
57 | "replace": "src/environments/environment.ts",
58 | "with": "src/environments/environment.prod.ts"
59 | }
60 | ],
61 | "optimization": true,
62 | "outputHashing": "all",
63 | "sourceMap": false,
64 | "extractCss": true,
65 | "namedChunks": false,
66 | "aot": true,
67 | "extractLicenses": true,
68 | "vendorChunk": false,
69 | "buildOptimizer": true,
70 | "budgets": [
71 | {
72 | "type": "initial",
73 | "maximumWarning": "2mb",
74 | "maximumError": "5mb"
75 | }
76 | ]
77 | }
78 | }
79 | },
80 | "serve": {
81 | "builder": "@angular-devkit/build-angular:dev-server",
82 | "options": {
83 | "browserTarget": "dino-themes:build"
84 | },
85 | "configurations": {
86 | "production": {
87 | "browserTarget": "dino-themes:build:production"
88 | }
89 | }
90 | },
91 | "extract-i18n": {
92 | "builder": "@angular-devkit/build-angular:extract-i18n",
93 | "options": {
94 | "browserTarget": "dino-themes:build"
95 | }
96 | },
97 | "test": {
98 | "builder": "@angular-devkit/build-angular:karma",
99 | "options": {
100 | "main": "src/test.ts",
101 | "polyfills": "src/polyfills.ts",
102 | "tsConfig": "src/tsconfig.spec.json",
103 | "karmaConfig": "src/karma.conf.js",
104 | "styles": [
105 | "src/styles.scss"
106 | ],
107 | "scripts": [],
108 | "assets": [
109 | "src/favicon.ico",
110 | "src/assets"
111 | ]
112 | }
113 | },
114 | "lint": {
115 | "builder": "@angular-devkit/build-angular:tslint",
116 | "options": {
117 | "tsConfig": [
118 | "src/tsconfig.app.json",
119 | "src/tsconfig.spec.json"
120 | ],
121 | "exclude": [
122 | "**/node_modules/**"
123 | ]
124 | }
125 | }
126 | }
127 | },
128 | "dino-themes-e2e": {
129 | "root": "e2e/",
130 | "projectType": "application",
131 | "prefix": "",
132 | "architect": {
133 | "e2e": {
134 | "builder": "@angular-devkit/build-angular:protractor",
135 | "options": {
136 | "protractorConfig": "e2e/protractor.conf.js",
137 | "devServerTarget": "dino-themes:serve"
138 | },
139 | "configurations": {
140 | "production": {
141 | "devServerTarget": "dino-themes:serve:production"
142 | }
143 | }
144 | },
145 | "lint": {
146 | "builder": "@angular-devkit/build-angular:tslint",
147 | "options": {
148 | "tsConfig": "e2e/tsconfig.e2e.json",
149 | "exclude": [
150 | "**/node_modules/**"
151 | ]
152 | }
153 | }
154 | }
155 | }
156 | },
157 | "defaultProject": "dino-themes"
158 | }
159 |
--------------------------------------------------------------------------------
/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/lib/config.ts
3 |
4 | const { SpecReporter } = require('jasmine-spec-reporter');
5 |
6 | exports.config = {
7 | allScriptsTimeout: 11000,
8 | specs: [
9 | './src/**/*.e2e-spec.ts'
10 | ],
11 | capabilities: {
12 | 'browserName': 'chrome'
13 | },
14 | directConnect: true,
15 | baseUrl: 'http://localhost:4200/',
16 | framework: 'jasmine',
17 | jasmineNodeOpts: {
18 | showColors: true,
19 | defaultTimeoutInterval: 30000,
20 | print: function() {}
21 | },
22 | onPrepare() {
23 | require('ts-node').register({
24 | project: require('path').join(__dirname, './tsconfig.e2e.json')
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
--------------------------------------------------------------------------------
/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 |
3 | describe('workspace-project App', () => {
4 | let page: AppPage;
5 |
6 | beforeEach(() => {
7 | page = new AppPage();
8 | });
9 |
10 | it('should display welcome message', () => {
11 | page.navigateTo();
12 | expect(page.getParagraphText()).toEqual('Welcome to dino-themes!');
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get('/');
6 | }
7 |
8 | getParagraphText() {
9 | return element(by.css('dt-root h1')).getText();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dino-themes",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "test": "ng test",
9 | "lint": "ng lint",
10 | "e2e": "ng e2e"
11 | },
12 | "private": true,
13 | "dependencies": {
14 | "@angular/animations": "~7.0.0",
15 | "@angular/common": "~7.0.0",
16 | "@angular/compiler": "~7.0.0",
17 | "@angular/core": "~7.0.0",
18 | "@angular/forms": "~7.0.0",
19 | "@angular/http": "~7.0.0",
20 | "@angular/platform-browser": "~7.0.0",
21 | "@angular/platform-browser-dynamic": "~7.0.0",
22 | "@angular/router": "~7.0.0",
23 | "core-js": "^2.5.4",
24 | "rxjs": "~6.3.3",
25 | "zone.js": "~0.8.26"
26 | },
27 | "devDependencies": {
28 | "@angular-devkit/build-angular": "~0.10.0",
29 | "@angular/cli": "~7.0.4",
30 | "@angular/compiler-cli": "~7.0.0",
31 | "@angular/language-service": "~7.0.0",
32 | "@types/node": "~8.9.4",
33 | "@types/jasmine": "~2.8.8",
34 | "@types/jasminewd2": "~2.0.3",
35 | "codelyzer": "~4.5.0",
36 | "jasmine-core": "~2.99.1",
37 | "jasmine-spec-reporter": "~4.2.1",
38 | "karma": "~3.0.0",
39 | "karma-chrome-launcher": "~2.2.0",
40 | "karma-coverage-istanbul-reporter": "~2.0.1",
41 | "karma-jasmine": "~1.1.2",
42 | "karma-jasmine-html-reporter": "^0.2.2",
43 | "protractor": "~5.4.0",
44 | "ts-node": "~7.0.0",
45 | "tslint": "~5.11.0",
46 | "typescript": "~3.1.1"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
Angular theming demo
2 |
3 |
4 | Predefined themes
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
22 |
23 |
24 |
25 |
26 |
27 |
37 |
38 |
39 | Hover / click me
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/src/app/app.component.scss:
--------------------------------------------------------------------------------
1 | :host {
2 | $main: brown;
3 | $accent: orange;
4 |
5 | --color-main: #{$main};
6 | --color-main-darken: #{darken($main, 10)};
7 | --color-main-darken2: #{darken($main, 20)};
8 | --color-main-lighten: #{lighten($main, 20)};
9 | --color-accent: #{$accent};
10 |
11 | display: block;
12 | text-align: center;
13 | }
14 |
15 | .pseudo-classes {
16 | cursor: pointer;
17 |
18 | :hover {
19 | $main: darken(brown, 10);
20 | $accent: blue;
21 |
22 | --color-main: #{$main};
23 | --color-main-darken: #{darken($main, 10)};
24 | --color-main-darken2: #{darken($main, 20)};
25 | --color-main-lighten: #{lighten($main, 20)};
26 | --color-accent: #{$accent};
27 | }
28 |
29 | :active {
30 | $main: tomato;
31 | $accent: yellow;
32 |
33 | --color-main: #{$main};
34 | --color-main-darken: #{darken($main, 10)};
35 | --color-main-darken2: #{darken($main, 20)};
36 | --color-main-lighten: #{lighten($main, 20)};
37 | --color-accent: #{$accent};
38 | }
39 | }
40 |
41 | section {
42 | margin-bottom: 8rem;
43 | }
44 |
45 | .col {
46 | display: flex;
47 | flex-direction: column;
48 | align-items: center;
49 | }
50 |
51 | .dino {
52 | flex-grow: 1;
53 | display: flex;
54 | align-items: flex-end;
55 | padding: 2rem 1rem 1rem;
56 | }
57 |
58 | select,
59 | [type="color"] {
60 | cursor: pointer;
61 | }
62 |
63 | select {
64 | max-width: 180px;
65 | text-align: center;
66 | }
67 |
68 | [type="color"] {
69 | margin-top: 1rem;
70 | border: none;
71 | width: 40px;
72 | height: 40px;
73 | }
74 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | interface DinoThemes {
4 | [name: string]: DinoTheme;
5 | }
6 |
7 | interface DinoTheme {
8 | 'color-main': string;
9 | 'color-main-darken': string;
10 | 'color-main-darken2': string;
11 | 'color-main-lighten': string;
12 | 'color-accent': string;
13 | }
14 |
15 | @Component({
16 | selector: 'dt-root',
17 | templateUrl: './app.component.html',
18 | styleUrls: ['./app.component.scss']
19 | })
20 | export class AppComponent {
21 | readonly themeProps = [
22 | 'color-main',
23 | 'color-main-darken',
24 | 'color-main-darken2',
25 | 'color-main-lighten',
26 | 'color-accent',
27 | ];
28 |
29 | readonly themes: DinoThemes = {
30 | 'classic': {
31 | 'color-main': '#3D9D46',
32 | 'color-main-darken': '#338942',
33 | 'color-main-darken2': '#286736',
34 | 'color-main-lighten': '#7BBC4D',
35 | 'color-accent': '#DC3C2A',
36 | },
37 | 'marine': {
38 | 'color-main': '#208FBC',
39 | 'color-main-darken': '#377681',
40 | 'color-main-darken2': '#27555F',
41 | 'color-main-lighten': '#64BFB6',
42 | 'color-accent': '#DC3C2A',
43 | },
44 | 'pink': {
45 | 'color-main': '#E05389',
46 | 'color-main-darken': '#CA3E86',
47 | 'color-main-darken2': '#C13480',
48 | 'color-main-lighten': '#E77A96',
49 | 'color-accent': '#208FBC',
50 | },
51 | 'wooden': {
52 | 'color-main': 'brown',
53 | 'color-main-darken': '#7c2020',
54 | 'color-main-darken2': '#541515',
55 | 'color-main-lighten': '#d65f5f',
56 | 'color-accent': 'orange',
57 | }
58 | };
59 |
60 | dinos = ['trex', 'brachio', 'stego', 'trice', 'ptero'];
61 |
62 | customTheme = this.themes.classic;
63 |
64 | selectedThemes = {
65 | trex: this.themes.wooden,
66 | brachio: this.themes.marine,
67 | stego: this.themes.classic,
68 | trice: this.themes.pink,
69 | ptero: {},
70 | };
71 |
72 | setTheme(dino: string, themeIndex: string) {
73 | this.selectedThemes[dino] = this.themes[themeIndex];
74 | }
75 |
76 | getCustomTheme() {
77 | return {...this.customTheme};
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppComponent } from './app.component';
5 | import { TrexComponent } from './dinos/trex/trex.component';
6 | import { StegoComponent } from './dinos/stego/stego.component';
7 | import { PteroComponent } from './dinos/ptero/ptero.component';
8 | import { TriceComponent } from './dinos/trice/trice.component';
9 | import { BrachioComponent } from './dinos/brachio/brachio.component';
10 | import { ThemeDirective } from './theme.directive';
11 | import { FormsModule } from '@angular/forms';
12 |
13 | @NgModule({
14 | declarations: [
15 | AppComponent,
16 | TrexComponent,
17 | StegoComponent,
18 | PteroComponent,
19 | TriceComponent,
20 | BrachioComponent,
21 | ThemeDirective
22 | ],
23 | imports: [
24 | BrowserModule,
25 | FormsModule
26 | ],
27 | providers: [],
28 | bootstrap: [AppComponent]
29 | })
30 | export class AppModule { }
31 |
--------------------------------------------------------------------------------
/src/app/dinos/brachio/brachio.component.html:
--------------------------------------------------------------------------------
1 |
2 |
34 |
--------------------------------------------------------------------------------
/src/app/dinos/brachio/brachio.component.scss:
--------------------------------------------------------------------------------
1 | @import "../dinos";
2 |
--------------------------------------------------------------------------------
/src/app/dinos/brachio/brachio.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'dt-brachio',
5 | templateUrl: './brachio.component.html',
6 | styleUrls: ['./brachio.component.scss']
7 | })
8 | export class BrachioComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/dinos/dinos.scss:
--------------------------------------------------------------------------------
1 | :host {
2 | display: inline-block;
3 | }
4 |
5 | * {
6 | transition: all 0.25s;
7 | }
8 |
9 | .main {
10 | fill: var(--color-main, #3D9D46);
11 | }
12 |
13 | .main-darken {
14 | fill: var(--color-main-darken, #338942);
15 | }
16 |
17 | .main-darken2 {
18 | fill: var(--color-main-darken2, #286736);
19 | }
20 |
21 | .main-lighten {
22 | fill: var(--color-main-lighten, #7BBC4D);
23 | }
24 |
25 | .accent {
26 | fill: var(--color-accent, #DC3C2A);
27 | transition: all 1.25s;
28 | }
29 |
--------------------------------------------------------------------------------
/src/app/dinos/ptero/ptero.component.html:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/src/app/dinos/ptero/ptero.component.scss:
--------------------------------------------------------------------------------
1 | @import "../dinos";
2 |
--------------------------------------------------------------------------------
/src/app/dinos/ptero/ptero.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'dt-ptero',
5 | templateUrl: './ptero.component.html',
6 | styleUrls: ['./ptero.component.scss']
7 | })
8 | export class PteroComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/dinos/stego/stego.component.html:
--------------------------------------------------------------------------------
1 |
2 |
50 |
--------------------------------------------------------------------------------
/src/app/dinos/stego/stego.component.scss:
--------------------------------------------------------------------------------
1 | @import "../dinos";
2 |
3 | .accent {
4 | &.a1 {transition-delay: 0.1s;}
5 | &.a2 {transition-delay: 0.2s;}
6 | &.a3 {transition-delay: 0.3s;}
7 | &.a4 {transition-delay: 0.4s;}
8 | &.a5 {transition-delay: 0.5s;}
9 | &.a6 {transition-delay: 0.6s;}
10 | &.a7 {transition-delay: 0.7s;}
11 | &.a8 {transition-delay: 0.8s;}
12 | &.a9 {transition-delay: 0.9s;}
13 | &.a10 {transition-delay: 1.0s;}
14 | }
15 |
--------------------------------------------------------------------------------
/src/app/dinos/stego/stego.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'dt-stego',
5 | templateUrl: './stego.component.html',
6 | styleUrls: ['./stego.component.scss']
7 | })
8 | export class StegoComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/dinos/trex/trex.component.html:
--------------------------------------------------------------------------------
1 |
37 |
--------------------------------------------------------------------------------
/src/app/dinos/trex/trex.component.scss:
--------------------------------------------------------------------------------
1 | @import "../dinos";
2 |
--------------------------------------------------------------------------------
/src/app/dinos/trex/trex.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, ViewEncapsulation } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'dt-trex',
5 | templateUrl: './trex.component.html',
6 | styleUrls: ['./trex.component.scss'],
7 | encapsulation: ViewEncapsulation.ShadowDom
8 | })
9 | export class TrexComponent implements OnInit {
10 |
11 | constructor() { }
12 |
13 | ngOnInit() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/app/dinos/trice/trice.component.html:
--------------------------------------------------------------------------------
1 |
2 |
54 |
--------------------------------------------------------------------------------
/src/app/dinos/trice/trice.component.scss:
--------------------------------------------------------------------------------
1 | @import "../dinos";
2 |
--------------------------------------------------------------------------------
/src/app/dinos/trice/trice.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'dt-trice',
5 | templateUrl: './trice.component.html',
6 | styleUrls: ['./trice.component.scss']
7 | })
8 | export class TriceComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/theme.directive.ts:
--------------------------------------------------------------------------------
1 | import { Directive, ElementRef, Input, OnChanges } from '@angular/core';
2 |
3 | @Directive({
4 | selector: '[dtTheme]'
5 | })
6 | export class ThemeDirective implements OnChanges {
7 | @Input('dtTheme') theme: {[prop: string]: string};
8 |
9 | constructor(private el: ElementRef) {
10 | }
11 |
12 | ngOnChanges() {
13 | Object.keys(this.theme).forEach(prop => {
14 | this.el.nativeElement.style.setProperty(`--${prop}`, this.theme[prop]);
15 | });
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sulco/dino-themes/d64d57e1cd3ea0091ab6dba9943ec971d6cedbe0/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/browserslist:
--------------------------------------------------------------------------------
1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 | #
5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
6 |
7 | > 0.5%
8 | last 2 versions
9 | Firefox ESR
10 | not dead
11 | not IE 9-11
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sulco/dino-themes/d64d57e1cd3ea0091ab6dba9943ec971d6cedbe0/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | DinoThemes
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/karma.conf.js:
--------------------------------------------------------------------------------
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-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false
30 | });
31 | };
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /**
38 | * If the application will be indexed by Google Search, the following is required.
39 | * Googlebot uses a renderer based on Chrome 41.
40 | * https://developers.google.com/search/docs/guides/rendering
41 | **/
42 | // import 'core-js/es6/array';
43 |
44 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
45 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
46 |
47 | /** IE10 and IE11 requires the following for the Reflect API. */
48 | // import 'core-js/es6/reflect';
49 |
50 | /**
51 | * Web Animations `@angular/platform-browser/animations`
52 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
53 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
54 | **/
55 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
56 |
57 | /**
58 | * By default, zone.js will patch all possible macroTask and DomEvents
59 | * user can disable parts of macroTask/DomEvents patch by setting following flags
60 | */
61 |
62 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
63 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
64 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
65 |
66 | /*
67 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
68 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
69 | */
70 | // (window as any).__Zone_enable_cross_context_check = true;
71 |
72 | /***************************************************************************************************
73 | * Zone JS is required by default for Angular itself.
74 | */
75 | import 'zone.js/dist/zone'; // Included with Angular CLI.
76 |
77 |
78 | /***************************************************************************************************
79 | * APPLICATION IMPORTS
80 | */
81 |
--------------------------------------------------------------------------------
/src/styles.scss:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "types": []
6 | },
7 | "exclude": [
8 | "test.ts",
9 | "**/*.spec.ts"
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "test.ts",
12 | "polyfills.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "dt",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "dt",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "module": "es2015",
9 | "moduleResolution": "node",
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "target": "es5",
13 | "typeRoots": [
14 | "node_modules/@types"
15 | ],
16 | "lib": [
17 | "es2018",
18 | "dom"
19 | ]
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "arrow-return-shorthand": true,
7 | "callable-types": true,
8 | "class-name": true,
9 | "comment-format": [
10 | true,
11 | "check-space"
12 | ],
13 | "curly": true,
14 | "deprecation": {
15 | "severity": "warn"
16 | },
17 | "eofline": true,
18 | "forin": true,
19 | "import-blacklist": [
20 | true,
21 | "rxjs/Rx"
22 | ],
23 | "import-spacing": true,
24 | "indent": [
25 | true,
26 | "spaces"
27 | ],
28 | "interface-over-type-literal": true,
29 | "label-position": true,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-arg": true,
47 | "no-bitwise": true,
48 | "no-console": [
49 | true,
50 | "debug",
51 | "info",
52 | "time",
53 | "timeEnd",
54 | "trace"
55 | ],
56 | "no-construct": true,
57 | "no-debugger": true,
58 | "no-duplicate-super": true,
59 | "no-empty": false,
60 | "no-empty-interface": true,
61 | "no-eval": true,
62 | "no-inferrable-types": [
63 | true,
64 | "ignore-params"
65 | ],
66 | "no-misused-new": true,
67 | "no-non-null-assertion": true,
68 | "no-redundant-jsdoc": true,
69 | "no-shadowed-variable": true,
70 | "no-string-literal": false,
71 | "no-string-throw": true,
72 | "no-switch-case-fall-through": true,
73 | "no-trailing-whitespace": true,
74 | "no-unnecessary-initializer": true,
75 | "no-unused-expression": true,
76 | "no-use-before-declare": true,
77 | "no-var-keyword": true,
78 | "object-literal-sort-keys": false,
79 | "one-line": [
80 | true,
81 | "check-open-brace",
82 | "check-catch",
83 | "check-else",
84 | "check-whitespace"
85 | ],
86 | "prefer-const": true,
87 | "quotemark": [
88 | true,
89 | "single"
90 | ],
91 | "radix": true,
92 | "semicolon": [
93 | true,
94 | "always"
95 | ],
96 | "triple-equals": [
97 | true,
98 | "allow-null-check"
99 | ],
100 | "typedef-whitespace": [
101 | true,
102 | {
103 | "call-signature": "nospace",
104 | "index-signature": "nospace",
105 | "parameter": "nospace",
106 | "property-declaration": "nospace",
107 | "variable-declaration": "nospace"
108 | }
109 | ],
110 | "unified-signatures": true,
111 | "variable-name": false,
112 | "whitespace": [
113 | true,
114 | "check-branch",
115 | "check-decl",
116 | "check-operator",
117 | "check-separator",
118 | "check-type"
119 | ],
120 | "no-output-on-prefix": true,
121 | "use-input-property-decorator": true,
122 | "use-output-property-decorator": true,
123 | "use-host-property-decorator": true,
124 | "no-input-rename": true,
125 | "no-output-rename": true,
126 | "use-life-cycle-interface": true,
127 | "use-pipe-transform-interface": true,
128 | "component-class-suffix": true,
129 | "directive-class-suffix": true
130 | }
131 | }
132 |
--------------------------------------------------------------------------------