Skip to content

Commit e16e795

Browse files
authored
Merge pull request #8 from fullstack-devops/bugfix/scss-location
change scss location
2 parents 196983a + 89d1b55 commit e16e795

File tree

6 files changed

+77
-59
lines changed

6 files changed

+77
-59
lines changed

projects/lib-workspace/src/styles.scss

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
@use '@angular/material' as mat;
2-
3-
mat.$theme-ignore-duplication-warnings: true;
1+
@use "@angular/material" as mat;
2+
@use "../../ng-mat-components" as fs-components;
43

54
body {
65
margin: 0;
@@ -16,7 +15,7 @@ body {
1615
}
1716

1817
@include mat.core();
19-
@import "../../ng-mat-components/src/fs-mat-components-theme.scss";
18+
@import "../../ng-mat-components";
2019

2120
// Define a light theme
2221
$light-primary: mat.define-palette(mat.$indigo-palette);
@@ -44,13 +43,13 @@ $dark-theme: mat.define-dark-theme(
4443

4544
// Apply the dark theme by default
4645
@include mat.all-component-themes($dark-theme);
47-
@include fs-mat-components-theme($dark-theme);
46+
@include fs-components.all-component-themes($dark-theme);
4847

4948
// Apply the light theme only when the `.my-light-theme` CSS class is applied
5049
// to an ancestor element of the components (such as `body`).
5150
.my-light-theme {
52-
@include mat.all-component-themes($light-theme);
53-
@include fs-mat-components-theme($light-theme);
51+
@include mat.all-component-colors($light-theme);
52+
@include fs-components.all-component-themes($light-theme);
5453
}
5554

5655
.mat-form-field:not(.mat-form-field-has-label) .mat-form-field-infix {
@@ -66,4 +65,3 @@ $dark-theme: mat.define-dark-theme(
6665
.mat-form-field-label-wrapper {
6766
padding-top: 0px;
6867
}
69-
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@use "sass:color";
2+
@use "sass:map";
3+
4+
@use './theming';
5+
6+
@forward "./_theming.scss" show all-component-themes;
7+
8+
@mixin all-component-themes($theme-or-color-config) {
9+
@include theming.theme($theme-or-color-config);
10+
}

projects/ng-mat-components/src/fs-mat-components-theme.scss renamed to projects/ng-mat-components/_theming.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@import "~@angular/material/theming";
33

44
// Define a mixin that accepts a theme and outputs the color styles for the component.
5-
@mixin fs-mat-components-theme($theme) {
5+
@mixin theme($theme) {
66
// Extract whichever individual palettes you need from the theme.
77
$primary: map-get($theme, primary);
88
$accent: map-get($theme, accent);

projects/ng-mat-components/ng-package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"entryFile": "src/public-api.ts"
66
},
77
"assets": [
8-
"./src/fs-mat-components-theme.scss"
8+
"./_index.scss",
9+
"./_theming.scss"
910
]
1011
}

projects/ng-mat-components/package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@angular/common": "^13.0.0",
77
"@angular/core": "^13.0.0",
88
"moment": "^2.29.0",
9-
"@angular/material": ">=13.0.0"
9+
"@angular/material": "^13.0.0"
1010
},
1111
"dependencies": {
1212
"tslib": "^2.3.0"
@@ -24,5 +24,16 @@
2424
},
2525
"bugs": {
2626
"url": "https://github.com/fullstack-devops/ng-mat-components/issues"
27+
},
28+
"exports": {
29+
".": {
30+
"sass": "./_index.scss"
31+
},
32+
"./theming": {
33+
"sass": "./_theming.scss"
34+
},
35+
"./_theming": {
36+
"sass": "./_theming.scss"
37+
}
2738
}
2839
}
Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Data, Route } from "@angular/router";
1+
import { Data, Route } from '@angular/router';
22

33
/**
44
* @interface NavItem
@@ -8,14 +8,14 @@ import { Data, Route } from "@angular/router";
88
* @logo {string} link to logo, can be relative or full URL
99
*/
1010
export interface FrameConfig {
11-
appName: string
12-
appNameShort?: StringOfLength<0, 6>
13-
logo: string
11+
appName: string;
12+
appNameShort?: StringOfLength<0, 6>;
13+
logo: string;
1414
}
1515

1616
export enum FrameEvents {
17-
MANAGE_ACCOUNT = 'EVENT_MANAGE_ACCOUNT',
18-
LOGOUT = 'EVENT_LOGOUT'
17+
MANAGE_ACCOUNT = 'EVENT_MANAGE_ACCOUNT',
18+
LOGOUT = 'EVENT_LOGOUT',
1919
}
2020

2121
/**
@@ -25,8 +25,8 @@ export enum FrameEvents {
2525
* @data {string} data which get send with event
2626
*/
2727
export interface FrameEvent {
28-
type: string;
29-
data: any;
28+
type: FrameEvents;
29+
data: any;
3030
}
3131

3232
/**
@@ -37,65 +37,63 @@ export interface FrameEvent {
3737
* @profilePicture {string} profile Picture (can be empty)
3838
*/
3939
export interface NavUser {
40-
name: string
41-
role: string
42-
profilePicture: string
40+
name: string;
41+
role: string;
42+
profilePicture: string;
4343
}
4444

4545
interface FrameRouteData extends Data {
46-
/**
47-
* sould this route be visable in sidenav
48-
*/
49-
displaySidemenu: boolean;
50-
/**
51-
* displayed text, shows only in opened mode
52-
*/
53-
sidenavText: string;
54-
/**
55-
* displayed icon, use **only** material-icons!
56-
*/
57-
sidenavIcon: string;
58-
/**
59-
* ...
60-
*/
61-
roles?: string[];
62-
/**
63-
* App title dynamic
64-
*/
65-
title?: string;
46+
/**
47+
* sould this route be visable in sidenav
48+
*/
49+
displaySidemenu: boolean;
50+
/**
51+
* displayed text, shows only in opened mode
52+
*/
53+
sidenavText: string;
54+
/**
55+
* displayed icon, use **only** material-icons!
56+
*/
57+
sidenavIcon: string;
58+
/**
59+
* ...
60+
*/
61+
roles?: string[];
62+
/**
63+
* App title dynamic
64+
*/
65+
title?: string;
6666
}
6767
interface FrameRoute extends Route {
68-
data?: FrameRouteData;
68+
data?: FrameRouteData;
6969
}
7070
export type FrameRoutes = FrameRoute[];
7171

72-
73-
7472
type StringOfLength<Min, Max> = string & {
75-
readonly StringOfLength: unique symbol // this is the phantom type
73+
readonly StringOfLength: unique symbol; // this is the phantom type
7674
};
7775

7876
// This is a type guard function which can be used to assert that a string
7977
// is of type StringOfLength<Min,Max>
8078
const isStringOfLength = <Min extends number, Max extends number>(
81-
str: string,
82-
min: Min,
83-
max: Max
79+
str: string,
80+
min: Min,
81+
max: Max
8482
): str is StringOfLength<Min, Max> => str.length >= min && str.length <= max;
8583

8684
// type constructor function
8785
export const stringOfLength = <Min extends number, Max extends number>(
88-
input: unknown,
89-
min: Min,
90-
max: Max
86+
input: unknown,
87+
min: Min,
88+
max: Max
9189
): StringOfLength<Min, Max> => {
92-
if (typeof input !== "string") {
93-
throw new Error("invalid input");
94-
}
90+
if (typeof input !== 'string') {
91+
throw new Error('invalid input');
92+
}
9593

96-
if (!isStringOfLength(input, min, max)) {
97-
throw new Error("input is not between specified min and max");
98-
}
94+
if (!isStringOfLength(input, min, max)) {
95+
throw new Error('input is not between specified min and max');
96+
}
9997

100-
return input; // the type of input here is now StringOfLength<Min,Max>
98+
return input; // the type of input here is now StringOfLength<Min,Max>
10199
};

0 commit comments

Comments
 (0)