@udixio/theme 1.0.0-beta.3 → 1.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.container.d.ts +5 -0
- package/dist/app.module.d.ts +2 -2
- package/dist/app.service.d.ts +9 -3
- package/dist/color/color.interface.d.ts +1 -2
- package/dist/color/color.module.d.ts +2 -2
- package/dist/color/entities/color.entity.d.ts +6 -1
- package/dist/color/entities/index.d.ts +1 -0
- package/dist/color/index.d.ts +5 -0
- package/dist/color/models/default-color.model.d.ts +2 -3
- package/dist/color/models/index.d.ts +1 -0
- package/dist/color/services/color-manager.service.d.ts +18 -0
- package/dist/color/services/color.service.d.ts +21 -0
- package/dist/color/services/index.d.ts +2 -0
- package/dist/config/config.interface.d.ts +13 -0
- package/dist/config/config.module.d.ts +2 -0
- package/dist/config/config.service.d.ts +12 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/index.d.ts +11 -0
- package/dist/main.d.ts +6 -1
- package/dist/material-color-utilities/index.d.ts +1 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/plugin.module.d.ts +2 -0
- package/dist/plugin/plugin.service.d.ts +8 -0
- package/dist/plugin/pluginAbstract.d.ts +18 -0
- package/dist/plugins/font/font.plugin.d.ts +49 -0
- package/dist/plugins/font/index.d.ts +1 -0
- package/dist/plugins/tailwind/index.d.ts +3 -0
- package/dist/plugins/tailwind/main.d.ts +13 -0
- package/dist/plugins/tailwind/plugins-tailwind/font.d.ts +5 -0
- package/dist/plugins/tailwind/plugins-tailwind/index.d.ts +2 -0
- package/dist/plugins/tailwind/plugins-tailwind/state.d.ts +4 -0
- package/dist/plugins/tailwind/plugins-tailwind/themer.d.ts +10 -0
- package/dist/plugins/tailwind/tailwind.plugin.d.ts +18 -0
- package/dist/theme/entities/index.d.ts +2 -0
- package/dist/theme/entities/variant.entity.d.ts +2 -1
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/models/index.d.ts +1 -0
- package/dist/theme/services/index.d.ts +3 -0
- package/dist/theme/services/scheme.service.d.ts +7 -2
- package/dist/theme/services/theme.service.d.ts +16 -7
- package/dist/theme/services/variant.service.d.ts +8 -2
- package/dist/theme/theme.module.d.ts +2 -2
- package/dist/theme.cjs.development.js +1418 -906
- package/dist/theme.cjs.development.js.map +1 -1
- package/dist/theme.cjs.production.min.js +1 -1
- package/dist/theme.cjs.production.min.js.map +1 -1
- package/dist/theme.esm.js +1385 -907
- package/dist/theme.esm.js.map +1 -1
- package/package.json +21 -22
- package/src/app.container.ts +46 -0
- package/src/app.module.ts +5 -8
- package/src/app.service.spec.ts +1 -1
- package/src/app.service.ts +20 -8
- package/src/color/color.interface.ts +1 -3
- package/src/color/color.module.ts +8 -10
- package/src/color/entities/color.entity.ts +13 -1
- package/src/color/entities/index.ts +1 -0
- package/src/color/index.ts +5 -0
- package/src/color/models/default-color.model.ts +205 -202
- package/src/color/models/index.ts +1 -0
- package/src/color/{color-manager.service.ts → services/color-manager.service.ts} +23 -15
- package/src/color/{color.service.spec.ts → services/color.service.spec.ts} +1 -1
- package/src/color/services/color.service.ts +75 -0
- package/src/color/services/index.ts +2 -0
- package/src/config/config.interface.ts +14 -0
- package/src/config/config.module.ts +7 -0
- package/src/config/config.service.ts +104 -0
- package/src/config/index.ts +3 -0
- package/src/index.ts +11 -0
- package/src/main.ts +13 -7
- package/src/material-color-utilities/index.ts +1 -0
- package/src/plugin/index.ts +3 -0
- package/src/plugin/plugin.module.ts +7 -0
- package/src/plugin/plugin.service.ts +42 -0
- package/src/plugin/pluginAbstract.ts +44 -0
- package/src/plugins/font/font.plugin.ts +203 -0
- package/src/plugins/font/index.ts +1 -0
- package/src/plugins/tailwind/index.ts +3 -0
- package/src/plugins/tailwind/main.ts +16 -0
- package/src/plugins/tailwind/plugins-tailwind/font.ts +69 -0
- package/src/plugins/tailwind/plugins-tailwind/index.ts +2 -0
- package/src/plugins/tailwind/plugins-tailwind/state.ts +88 -0
- package/src/plugins/tailwind/plugins-tailwind/themer.ts +137 -0
- package/src/plugins/tailwind/tailwind.plugin.ts +72 -0
- package/src/theme/entities/index.ts +2 -0
- package/src/theme/entities/variant.entity.ts +2 -1
- package/src/theme/index.ts +4 -0
- package/src/theme/models/index.ts +1 -0
- package/src/theme/models/variant.model.ts +7 -0
- package/src/theme/services/index.ts +3 -0
- package/src/theme/services/scheme.service.ts +39 -11
- package/src/theme/services/theme.service.ts +30 -14
- package/src/theme/services/variant.service.ts +40 -5
- package/src/theme/theme.module.ts +8 -9
- package/dist/color/color-manager.service.d.ts +0 -15
- package/dist/color/color.service.d.ts +0 -14
- package/src/color/color.service.ts +0 -58
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udixio/theme",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.31",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "vigreux-joël",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/theme.esm.js",
|
|
9
|
+
"require": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
9
14
|
"files": [
|
|
10
15
|
"dist",
|
|
11
16
|
"src"
|
|
@@ -16,6 +21,7 @@
|
|
|
16
21
|
},
|
|
17
22
|
"scripts": {
|
|
18
23
|
"analyze": "size-limit --why",
|
|
24
|
+
"prebuild": "rm ./src/**/index.ts && rm ./src/index.ts && npx ctix create -f index.ts -a src\n",
|
|
19
25
|
"build": "dts build",
|
|
20
26
|
"lint": "dts lint",
|
|
21
27
|
"prepare": "dts build",
|
|
@@ -34,31 +40,24 @@
|
|
|
34
40
|
},
|
|
35
41
|
"size-limit": [
|
|
36
42
|
{
|
|
37
|
-
"path": "dist/
|
|
43
|
+
"path": "dist/theme.cjs.production.min.js",
|
|
38
44
|
"limit": "10 KB"
|
|
39
45
|
},
|
|
40
46
|
{
|
|
41
|
-
"path": "dist/
|
|
47
|
+
"path": "dist/theme.esm.js",
|
|
42
48
|
"limit": "10 KB"
|
|
43
49
|
}
|
|
44
50
|
],
|
|
45
51
|
"dependencies": {
|
|
46
52
|
"@material/material-color-utilities": "^0.3.0",
|
|
47
|
-
"@nestjs/common": "^10.3.10",
|
|
48
|
-
"@nestjs/core": "^10.3.10",
|
|
49
|
-
"@nestjs/microservices": "^10.3.10",
|
|
50
|
-
"@nestjs/platform-express": "^10.3.10",
|
|
51
|
-
"@nestjs/websockets": "^10.3.10",
|
|
52
53
|
"@rollup/plugin-babel": "^6.0.4",
|
|
53
54
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
54
|
-
"
|
|
55
|
+
"awilix": "^10.0.2",
|
|
55
56
|
"reflect-metadata": "^0.2.2",
|
|
56
|
-
"rxjs": "^7.8.1"
|
|
57
|
+
"rxjs": "^7.8.1",
|
|
58
|
+
"tailwindcss-themer": "^4.0.0"
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
59
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
60
|
-
"@semantic-release/git": "^10.0.1",
|
|
61
|
-
"semantic-release": "^24.0.0",
|
|
62
61
|
"@babel/cli": "^7.24.8",
|
|
63
62
|
"@babel/core": "^7.24.9",
|
|
64
63
|
"@babel/node": "^7.24.8",
|
|
@@ -69,17 +68,16 @@
|
|
|
69
68
|
"@babel/preset-typescript": "^7.24.7",
|
|
70
69
|
"@babel/register": "^7.24.6",
|
|
71
70
|
"@babel/runtime": "^7.24.8",
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
74
|
-
"@nestjs/testing": "^10.3.10",
|
|
71
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
72
|
+
"@semantic-release/git": "^10.0.1",
|
|
75
73
|
"@size-limit/preset-small-lib": "^11.1.4",
|
|
76
74
|
"@tsconfig/recommended": "^1.0.7",
|
|
77
75
|
"@types/express": "^4.17.21",
|
|
78
76
|
"@types/jest": "28.1.8",
|
|
79
|
-
"@types/merge-deep": "^3.0.3",
|
|
80
77
|
"@types/node": "^16.0.0",
|
|
81
78
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
82
79
|
"@typescript-eslint/parser": "^5.0.0",
|
|
80
|
+
"ctix": "^1.8.2",
|
|
83
81
|
"dts-cli": "^2.0.5",
|
|
84
82
|
"eslint": "^8.0.1",
|
|
85
83
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -88,14 +86,15 @@
|
|
|
88
86
|
"i": "^0.3.7",
|
|
89
87
|
"jest": "28.1.3",
|
|
90
88
|
"prettier": "^2.3.2",
|
|
89
|
+
"semantic-release": "^24.0.0",
|
|
91
90
|
"size-limit": "^11.1.4",
|
|
92
91
|
"source-map-support": "^0.5.20",
|
|
93
92
|
"supertest": "^6.1.3",
|
|
93
|
+
"tailwindcss": "^3.4.7",
|
|
94
94
|
"ts-jest": "28.0.8",
|
|
95
95
|
"ts-loader": "^9.2.3",
|
|
96
96
|
"ts-node": "^10.0.0",
|
|
97
97
|
"tsconfig-paths": "4.1.0",
|
|
98
|
-
"tslib": "^2.6.3"
|
|
99
|
-
"typescript": "^4.7.4"
|
|
98
|
+
"tslib": "^2.6.3"
|
|
100
99
|
}
|
|
101
100
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AwilixContainer,
|
|
3
|
+
BuildResolver,
|
|
4
|
+
createContainer,
|
|
5
|
+
DisposableResolver,
|
|
6
|
+
InjectionMode,
|
|
7
|
+
} from 'awilix';
|
|
8
|
+
import { ColorModule } from './color/color.module';
|
|
9
|
+
import { ThemeModule } from './theme/theme.module';
|
|
10
|
+
import { AppModule } from './app.module';
|
|
11
|
+
import { ConfigModule } from './config/config.module';
|
|
12
|
+
import { PluginModule } from './plugin/plugin.module';
|
|
13
|
+
|
|
14
|
+
export type Module = Record<
|
|
15
|
+
string,
|
|
16
|
+
BuildResolver<any> & DisposableResolver<any>
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export function importContainer(
|
|
20
|
+
container: AwilixContainer,
|
|
21
|
+
services: Module[]
|
|
22
|
+
) {
|
|
23
|
+
services.forEach((service) => {
|
|
24
|
+
Object.entries(service).forEach(([name, serviceClass]) => {
|
|
25
|
+
container.register(name, serviceClass);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return container;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const AppContainer = createContainer({
|
|
32
|
+
injectionMode: InjectionMode.PROXY,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
importContainer(AppContainer, [
|
|
36
|
+
ConfigModule,
|
|
37
|
+
AppModule,
|
|
38
|
+
PluginModule,
|
|
39
|
+
ColorModule,
|
|
40
|
+
ThemeModule,
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
// AppContainer.register(ColorModule.cradle);
|
|
44
|
+
// AppContainer.register(ThemeModule.cradle);
|
|
45
|
+
|
|
46
|
+
export default AppContainer;
|
package/src/app.module.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { asClass } from 'awilix';
|
|
2
2
|
import { AppService } from './app.service';
|
|
3
|
-
import {
|
|
4
|
-
import { ThemeModule } from './theme/theme.module';
|
|
3
|
+
import { Module } from './app.container';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
10
|
-
export class AppModule {}
|
|
5
|
+
export const AppModule: Module = {
|
|
6
|
+
appService: asClass(AppService).singleton(),
|
|
7
|
+
};
|
package/src/app.service.spec.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
2
|
import { AppService } from '../src/app.service';
|
|
3
|
-
import { AppModule } from '
|
|
3
|
+
import { AppModule } from './app.container';
|
|
4
4
|
|
|
5
5
|
describe('AppController (e2e)', () => {
|
|
6
6
|
let appService: AppService;
|
package/src/app.service.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ColorService } from './color';
|
|
2
|
+
import { ThemeService } from './theme';
|
|
3
|
+
import { PluginService } from './plugin/plugin.service';
|
|
4
4
|
|
|
5
|
-
@Injectable()
|
|
6
5
|
export class AppService {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
public colorService: ColorService;
|
|
7
|
+
public themeService: ThemeService;
|
|
8
|
+
public pluginService: PluginService;
|
|
9
|
+
|
|
10
|
+
constructor({
|
|
11
|
+
colorService,
|
|
12
|
+
themeService,
|
|
13
|
+
pluginService,
|
|
14
|
+
}: {
|
|
15
|
+
colorService: ColorService;
|
|
16
|
+
themeService: ThemeService;
|
|
17
|
+
pluginService: PluginService;
|
|
18
|
+
}) {
|
|
19
|
+
this.pluginService = pluginService;
|
|
20
|
+
this.colorService = colorService;
|
|
21
|
+
this.themeService = themeService;
|
|
22
|
+
}
|
|
11
23
|
}
|
|
@@ -9,7 +9,5 @@ export interface ColorInterface {
|
|
|
9
9
|
|
|
10
10
|
updateColor(key: string, newColor: ColorOptions): ColorEntity;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
addColors(colors: Record<string, ColorOptions>): ColorEntity[];
|
|
12
|
+
getColors(): ReadonlyMap<string, ColorEntity>;
|
|
15
13
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { ColorService } from './color.service';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ColorService } from './services/color.service';
|
|
2
|
+
import { ColorManagerService } from './services/color-manager.service';
|
|
3
|
+
import { asClass } from 'awilix';
|
|
4
|
+
import { Module } from '../app.container';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})
|
|
11
|
-
export class ColorModule {}
|
|
6
|
+
export const ColorModule: Module = {
|
|
7
|
+
colorManagerService: asClass(ColorManagerService).singleton(),
|
|
8
|
+
colorService: asClass(ColorService).singleton(),
|
|
9
|
+
};
|
|
@@ -3,7 +3,7 @@ import { SchemeEntity } from '../../theme/entities/scheme.entity';
|
|
|
3
3
|
import { DynamicColor } from '../../material-color-utilities/dynamic_color';
|
|
4
4
|
import { ContrastCurve } from '../../material-color-utilities';
|
|
5
5
|
import { SchemeService } from '../../theme/services/scheme.service';
|
|
6
|
-
import { ColorManagerService } from '../color-manager.service';
|
|
6
|
+
import { ColorManagerService } from '../services/color-manager.service';
|
|
7
7
|
|
|
8
8
|
export interface ColorOptions {
|
|
9
9
|
palette: (scheme: SchemeEntity) => TonalPalette;
|
|
@@ -21,6 +21,14 @@ export interface ColorOptions {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function argbToRgb(argb: number): { r: number; g: number; b: number } {
|
|
25
|
+
return {
|
|
26
|
+
r: (argb >> 16) & 0xff,
|
|
27
|
+
g: (argb >> 8) & 0xff,
|
|
28
|
+
b: argb & 0xff,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
export class ColorEntity {
|
|
25
33
|
private dynamicColor: DynamicColor | null = null;
|
|
26
34
|
|
|
@@ -43,6 +51,10 @@ export class ColorEntity {
|
|
|
43
51
|
return this.getDynamicColor().getArgb(this.schemeService.get());
|
|
44
52
|
}
|
|
45
53
|
|
|
54
|
+
getRgb() {
|
|
55
|
+
return argbToRgb(this.getArgb());
|
|
56
|
+
}
|
|
57
|
+
|
|
46
58
|
getName(): string {
|
|
47
59
|
return this.option.name.replace(/([A-Z])/g, '_$1').toLowerCase();
|
|
48
60
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './color.entity';
|