diff --git a/package.json b/package.json index 7fb50514..04ee3ad2 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,20 @@ { "name": "fuse2", - "version": "1.3.1", + "version": "1.3.2", "license": "https://themeforest.net/licenses/terms/regular", "scripts": { "ng": "ng", - "start": "ng serve", + "start": "ng serve --open", "start-hmr": "ng serve --hmr -e=hmr -sm=false", "start-hmr-sourcemaps": "ng serve --hmr -e=hmr", "build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev", + "build-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev --stats-json", "build-prod": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod", + "build-prod-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod --stats-json", "test": "ng test", "lint": "ng lint", - "e2e": "ng e2e" + "e2e": "ng e2e", + "bundle-report": "webpack-bundle-analyzer dist/stats.json" }, "private": true, "dependencies": { @@ -29,28 +32,28 @@ "@angular/platform-browser": "5.1.2", "@angular/platform-browser-dynamic": "5.1.2", "@angular/router": "5.1.2", - "@ngx-translate/core": "9.0.2", - "@swimlane/ngx-charts": "7.0.1", - "@swimlane/ngx-datatable": "11.1.7", - "@swimlane/ngx-dnd": "3.1.0", - "angular-calendar": "0.23.0", - "angular-in-memory-web-api": "0.5.2", - "angular2-markdown": "1.6.0", - "classlist.js": "1.1.20150312", - "core-js": "2.5.3", - "d3": "4.12.0", - "hammerjs": "2.0.8", - "highlight.js": "9.12.0", - "intl": "1.2.5", - "moment": "2.20.1", "@ngrx/effects": "4.1.1", "@ngrx/router-store": "4.1.1", "@ngrx/store": "4.1.1", "@ngrx/store-devtools": "4.1.1", + "@ngx-translate/core": "9.0.2", + "@swimlane/ngx-charts": "7.0.1", + "@swimlane/ngx-datatable": "11.1.7", + "@swimlane/ngx-dnd": "3.1.0", + "@types/prismjs": "1.9.0", + "angular-calendar": "0.23.0", + "angular-in-memory-web-api": "0.5.2", + "classlist.js": "1.1.20150312", + "core-js": "2.5.3", + "d3": "4.12.0", + "hammerjs": "2.0.8", + "intl": "1.2.5", + "moment": "2.20.1", "ngrx-store-freeze": "0.2.0", "ngx-color-picker": "5.3.0", "ngx-cookie-service": "1.0.9", "perfect-scrollbar": "1.3.0", + "prismjs": "1.9.0", "rxjs": "5.5.6", "web-animations-js": "2.3.1", "zone.js": "0.8.18" @@ -75,6 +78,7 @@ "protractor": "5.1.2", "ts-node": "3.2.2", "tslint": "5.7.0", - "typescript": "2.4.2" + "typescript": "2.4.2", + "webpack-bundle-analyzer": "2.9.1" } } diff --git a/src/app/core/components/highlight/highlight.component.scss b/src/app/core/components/highlight/highlight.component.scss new file mode 100644 index 00000000..1844f192 --- /dev/null +++ b/src/app/core/components/highlight/highlight.component.scss @@ -0,0 +1,6 @@ +:host { + display: block; + padding: 8px; + background: #263238; + cursor: text; +} \ No newline at end of file diff --git a/src/app/core/components/highlight/highlight.component.ts b/src/app/core/components/highlight/highlight.component.ts new file mode 100644 index 00000000..e58be26d --- /dev/null +++ b/src/app/core/components/highlight/highlight.component.ts @@ -0,0 +1,102 @@ +import { Component, ContentChild, ElementRef, Input, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +import * as Prism from 'prismjs/prism'; +import './prism-languages'; + +@Component({ + selector : 'fuse-highlight', + template : ' ', + styleUrls: ['./highlight.component.scss'] +}) +export class FuseHighlightComponent implements OnInit +{ + @ContentChild('source') source: ElementRef; + @Input('lang') lang: string; + @Input('path') path: string; + + constructor( + private elementRef: ElementRef, + private http: HttpClient + ) + { + } + + ngOnInit() + { + // If there is no language defined, return... + if ( !this.lang ) + { + return; + } + + // If the path is defined... + if ( this.path ) + { + // Get the source + this.http.get(this.path, {responseType: 'text'}).subscribe((response) => { + + // Highlight it + this.highlight(response); + }); + } + + // If the path is not defined and the source element exists... + if ( !this.path && this.source ) + { + // Highlight it + this.highlight(this.source.nativeElement.value); + } + } + + highlight(sourceCode) + { + // Split the source into lines + const sourceLines = sourceCode.split('\n'); + + // Remove the first and the last line of the source + // code if they are blank lines. This way, the html + // can be formatted properly while using fuse-highlight + // component + if ( !sourceLines[0].trim() ) + { + sourceLines.shift(); + } + + if ( !sourceLines[sourceLines.length - 1].trim() ) + { + sourceLines.pop(); + } + + // Find the first non-whitespace char index in + // the first line of the source code + const indexOfFirstChar = sourceLines[0].search(/\S|$/); + + // Generate the trimmed source + let source = ''; + + // Iterate through all the lines + sourceLines.forEach((line, index) => { + + // Trim the beginning white space depending on the index + // and concat the source code + source = source + line.substr(indexOfFirstChar, line.length); + + // If it's not the last line... + if ( index !== sourceLines.length - 1 ) + { + // Add a line break at the end + source = source + '\n'; + } + }); + + // Generate the highlighted code + const highlightedCode = Prism.highlight(source, Prism.languages[this.lang]); + + // Replace the innerHTML of the component with the highlighted code + this.elementRef.nativeElement.innerHTML = + '
' + highlightedCode + '
';
+
+ }
+}
+
diff --git a/src/app/core/components/highlight/prism-languages.ts b/src/app/core/components/highlight/prism-languages.ts
new file mode 100644
index 00000000..14842a35
--- /dev/null
+++ b/src/app/core/components/highlight/prism-languages.ts
@@ -0,0 +1,16 @@
+import 'prismjs/prism';
+import 'prismjs/components/prism-c';
+import 'prismjs/components/prism-cpp';
+import 'prismjs/components/prism-csharp';
+import 'prismjs/components/prism-css';
+import 'prismjs/components/prism-diff';
+import 'prismjs/components/prism-markup';
+import 'prismjs/components/prism-java';
+import 'prismjs/components/prism-javascript';
+import 'prismjs/components/prism-json';
+import 'prismjs/components/prism-perl';
+import 'prismjs/components/prism-php';
+import 'prismjs/components/prism-python';
+import 'prismjs/components/prism-sass';
+import 'prismjs/components/prism-scss';
+import 'prismjs/components/prism-typescript';
diff --git a/src/app/core/components/hljs/hljs.component.scss b/src/app/core/components/hljs/hljs.component.scss
deleted file mode 100644
index 8fdbe2d4..00000000
--- a/src/app/core/components/hljs/hljs.component.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-:host {
-
-}
\ No newline at end of file
diff --git a/src/app/core/components/hljs/hljs.component.ts b/src/app/core/components/hljs/hljs.component.ts
deleted file mode 100644
index 3bf9c1fc..00000000
--- a/src/app/core/components/hljs/hljs.component.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { Component, ContentChild, ElementRef, Input, OnInit } from '@angular/core';
-import * as hljs from 'highlight.js';
-
-@Component({
- selector : 'fuse-hljs',
- template : ' ',
- styleUrls: ['./hljs.component.scss']
-})
-export class FuseHljsComponent implements OnInit
-{
- hljs: any;
-
- @ContentChild('source') source: ElementRef;
- @Input('lang') lang: string;
-
- constructor(
- private elementRef: ElementRef
- )
- {
- this.hljs = hljs;
- }
-
- ngOnInit()
- {
- const originalSource = this.source.nativeElement.value;
-
- if ( !originalSource || !this.lang )
- {
- return;
- }
-
- // Split the source into lines
- const sourceLines = originalSource.split('\n');
-
- // Find the first non-whitespace char index in
- // the first line of the source code
- const indexOfFirstChar = sourceLines[0].search(/\S|$/);
-
- // Generate the trimmed source
- let source = '';
-
- // Iterate through all the lines and trim the
- // beginning white space depending on the index
- sourceLines.forEach((line, index) => {
-
- source = source + line.substr(indexOfFirstChar, line.length);
-
- if ( index !== sourceLines.length - 1 )
- {
- source = source + '\n';
- }
- });
-
- this.elementRef.nativeElement.innerHTML =
- `` + this.hljs.highlight(this.lang, source).value + `
`;
- }
-}
-
diff --git a/src/app/core/modules/shared.module.ts b/src/app/core/modules/shared.module.ts
index b552656c..f0ab802f 100644
--- a/src/app/core/modules/shared.module.ts
+++ b/src/app/core/modules/shared.module.ts
@@ -15,7 +15,7 @@ import { FuseConfirmDialogComponent } from '../components/confirm-dialog/confirm
import { FuseCountdownComponent } from '../components/countdown/countdown.component';
import { FuseMatchMedia } from '../services/match-media.service';
import { FuseNavbarVerticalService } from '../../main/navbar/vertical/navbar-vertical.service';
-import { FuseHljsComponent } from '../components/hljs/hljs.component';
+import { FuseHighlightComponent } from '../components/highlight/highlight.component';
import { FusePerfectScrollbarDirective } from '../directives/fuse-perfect-scrollbar/fuse-perfect-scrollbar.directive';
import { FuseIfOnDomDirective } from '../directives/fuse-if-on-dom/fuse-if-on-dom.directive';
import { FuseMaterialColorPickerComponent } from '../components/material-color-picker/material-color-picker.component';
@@ -29,7 +29,7 @@ import { TranslateModule } from '@ngx-translate/core';
FuseMatSidenavTogglerDirective,
FuseConfirmDialogComponent,
FuseCountdownComponent,
- FuseHljsComponent,
+ FuseHighlightComponent,
FuseIfOnDomDirective,
FusePerfectScrollbarDirective,
FuseMaterialColorPickerComponent
@@ -54,7 +54,7 @@ import { TranslateModule } from '@ngx-translate/core';
FuseMatSidenavTogglerDirective,
FusePipesModule,
FuseCountdownComponent,
- FuseHljsComponent,
+ FuseHighlightComponent,
FusePerfectScrollbarDirective,
ReactiveFormsModule,
ColorPickerModule,
diff --git a/src/app/core/scss/partials/_angular-material-fix.scss b/src/app/core/scss/partials/_angular-material-fix.scss
index 5358bd1f..3214df95 100644
--- a/src/app/core/scss/partials/_angular-material-fix.scss
+++ b/src/app/core/scss/partials/_angular-material-fix.scss
@@ -20,8 +20,8 @@
}
.mat-pseudo-checkbox-checked:after {
- width: 14px;
- height: 7px;
+ width: 14px !important;
+ height: 7px !important;
}
// Fix: "Input underlines has wrong color opacity value"
diff --git a/src/app/core/scss/partials/_cards.scss b/src/app/core/scss/partials/_cards.scss
index 9b38e690..a7be8cc2 100644
--- a/src/app/core/scss/partials/_cards.scss
+++ b/src/app/core/scss/partials/_cards.scss
@@ -9,145 +9,47 @@
min-width: 0;
}
- .card-rich-media {
- position: relative;
+ // Buttons
+ .mat-button {
+ min-width: 0 !important;
+ padding: 0 8px !important;
+ }
- .card-title {
- position: absolute;
- right: 16px;
- bottom: 16px;
- left: 16px;
- font-size: 20px;
- color: white;
- }
- }
-
- .card-media-header {
- display: flex;
- padding: 16px;
- align-items: center;
-
- &.medium {
- align-items: flex-start;
-
- .card-rich-media {
- width: 120px;
- height: 120px;
- }
- }
-
- &.large {
- align-items: flex-start;
-
- .card-rich-media {
- width: 160px;
- height: 160px;
- }
- }
-
- .card-primary-title {
- padding: 0 16px 0 0;
- flex: 1;
- }
-
- .card-rich-media {
- width: 80px;
- height: 80px;
- }
-
- + div {
- padding-top: 0;
- }
- }
-
- .card-avatar-header {
- display: flex;
- padding: 16px;
- align-items: center;
-
- .card-avatar {
- width: 40px;
- height: 40px;
- border-radius: 100%;
- margin-right: 16px;
- }
-
- .card-avatar-title {
-
- .card-title {
- font-size: 14px;
- font-weight: bold;
- }
-
- .card-subtitle {
- font-size: 13px;
- font-weight: bold;
- }
- }
- }
-
- .card-primary-title {
- padding: 16px;
-
- .card-title {
- font-size: 24px;
- }
-
- .card-subtitle {
- font-size: 14px;
- }
-
- + div {
- padding-top: 0;
- }
- }
-
- .card-supporting-text {
- padding: 16px;
- font-size: 14px;
- line-height: 1.75;
-
- + div {
- padding-top: 0;
- }
- }
-
- .card-actions {
- display: flex;
- padding: 8px;
-
- &.icon-buttons {
- padding: 0 8px;
- }
-
- &.align-center {
- justify-content: center;
- }
-
- &.align-right {
- justify-content: flex-end;
- }
-
- .mat-button {
- min-width: 0 !important;
- padding: 0 8px !important;
- }
-
- .card-expander {
- margin-left: auto;
- }
-
- + div {
- padding-top: 0;
+ // Button Toggle Group
+ .mat-button-toggle-group,
+ .mat-button-toggle-standalone {
+ box-shadow: none !important;
+ }
+
+ // Tabs
+ .mat-tab-labels {
+ justify-content: center;
+ }
+
+ .mat-tab-label {
+ min-width: 0 !important;
+ }
+
+ // Divider
+ .card-divider {
+ border-top: 1px solid rgba(0, 0, 0, 0.12);
+ margin: 16px;
+
+ &.light {
+ border-top-color: rgba(255, 255, 255, 0.12);
+ }
+
+ &.full-width {
+ margin: 0;
}
}
+ // Expand Area
.card-expand-area {
overflow: hidden;
- .card-expanded-supporting-text {
+ .card-expanded-content {
padding: 8px 16px 16px 16px;
- font-size: 14px;
line-height: 1.75;
}
}
diff --git a/src/app/core/scss/partials/_helpers.scss b/src/app/core/scss/partials/_helpers.scss
index 6d261285..d4cea445 100644
--- a/src/app/core/scss/partials/_helpers.scss
+++ b/src/app/core/scss/partials/_helpers.scss
@@ -1,9 +1,59 @@
+// ######################
+// POSITION HELPERS
+// ######################
+@each $breakpoint in map-keys($grid-breakpoints) {
+
+ @include media-breakpoint-up($breakpoint) {
+
+ $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
+
+ .position#{$infix}-relative {
+ position: relative;
+ }
+
+ .position#{$infix}-absolute {
+ position: absolute;
+ }
+
+ .position#{$infix}-static {
+ position: static;
+ }
+ }
+}
+
+// ####################################
+// ABSOLUTE POSITION ALIGNMENT HELPERS
+// ####################################
+@each $breakpoint in map-keys($grid-breakpoints) {
+
+ @include media-breakpoint-up($breakpoint) {
+
+ $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
+
+ .align#{$infix}-top {
+ top: 0;
+ }
+
+ .align#{$infix}-right {
+ right: 0;
+ }
+
+ .align#{$infix}-bottom {
+ bottom: 0;
+ }
+
+ .align#{$infix}-left {
+ left: 0;
+ }
+ }
+}
+
// ######################
// SIZE HELPERS
// ######################
@each $prop, $abbrev in (height: h, width: w) {
- @for $index from 0 through 128 {
+ @for $index from 0 through 180 {
$size: $index * 4;
$length: #{$size}px;
@@ -28,7 +78,6 @@
// ######################
// SPACING HELPERS
// ######################
-
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
@@ -83,47 +132,45 @@
}
@if ($abbrev == m) {
- @for $index from 0 through 64 {
- $size: $index * 4;
- $length: #{$size}px;
- // Some special margin utils for flex alignments
- .m#{$infix}-auto {
- margin: auto !important;
- }
+ // Some special margin utils for flex alignments
+ .m#{$infix}-auto {
+ margin: auto !important;
+ }
- .mt#{$infix}-auto {
- margin-top: auto !important;
- }
+ .mt#{$infix}-auto {
+ margin-top: auto !important;
+ }
- .mr#{$infix}-auto {
- margin-right: auto !important;
- }
+ .mr#{$infix}-auto {
+ margin-right: auto !important;
+ }
- .mb#{$infix}-auto {
- margin-bottom: auto !important;
- }
+ .mb#{$infix}-auto {
+ margin-bottom: auto !important;
+ }
- .ml#{$infix}-auto {
- margin-left: auto !important;
- }
+ .ml#{$infix}-auto {
+ margin-left: auto !important;
+ }
- .mx#{$infix}-auto {
- margin-right: auto !important;
- margin-left: auto !important;
- }
+ .mx#{$infix}-auto {
+ margin-right: auto !important;
+ margin-left: auto !important;
+ }
- .my#{$infix}-auto {
- margin-top: auto !important;
- margin-bottom: auto !important;
- }
+ .my#{$infix}-auto {
+ margin-top: auto !important;
+ margin-bottom: auto !important;
}
}
}
}
}
-// Border helpers
+// ######################
+// BORDER HELPERS
+// ######################
$border-style: 1px solid rgba(0, 0, 0, 0.12);
.border,
@@ -162,3 +209,10 @@ $border-style: 1px solid rgba(0, 0, 0, 0.12);
border-top: $border-style;
border-bottom: $border-style;
}
+
+// ######################
+// BORDER RADIUS HELPERS
+// ######################
+.border-radius-100 {
+ border-radius: 100%;
+}
\ No newline at end of file
diff --git a/src/app/core/scss/partials/_material.scss b/src/app/core/scss/partials/_material.scss
index fb6c488e..75c1b02c 100644
--- a/src/app/core/scss/partials/_material.scss
+++ b/src/app/core/scss/partials/_material.scss
@@ -411,7 +411,6 @@ table {
color: rgba(0, 0, 0, 0.54);
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
white-space: nowrap;
- min-width: 120px;
&:first-child {
padding-left: 24px;
diff --git a/src/app/core/scss/partials/_typography.scss b/src/app/core/scss/partials/_typography.scss
index 0d81ce8a..2e779328 100644
--- a/src/app/core/scss/partials/_typography.scss
+++ b/src/app/core/scss/partials/_typography.scss
@@ -229,6 +229,22 @@ strong {
}
}
+.line-height-1 {
+ line-height: 1;
+}
+
+.line-height-1\.25 {
+ line-height: 1.25;
+}
+
+.line-height-1\.50 {
+ line-height: 1.5;
+}
+
+.line-height-1\.75 {
+ line-height: 1.75;
+}
+
// Boxed text
.text-boxed {
border-radius: 2px;
diff --git a/src/app/core/scss/partials/plugins/_highlight.scss b/src/app/core/scss/partials/plugins/_highlight.scss
deleted file mode 100644
index 10755cf0..00000000
--- a/src/app/core/scss/partials/plugins/_highlight.scss
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-
-github.com style (c) Vasily Polovnyov