diff options
-rw-r--r-- | package-lock.json | 79 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | packages/theme/package.json | 4 | ||||
-rw-r--r-- | packages/theme/src/themes/IStyleTypes.ts | 2 | ||||
-rw-r--r-- | packages/theme/src/themes/default/index.ts | 2 | ||||
-rw-r--r-- | packages/theme/test/index.test.js | 17 | ||||
-rw-r--r-- | packages/theme/test/index.test.ts | 19 | ||||
-rw-r--r-- | packages/theme/tsconfig.json | 1 |
8 files changed, 101 insertions, 27 deletions
diff --git a/package-lock.json b/package-lock.json index f7cf39f7b..90aaac84a 100644 --- a/package-lock.json +++ b/package-lock.json | |||
@@ -5646,17 +5646,32 @@ | |||
5646 | "@meetfranz/theme": { | 5646 | "@meetfranz/theme": { |
5647 | "version": "file:packages/theme", | 5647 | "version": "file:packages/theme", |
5648 | "requires": { | 5648 | "requires": { |
5649 | "color": "3.1.2" | 5649 | "color": "4.0.1" |
5650 | }, | 5650 | }, |
5651 | "dependencies": { | 5651 | "dependencies": { |
5652 | "color": { | 5652 | "color": { |
5653 | "version": "3.1.2", | 5653 | "version": "4.0.1", |
5654 | "resolved": "https://registry.npmjs.org/color/-/color-3.1.2.tgz", | 5654 | "resolved": "https://registry.npmjs.org/color/-/color-4.0.1.tgz", |
5655 | "integrity": "sha512-vXTJhHebByxZn3lDvDJYw4lR5+uB3vuoHsuYA5AKuxRVn5wzzIfQKGLBmgdVRHKTJYeK5rvJcHnrd0Li49CFpg==", | 5655 | "integrity": "sha512-rpZjOKN5O7naJxkH2Rx1sZzzBgaiWECc6BYXjeCE6kF0kcASJYbUq02u7JqIHwCb/j3NhV+QhRL2683aICeGZA==", |
5656 | "requires": { | 5656 | "requires": { |
5657 | "color-convert": "^1.9.1", | 5657 | "color-convert": "^2.0.1", |
5658 | "color-string": "^1.5.2" | 5658 | "color-string": "^1.6.0" |
5659 | }, | ||
5660 | "dependencies": { | ||
5661 | "color-convert": { | ||
5662 | "version": "2.0.1", | ||
5663 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", | ||
5664 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", | ||
5665 | "requires": { | ||
5666 | "color-name": "~1.1.4" | ||
5667 | } | ||
5668 | } | ||
5659 | } | 5669 | } |
5670 | }, | ||
5671 | "color-name": { | ||
5672 | "version": "1.1.4", | ||
5673 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", | ||
5674 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" | ||
5660 | } | 5675 | } |
5661 | } | 5676 | } |
5662 | }, | 5677 | }, |
@@ -6457,6 +6472,12 @@ | |||
6457 | "integrity": "sha512-vwNP+pzkI1ipznek2fCA4xj1kQyL9EJcfdBezD9eToe9eP2IgT3WLEBrVqiXal34LOyiAs8xCQKwugEYOKcMkw==", | 6472 | "integrity": "sha512-vwNP+pzkI1ipznek2fCA4xj1kQyL9EJcfdBezD9eToe9eP2IgT3WLEBrVqiXal34LOyiAs8xCQKwugEYOKcMkw==", |
6458 | "dev": true | 6473 | "dev": true |
6459 | }, | 6474 | }, |
6475 | "@types/expect.js": { | ||
6476 | "version": "0.3.29", | ||
6477 | "resolved": "https://registry.npmjs.org/@types/expect.js/-/expect.js-0.3.29.tgz", | ||
6478 | "integrity": "sha1-KN01kVW4S47LCUr8P0t0wyItyjs=", | ||
6479 | "dev": true | ||
6480 | }, | ||
6460 | "@types/fs-extra": { | 6481 | "@types/fs-extra": { |
6461 | "version": "9.0.12", | 6482 | "version": "9.0.12", |
6462 | "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.12.tgz", | 6483 | "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.12.tgz", |
@@ -6554,6 +6575,12 @@ | |||
6554 | "@types/node": "*" | 6575 | "@types/node": "*" |
6555 | } | 6576 | } |
6556 | }, | 6577 | }, |
6578 | "@types/mocha": { | ||
6579 | "version": "9.0.0", | ||
6580 | "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", | ||
6581 | "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", | ||
6582 | "dev": true | ||
6583 | }, | ||
6557 | "@types/ms": { | 6584 | "@types/ms": { |
6558 | "version": "0.7.31", | 6585 | "version": "0.7.31", |
6559 | "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", | 6586 | "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", |
@@ -27964,6 +27991,40 @@ | |||
27964 | } | 27991 | } |
27965 | } | 27992 | } |
27966 | }, | 27993 | }, |
27994 | "ts-mocha": { | ||
27995 | "version": "8.0.0", | ||
27996 | "resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-8.0.0.tgz", | ||
27997 | "integrity": "sha512-Kou1yxTlubLnD5C3unlCVO7nh0HERTezjoVhVw/M5S1SqoUec0WgllQvPk3vzPMc6by8m6xD1uR1yRf8lnVUbA==", | ||
27998 | "dev": true, | ||
27999 | "requires": { | ||
28000 | "ts-node": "7.0.1", | ||
28001 | "tsconfig-paths": "^3.5.0" | ||
28002 | } | ||
28003 | }, | ||
28004 | "ts-node": { | ||
28005 | "version": "7.0.1", | ||
28006 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", | ||
28007 | "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==", | ||
28008 | "dev": true, | ||
28009 | "requires": { | ||
28010 | "arrify": "^1.0.0", | ||
28011 | "buffer-from": "^1.1.0", | ||
28012 | "diff": "^3.1.0", | ||
28013 | "make-error": "^1.1.1", | ||
28014 | "minimist": "^1.2.0", | ||
28015 | "mkdirp": "^0.5.1", | ||
28016 | "source-map-support": "^0.5.6", | ||
28017 | "yn": "^2.0.0" | ||
28018 | }, | ||
28019 | "dependencies": { | ||
28020 | "diff": { | ||
28021 | "version": "3.5.0", | ||
28022 | "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", | ||
28023 | "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", | ||
28024 | "dev": true | ||
28025 | } | ||
28026 | } | ||
28027 | }, | ||
27967 | "tsconfig-paths": { | 28028 | "tsconfig-paths": { |
27968 | "version": "3.11.0", | 28029 | "version": "3.11.0", |
27969 | "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.11.0.tgz", | 28030 | "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.11.0.tgz", |
@@ -30251,6 +30312,12 @@ | |||
30251 | "fd-slicer": "~1.1.0" | 30312 | "fd-slicer": "~1.1.0" |
30252 | } | 30313 | } |
30253 | }, | 30314 | }, |
30315 | "yn": { | ||
30316 | "version": "2.0.0", | ||
30317 | "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", | ||
30318 | "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", | ||
30319 | "dev": true | ||
30320 | }, | ||
30254 | "yocto-queue": { | 30321 | "yocto-queue": { |
30255 | "version": "0.1.0", | 30322 | "version": "0.1.0", |
30256 | "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", | 30323 | "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", |
diff --git a/package.json b/package.json index b1cde30db..74c0f7747 100644 --- a/package.json +++ b/package.json | |||
@@ -149,8 +149,11 @@ | |||
149 | "@tsconfig/node14": "1.0.1", | 149 | "@tsconfig/node14": "1.0.1", |
150 | "@types/color": "3.0.2", | 150 | "@types/color": "3.0.2", |
151 | "@types/du": "1.0.1", | 151 | "@types/du": "1.0.1", |
152 | "@types/expect.js": "0.3.29", | ||
152 | "@types/fs-extra": "9.0.12", | 153 | "@types/fs-extra": "9.0.12", |
153 | "@types/lodash": "4.14.172", | 154 | "@types/lodash": "4.14.172", |
155 | "@types/mocha": "9.0.0", | ||
156 | "@types/ms": "0.7.31", | ||
154 | "@types/node": "14.17.6", | 157 | "@types/node": "14.17.6", |
155 | "@types/react": "16.14.6", | 158 | "@types/react": "16.14.6", |
156 | "@types/react-dom": "16.9.13", | 159 | "@types/react-dom": "16.9.13", |
@@ -207,6 +210,7 @@ | |||
207 | "simple-git": "2.45.0", | 210 | "simple-git": "2.45.0", |
208 | "terser": "4.8.0", | 211 | "terser": "4.8.0", |
209 | "ts-loader": "5.4.5", | 212 | "ts-loader": "5.4.5", |
213 | "ts-mocha": "8.0.0", | ||
210 | "typescript": "3.9.10", | 214 | "typescript": "3.9.10", |
211 | "wait-on": "6.0.0", | 215 | "wait-on": "6.0.0", |
212 | "webpack": "4.46.0", | 216 | "webpack": "4.46.0", |
diff --git a/packages/theme/package.json b/packages/theme/package.json index 516bab93c..7f3226bd8 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json | |||
@@ -17,13 +17,13 @@ | |||
17 | "dev": "tsc -w", | 17 | "dev": "tsc -w", |
18 | "build": "tsc", | 18 | "build": "tsc", |
19 | "preprepare": "npm run test", | 19 | "preprepare": "npm run test", |
20 | "test": "npx mocha" | 20 | "test": "ts-mocha 'test/**/*.test.ts'" |
21 | }, | 21 | }, |
22 | "bugs": { | 22 | "bugs": { |
23 | "url": "https://github.com/meetfranz/franz/issues" | 23 | "url": "https://github.com/meetfranz/franz/issues" |
24 | }, | 24 | }, |
25 | "dependencies": { | 25 | "dependencies": { |
26 | "color": "3.1.2" | 26 | "color": "4.0.1" |
27 | }, | 27 | }, |
28 | "gitHead": "9f2ab40b7602bc3df26ebb093b484b9917768f69" | 28 | "gitHead": "9f2ab40b7602bc3df26ebb093b484b9917768f69" |
29 | } | 29 | } |
diff --git a/packages/theme/src/themes/IStyleTypes.ts b/packages/theme/src/themes/IStyleTypes.ts index cf8bdea33..48f52daf2 100644 --- a/packages/theme/src/themes/IStyleTypes.ts +++ b/packages/theme/src/themes/IStyleTypes.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | export default interface IStyleTypes { | 1 | export interface IStyleTypes { |
2 | [index: string]: { | 2 | [index: string]: { |
3 | accent: string; | 3 | accent: string; |
4 | contrast: string; | 4 | contrast: string; |
diff --git a/packages/theme/src/themes/default/index.ts b/packages/theme/src/themes/default/index.ts index 7f69e22a5..80bcba766 100644 --- a/packages/theme/src/themes/default/index.ts +++ b/packages/theme/src/themes/default/index.ts | |||
@@ -2,7 +2,7 @@ import color from 'color'; | |||
2 | import { cloneDeep } from 'lodash'; | 2 | import { cloneDeep } from 'lodash'; |
3 | 3 | ||
4 | import * as legacyStyles from '../legacy'; | 4 | import * as legacyStyles from '../legacy'; |
5 | import IStyleTypes from '../IStyleTypes'; | 5 | import type { IStyleTypes } from '../IStyleTypes'; |
6 | 6 | ||
7 | export default (brandPrimary: string) => { | 7 | export default (brandPrimary: string) => { |
8 | const brandSuccess = '#5cb85c'; | 8 | const brandSuccess = '#5cb85c'; |
diff --git a/packages/theme/test/index.test.js b/packages/theme/test/index.test.js deleted file mode 100644 index 3906433c1..000000000 --- a/packages/theme/test/index.test.js +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | const expect = require('expect.js'); | ||
2 | |||
3 | const { colorBackground: colorBackgroundDefault } = require('../lib/themes/default'); | ||
4 | const { colorBackground: colorBackgroundDark } = require('../lib/themes/dark'); | ||
5 | const { default: theme } = require('../lib'); | ||
6 | |||
7 | describe('Load theme', () => { | ||
8 | it('Should load default theme', () => { | ||
9 | const { colorBackground } = theme('default'); | ||
10 | expect(colorBackground).to.be(colorBackgroundDefault); | ||
11 | }); | ||
12 | |||
13 | it('Should load dark theme', () => { | ||
14 | const { colorBackground } = theme('dark'); | ||
15 | expect(colorBackground).to.be(colorBackgroundDark); | ||
16 | }); | ||
17 | }); | ||
diff --git a/packages/theme/test/index.test.ts b/packages/theme/test/index.test.ts new file mode 100644 index 000000000..7eda4e359 --- /dev/null +++ b/packages/theme/test/index.test.ts | |||
@@ -0,0 +1,19 @@ | |||
1 | import expect from 'expect.js'; | ||
2 | |||
3 | import makeDefaultThemeConfig from '../src/themes/default'; | ||
4 | import makeDarkThemeConfig from '../src/themes/dark'; | ||
5 | import { theme, ThemeType } from '../src'; | ||
6 | |||
7 | describe('Load theme', () => { | ||
8 | it('Should load default theme', () => { | ||
9 | const { colorBackground } = theme('default' as ThemeType); | ||
10 | expect(colorBackground).to.be( | ||
11 | makeDefaultThemeConfig('default').colorBackground, | ||
12 | ); | ||
13 | }); | ||
14 | |||
15 | it('Should load dark theme', () => { | ||
16 | const { colorBackground } = theme('dark' as ThemeType); | ||
17 | expect(colorBackground).to.be(makeDarkThemeConfig('dark').colorBackground); | ||
18 | }); | ||
19 | }); | ||
diff --git a/packages/theme/tsconfig.json b/packages/theme/tsconfig.json index d80ee9ee7..4deaa5dd7 100644 --- a/packages/theme/tsconfig.json +++ b/packages/theme/tsconfig.json | |||
@@ -4,4 +4,5 @@ | |||
4 | "outDir": "lib", | 4 | "outDir": "lib", |
5 | "rootDir": "src" | 5 | "rootDir": "src" |
6 | }, | 6 | }, |
7 | "exclude": ["node_modules", "lib", "test"] | ||
7 | } | 8 | } |