1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | exports.transform = void 0;
|
---|
4 | exports.transform = {
|
---|
5 | name: 'transform',
|
---|
6 | initialValue: 'none',
|
---|
7 | prefix: true,
|
---|
8 | type: 0 /* VALUE */,
|
---|
9 | parse: function (_context, token) {
|
---|
10 | if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
---|
11 | return null;
|
---|
12 | }
|
---|
13 | if (token.type === 18 /* FUNCTION */) {
|
---|
14 | var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
|
---|
15 | if (typeof transformFunction === 'undefined') {
|
---|
16 | throw new Error("Attempting to parse an unsupported transform function \"" + token.name + "\"");
|
---|
17 | }
|
---|
18 | return transformFunction(token.values);
|
---|
19 | }
|
---|
20 | return null;
|
---|
21 | }
|
---|
22 | };
|
---|
23 | var matrix = function (args) {
|
---|
24 | var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
---|
25 | return values.length === 6 ? values : null;
|
---|
26 | };
|
---|
27 | // doesn't support 3D transforms at the moment
|
---|
28 | var matrix3d = function (args) {
|
---|
29 | var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
---|
30 | var a1 = values[0], b1 = values[1], _a = values[2], _b = values[3], a2 = values[4], b2 = values[5], _c = values[6], _d = values[7], _e = values[8], _f = values[9], _g = values[10], _h = values[11], a4 = values[12], b4 = values[13], _j = values[14], _k = values[15];
|
---|
31 | return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
|
---|
32 | };
|
---|
33 | var SUPPORTED_TRANSFORM_FUNCTIONS = {
|
---|
34 | matrix: matrix,
|
---|
35 | matrix3d: matrix3d
|
---|
36 | };
|
---|
37 | //# sourceMappingURL=transform.js.map |
---|