@elliemae/ds-system 2.2.0 → 2.2.2
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/cjs/th.js +23 -12
- package/esm/th.js +22 -11
- package/package.json +2 -2
- package/types/th.d.ts +15 -12
package/cjs/th.js
CHANGED
|
@@ -6,18 +6,29 @@ require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
|
6
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
7
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
8
|
|
|
9
|
-
const th = property =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
const th = property => {
|
|
10
|
+
const thGetter = function (value) {
|
|
11
|
+
let dfault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
12
|
+
|
|
13
|
+
const func = _ref => {
|
|
14
|
+
var _ref2;
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
theme
|
|
18
|
+
} = _ref;
|
|
19
|
+
const parts = value.split('-');
|
|
20
|
+
let result = theme[property];
|
|
21
|
+
parts.forEach(part => {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
23
|
+
if (result) result = result[part];
|
|
24
|
+
});
|
|
25
|
+
return (_ref2 = result) !== null && _ref2 !== void 0 ? _ref2 : dfault;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return func;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return thGetter;
|
|
21
32
|
};
|
|
22
33
|
th.space = th('space');
|
|
23
34
|
th.fontSize = th('fontSizes');
|
package/esm/th.js
CHANGED
|
@@ -2,18 +2,29 @@ import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
|
2
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
3
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
4
|
|
|
5
|
-
const th = property =>
|
|
6
|
-
|
|
5
|
+
const th = property => {
|
|
6
|
+
const thGetter = function (value) {
|
|
7
|
+
let dfault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
const func = _ref => {
|
|
10
|
+
var _ref2;
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
const parts = value.split('-');
|
|
16
|
+
let result = theme[property];
|
|
17
|
+
parts.forEach(part => {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
19
|
+
if (result) result = result[part];
|
|
20
|
+
});
|
|
21
|
+
return (_ref2 = result) !== null && _ref2 !== void 0 ? _ref2 : dfault;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return func;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return thGetter;
|
|
17
28
|
};
|
|
18
29
|
th.space = th('space');
|
|
19
30
|
th.fontSize = th('fontSizes');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-system",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - System",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"generateSubmodules": true
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@elliemae/ds-utilities": "2.2.
|
|
92
|
+
"@elliemae/ds-utilities": "2.2.2",
|
|
93
93
|
"polished": "~3.6.7"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
package/types/th.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
declare type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import type { Theme } from '@elliemae/pui-theme';
|
|
2
|
+
declare type ThGetter = (value: string, dfault?: string) => ({ theme }: {
|
|
3
|
+
theme: Theme;
|
|
4
|
+
}) => string;
|
|
5
|
+
declare type ThConstructor = ((property: keyof Theme) => ThGetter) & {
|
|
6
|
+
space: ThGetter;
|
|
7
|
+
fontSize: ThGetter;
|
|
8
|
+
fontWeight: ThGetter;
|
|
9
|
+
lineHeight: ThGetter;
|
|
10
|
+
letterSpacing: ThGetter;
|
|
11
|
+
font: ThGetter;
|
|
12
|
+
color: ThGetter;
|
|
13
|
+
breakpoint: ThGetter;
|
|
14
|
+
media: ThGetter;
|
|
12
15
|
};
|
|
13
|
-
export declare const th:
|
|
16
|
+
export declare const th: ThConstructor;
|
|
14
17
|
export {};
|