@workday/canvas-kit-styling-transform 14.3.0-0232-next.0 → 14.3.0
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/commonjs/lib/styleTransform.d.ts.map +1 -1
- package/dist/commonjs/lib/styleTransform.js +8 -1
- package/dist/commonjs/lib/utils/handleColorSpace.d.ts +2 -0
- package/dist/commonjs/lib/utils/handleColorSpace.d.ts.map +1 -0
- package/dist/commonjs/lib/utils/handleColorSpace.js +30 -0
- package/dist/es6/lib/styleTransform.d.ts.map +1 -1
- package/dist/es6/lib/styleTransform.js +8 -1
- package/dist/es6/lib/utils/handleColorSpace.d.ts +2 -0
- package/dist/es6/lib/utils/handleColorSpace.d.ts.map +1 -0
- package/dist/es6/lib/utils/handleColorSpace.js +24 -0
- package/lib/styleTransform.ts +8 -3
- package/lib/utils/handleColorSpace.ts +38 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleTransform.d.ts","sourceRoot":"","sources":["../../../lib/styleTransform.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAY5B,OAAO,EAAC,eAAe,EAAmB,kBAAkB,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"styleTransform.d.ts","sourceRoot":"","sources":["../../../lib/styleTransform.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAY5B,OAAO,EAAC,eAAe,EAAmB,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGnF,MAAM,MAAM,iBAAiB,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAA;CAAC,CAAC;AAE5E,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;CAClC;AAQD;;GAEG;AACH,wBAAgB,MAAM,SAMrB;AAYD,eAAe,gBAAgB,CAAC;AAChC,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,EAAC,aAAkB,EAAE,GAAG,OAAO,EAAC,GAAE,OAAO,CAAC,uBAAuB,CAAM,GACtE,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,CAsDtC;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,EAAC,YAAY,EAAE,GAAG,KAAK,EAAC,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC9D,kBAAkB,CAuBpB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,QAAQ,SAAY,EACpB,OAAO,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,UAa3C;AAUD,wBAAgB,SAAS,CAAC,QAAQ,SAAM,sBAIvC"}
|
|
@@ -17,6 +17,7 @@ const handleInjectGlobal_1 = require("./utils/handleInjectGlobal");
|
|
|
17
17
|
const handleKeyframes_1 = require("./utils/handleKeyframes");
|
|
18
18
|
const handleParentModifier_1 = require("./utils/handleParentModifier");
|
|
19
19
|
const handlePx2Rem_1 = require("./utils/handlePx2Rem");
|
|
20
|
+
const handleColorSpace_1 = require("./utils/handleColorSpace");
|
|
20
21
|
let vars = {};
|
|
21
22
|
let extractedNames = {};
|
|
22
23
|
let styles = {};
|
|
@@ -103,7 +104,13 @@ function withDefaultContext(checker, { transformers, ...input } = {}) {
|
|
|
103
104
|
objectTransforms: [],
|
|
104
105
|
transform: handleTransformers(transformers || defaultTransformers),
|
|
105
106
|
...input,
|
|
106
|
-
propertyTransforms: [
|
|
107
|
+
propertyTransforms: [
|
|
108
|
+
handleCalc_1.handleCalc,
|
|
109
|
+
handlePx2Rem_1.handlePx2Rem,
|
|
110
|
+
handleCssVar_1.handleCssVar,
|
|
111
|
+
handleParentModifier_1.handleParentModifier,
|
|
112
|
+
handleColorSpace_1.handleColorSpace,
|
|
113
|
+
].concat(input.propertyTransforms || []),
|
|
107
114
|
};
|
|
108
115
|
}
|
|
109
116
|
exports.withDefaultContext = withDefaultContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleColorSpace.d.ts","sourceRoot":"","sources":["../../../../lib/utils/handleColorSpace.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,qCA6B3B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.handleColorSpace = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
9
|
+
const createPropertyTransform_1 = require("../createPropertyTransform");
|
|
10
|
+
const parseNodeToStaticValue_1 = require("./parseNodeToStaticValue");
|
|
11
|
+
const parseObjectToStaticValue_1 = require("./parseObjectToStaticValue");
|
|
12
|
+
exports.handleColorSpace = (0, createPropertyTransform_1.createPropertyTransform)((node, context) => {
|
|
13
|
+
if (typescript_1.default.isCallExpression(node) &&
|
|
14
|
+
typescript_1.default.isPropertyAccessExpression(node.expression) &&
|
|
15
|
+
typescript_1.default.isIdentifier(node.expression.expression) &&
|
|
16
|
+
node.expression.expression.text === 'colorSpace' &&
|
|
17
|
+
typescript_1.default.isIdentifier(node.expression.name)) {
|
|
18
|
+
const args = node.arguments.map(arg => {
|
|
19
|
+
if (typescript_1.default.isObjectLiteralExpression(arg)) {
|
|
20
|
+
return (0, parseObjectToStaticValue_1.parseStyleObjFromType)(context.checker.getTypeAtLocation(arg), context);
|
|
21
|
+
}
|
|
22
|
+
return (0, parseNodeToStaticValue_1.parseNodeToStaticValue)(arg, context);
|
|
23
|
+
});
|
|
24
|
+
const name = node.expression.name.text;
|
|
25
|
+
if (name === 'darken') {
|
|
26
|
+
return canvas_kit_styling_1.colorSpace.darken(args[0]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleTransform.d.ts","sourceRoot":"","sources":["../../../lib/styleTransform.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAY5B,OAAO,EAAC,eAAe,EAAmB,kBAAkB,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"styleTransform.d.ts","sourceRoot":"","sources":["../../../lib/styleTransform.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAY5B,OAAO,EAAC,eAAe,EAAmB,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGnF,MAAM,MAAM,iBAAiB,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAA;CAAC,CAAC;AAE5E,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;CAClC;AAQD;;GAEG;AACH,wBAAgB,MAAM,SAMrB;AAYD,eAAe,gBAAgB,CAAC;AAChC,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,EAAC,aAAkB,EAAE,GAAG,OAAO,EAAC,GAAE,OAAO,CAAC,uBAAuB,CAAM,GACtE,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,CAsDtC;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,EAAC,YAAY,EAAE,GAAG,KAAK,EAAC,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC9D,kBAAkB,CAuBpB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,QAAQ,SAAY,EACpB,OAAO,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,UAa3C;AAUD,wBAAgB,SAAS,CAAC,QAAQ,SAAM,sBAIvC"}
|
|
@@ -11,6 +11,7 @@ import { handleInjectGlobal } from './utils/handleInjectGlobal';
|
|
|
11
11
|
import { handleKeyframes } from './utils/handleKeyframes';
|
|
12
12
|
import { handleParentModifier } from './utils/handleParentModifier';
|
|
13
13
|
import { handlePx2Rem } from './utils/handlePx2Rem';
|
|
14
|
+
import { handleColorSpace } from './utils/handleColorSpace';
|
|
14
15
|
let vars = {};
|
|
15
16
|
let extractedNames = {};
|
|
16
17
|
let styles = {};
|
|
@@ -95,7 +96,13 @@ export function withDefaultContext(checker, { transformers, ...input } = {}) {
|
|
|
95
96
|
objectTransforms: [],
|
|
96
97
|
transform: handleTransformers(transformers || defaultTransformers),
|
|
97
98
|
...input,
|
|
98
|
-
propertyTransforms: [
|
|
99
|
+
propertyTransforms: [
|
|
100
|
+
handleCalc,
|
|
101
|
+
handlePx2Rem,
|
|
102
|
+
handleCssVar,
|
|
103
|
+
handleParentModifier,
|
|
104
|
+
handleColorSpace,
|
|
105
|
+
].concat(input.propertyTransforms || []),
|
|
99
106
|
};
|
|
100
107
|
}
|
|
101
108
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleColorSpace.d.ts","sourceRoot":"","sources":["../../../../lib/utils/handleColorSpace.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,qCA6B3B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { colorSpace } from '@workday/canvas-kit-styling';
|
|
3
|
+
import { createPropertyTransform } from '../createPropertyTransform';
|
|
4
|
+
import { parseNodeToStaticValue } from './parseNodeToStaticValue';
|
|
5
|
+
import { parseStyleObjFromType } from './parseObjectToStaticValue';
|
|
6
|
+
export const handleColorSpace = createPropertyTransform((node, context) => {
|
|
7
|
+
if (ts.isCallExpression(node) &&
|
|
8
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
|
9
|
+
ts.isIdentifier(node.expression.expression) &&
|
|
10
|
+
node.expression.expression.text === 'colorSpace' &&
|
|
11
|
+
ts.isIdentifier(node.expression.name)) {
|
|
12
|
+
const args = node.arguments.map(arg => {
|
|
13
|
+
if (ts.isObjectLiteralExpression(arg)) {
|
|
14
|
+
return parseStyleObjFromType(context.checker.getTypeAtLocation(arg), context);
|
|
15
|
+
}
|
|
16
|
+
return parseNodeToStaticValue(arg, context);
|
|
17
|
+
});
|
|
18
|
+
const name = node.expression.name.text;
|
|
19
|
+
if (name === 'darken') {
|
|
20
|
+
return colorSpace.darken(args[0]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return;
|
|
24
|
+
});
|
package/lib/styleTransform.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {handleKeyframes} from './utils/handleKeyframes';
|
|
|
13
13
|
import {handleParentModifier} from './utils/handleParentModifier';
|
|
14
14
|
import {handlePx2Rem} from './utils/handlePx2Rem';
|
|
15
15
|
import {NodeTransformer, ObjectTransform, TransformerContext} from './utils/types';
|
|
16
|
+
import {handleColorSpace} from './utils/handleColorSpace';
|
|
16
17
|
|
|
17
18
|
export type NestedStyleObject = {[key: string]: string | NestedStyleObject};
|
|
18
19
|
|
|
@@ -126,9 +127,13 @@ export function withDefaultContext(
|
|
|
126
127
|
objectTransforms: [] as ObjectTransform[],
|
|
127
128
|
transform: handleTransformers(transformers || defaultTransformers),
|
|
128
129
|
...input,
|
|
129
|
-
propertyTransforms: [
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
propertyTransforms: [
|
|
131
|
+
handleCalc,
|
|
132
|
+
handlePx2Rem,
|
|
133
|
+
handleCssVar,
|
|
134
|
+
handleParentModifier,
|
|
135
|
+
handleColorSpace,
|
|
136
|
+
].concat(input.propertyTransforms || []),
|
|
132
137
|
} as TransformerContext;
|
|
133
138
|
}
|
|
134
139
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
|
|
3
|
+
import {colorSpace} from '@workday/canvas-kit-styling';
|
|
4
|
+
|
|
5
|
+
import {createPropertyTransform} from '../createPropertyTransform';
|
|
6
|
+
import {parseNodeToStaticValue} from './parseNodeToStaticValue';
|
|
7
|
+
import {parseStyleObjFromType} from './parseObjectToStaticValue';
|
|
8
|
+
|
|
9
|
+
export const handleColorSpace = createPropertyTransform((node, context) => {
|
|
10
|
+
if (
|
|
11
|
+
ts.isCallExpression(node) &&
|
|
12
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
|
13
|
+
ts.isIdentifier(node.expression.expression) &&
|
|
14
|
+
node.expression.expression.text === 'colorSpace' &&
|
|
15
|
+
ts.isIdentifier(node.expression.name)
|
|
16
|
+
) {
|
|
17
|
+
const args = node.arguments.map(arg => {
|
|
18
|
+
if (ts.isObjectLiteralExpression(arg)) {
|
|
19
|
+
return parseStyleObjFromType(context.checker.getTypeAtLocation(arg), context);
|
|
20
|
+
}
|
|
21
|
+
return parseNodeToStaticValue(arg, context);
|
|
22
|
+
});
|
|
23
|
+
const name = node.expression.name.text;
|
|
24
|
+
|
|
25
|
+
if (name === 'darken') {
|
|
26
|
+
return colorSpace.darken(
|
|
27
|
+
args[0] as {
|
|
28
|
+
color: string;
|
|
29
|
+
fallback?: string;
|
|
30
|
+
mixinColor: string;
|
|
31
|
+
mixinValue: string;
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return;
|
|
38
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-styling-transform",
|
|
3
|
-
"version": "14.3.0
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "The custom CSS in JS solution that takes JS styles and turns them into static CSS",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@emotion/serialize": "^1.0.2",
|
|
41
|
-
"@workday/canvas-kit-styling": "^14.3.0
|
|
41
|
+
"@workday/canvas-kit-styling": "^14.3.0",
|
|
42
42
|
"@workday/canvas-tokens-web": "^3.1.6",
|
|
43
43
|
"stylis": "4.0.13",
|
|
44
44
|
"ts-node": "^10.9.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"typescript": ">=5.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7235a397c9f49a8ef929c793b2321d9f1526ec5c"
|
|
55
55
|
}
|