@antv/g 5.0.23-alpha.0 → 5.0.23-alpha.10
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/index.umd.min.js +2 -2
- package/es/css/cssom/CSSKeywordValue.d.ts +1 -1
- package/es/css/cssom/CSSNumericSumValue.d.ts +1 -1
- package/es/css/cssom/CSSNumericValue.d.ts +141 -4
- package/es/css/cssom/CSSNumericValue.js +1166 -5
- package/es/css/cssom/CSSTransformValue.d.ts +1 -1
- package/es/css/cssom/index.d.ts +0 -10
- package/es/css/cssom/index.js +1 -11
- package/es/css/parser/numeric.d.ts +1 -1
- package/es/css/parser/numeric.js +1 -1
- package/es/css/parser/transform-origin.d.ts +1 -1
- package/es/css/parser/transform-origin.js +1 -1
- package/es/css/parser/transform.d.ts +1 -3
- package/es/css/parser/transform.js +9 -8
- package/es/css/properties/CSSPropertyTransform.js +2 -2
- package/es/plugins/PrepareRendererPlugin.js +1 -1
- package/es/services/RenderingService.js +1 -1
- package/lib/css/cssom/CSSKeywordValue.d.ts +1 -1
- package/lib/css/cssom/CSSNumericSumValue.d.ts +1 -1
- package/lib/css/cssom/CSSNumericValue.d.ts +141 -4
- package/lib/css/cssom/CSSNumericValue.js +1226 -52
- package/lib/css/cssom/CSSTransformValue.d.ts +1 -1
- package/lib/css/cssom/index.d.ts +0 -10
- package/lib/css/cssom/index.js +0 -130
- package/lib/css/parser/numeric.d.ts +1 -1
- package/lib/css/parser/numeric.js +4 -4
- package/lib/css/parser/transform-origin.d.ts +1 -1
- package/lib/css/parser/transform-origin.js +2 -2
- package/lib/css/parser/transform.d.ts +1 -3
- package/lib/css/parser/transform.js +25 -24
- package/lib/css/properties/CSSPropertyTransform.js +18 -18
- package/lib/plugins/PrepareRendererPlugin.js +2 -2
- package/lib/services/RenderingService.js +2 -2
- package/package.json +3 -3
- package/es/css/cssom/CSSMathInvert.d.ts +0 -14
- package/es/css/cssom/CSSMathInvert.js +0 -84
- package/es/css/cssom/CSSMathMax.d.ts +0 -17
- package/es/css/cssom/CSSMathMax.js +0 -118
- package/es/css/cssom/CSSMathMin.d.ts +0 -17
- package/es/css/cssom/CSSMathMin.js +0 -119
- package/es/css/cssom/CSSMathNegate.d.ts +0 -14
- package/es/css/cssom/CSSMathNegate.js +0 -80
- package/es/css/cssom/CSSMathProduct.d.ts +0 -16
- package/es/css/cssom/CSSMathProduct.js +0 -109
- package/es/css/cssom/CSSMathSum.d.ts +0 -17
- package/es/css/cssom/CSSMathSum.js +0 -117
- package/es/css/cssom/CSSMathValue.d.ts +0 -11
- package/es/css/cssom/CSSMathValue.js +0 -27
- package/es/css/cssom/CSSMathVariadic.d.ts +0 -9
- package/es/css/cssom/CSSMathVariadic.js +0 -44
- package/es/css/cssom/CSSNumericValueType.d.ts +0 -33
- package/es/css/cssom/CSSNumericValueType.js +0 -259
- package/es/css/cssom/CSSUnitValue.d.ts +0 -33
- package/es/css/cssom/CSSUnitValue.js +0 -252
- package/lib/css/cssom/CSSMathInvert.d.ts +0 -14
- package/lib/css/cssom/CSSMathInvert.js +0 -94
- package/lib/css/cssom/CSSMathMax.d.ts +0 -17
- package/lib/css/cssom/CSSMathMax.js +0 -128
- package/lib/css/cssom/CSSMathMin.d.ts +0 -17
- package/lib/css/cssom/CSSMathMin.js +0 -128
- package/lib/css/cssom/CSSMathNegate.d.ts +0 -14
- package/lib/css/cssom/CSSMathNegate.js +0 -89
- package/lib/css/cssom/CSSMathProduct.d.ts +0 -16
- package/lib/css/cssom/CSSMathProduct.js +0 -119
- package/lib/css/cssom/CSSMathSum.d.ts +0 -17
- package/lib/css/cssom/CSSMathSum.js +0 -129
- package/lib/css/cssom/CSSMathValue.d.ts +0 -11
- package/lib/css/cssom/CSSMathValue.js +0 -35
- package/lib/css/cssom/CSSMathVariadic.d.ts +0 -9
- package/lib/css/cssom/CSSMathVariadic.js +0 -55
- package/lib/css/cssom/CSSNumericValueType.d.ts +0 -33
- package/lib/css/cssom/CSSNumericValueType.js +0 -272
- package/lib/css/cssom/CSSUnitValue.d.ts +0 -33
- package/lib/css/cssom/CSSUnitValue.js +0 -267
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
|
|
3
|
-
* It inherits properties and methods from its parent CSSNumericValue.
|
|
4
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
|
|
5
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMax
|
|
6
|
-
*/
|
|
7
|
-
import { __extends, __values } from "tslib";
|
|
8
|
-
import { CSSMathVariadic } from './CSSMathVariadic';
|
|
9
|
-
import { Nested, ParenLess, CSSNumericValueType, CSSStyleValueType, typeCheck } from '.'; // Represents the maximum of one or more CSSNumericValues.
|
|
10
|
-
// @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
|
|
11
|
-
|
|
12
|
-
var CSSMathMax =
|
|
13
|
-
/** @class */
|
|
14
|
-
function (_super) {
|
|
15
|
-
__extends(CSSMathMax, _super);
|
|
16
|
-
|
|
17
|
-
function CSSMathMax() {
|
|
18
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
19
|
-
|
|
20
|
-
_this.operator = 'max';
|
|
21
|
-
return _this;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
CSSMathMax.create = function (values) {
|
|
25
|
-
var error = false;
|
|
26
|
-
var final_type = typeCheck(values, CSSNumericValueType.add, error);
|
|
27
|
-
return error ? null : new CSSMathMax(values, final_type);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
CSSMathMax.prototype.clone = function () {
|
|
31
|
-
return new CSSMathMax(this.values, this.type_);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
CSSMathMax.prototype.getType = function () {
|
|
35
|
-
return CSSStyleValueType.kMaxType;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
CSSMathMax.prototype.sumValue = function () {
|
|
39
|
-
var e_1, _a;
|
|
40
|
-
|
|
41
|
-
var cur_max = this.numericValues()[0].sumValue();
|
|
42
|
-
|
|
43
|
-
if (!cur_max.length) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
for (var _b = __values(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
49
|
-
var value = _c.value;
|
|
50
|
-
var child_sum = value.sumValue();
|
|
51
|
-
|
|
52
|
-
if (!child_sum.length || JSON.stringify(child_sum[0].units) !== JSON.stringify(cur_max[0].units)) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (child_sum[0].value < cur_max[0].value) {
|
|
57
|
-
cur_max = child_sum;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
} catch (e_1_1) {
|
|
61
|
-
e_1 = {
|
|
62
|
-
error: e_1_1
|
|
63
|
-
};
|
|
64
|
-
} finally {
|
|
65
|
-
try {
|
|
66
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
67
|
-
} finally {
|
|
68
|
-
if (e_1) throw e_1.error;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return cur_max;
|
|
73
|
-
}; // toCalcExpressionNode() {
|
|
74
|
-
// const operands: CSSMathExpressionOperation[] = [];
|
|
75
|
-
// for (const value of this.numericValues()) {
|
|
76
|
-
// const operand = value.toCalcExpressionNode();
|
|
77
|
-
// if (!operand) {
|
|
78
|
-
// continue;
|
|
79
|
-
// }
|
|
80
|
-
// operands.push(operand as CSSMathExpressionOperation);
|
|
81
|
-
// }
|
|
82
|
-
// return CSSMathExpressionOperation.createComparisonFunction(operands, CSSMathOperator.kMax);
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
CSSMathMax.prototype.buildCSSText = function (nested, paren_less, result) {
|
|
87
|
-
var e_2, _a;
|
|
88
|
-
|
|
89
|
-
result += 'max(';
|
|
90
|
-
var first_iteration = true;
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
for (var _b = __values(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
94
|
-
var value = _c.value;
|
|
95
|
-
if (!first_iteration) result += ', ';
|
|
96
|
-
first_iteration = false;
|
|
97
|
-
result = value.buildCSSText(Nested.kYes, ParenLess.kYes, result);
|
|
98
|
-
}
|
|
99
|
-
} catch (e_2_1) {
|
|
100
|
-
e_2 = {
|
|
101
|
-
error: e_2_1
|
|
102
|
-
};
|
|
103
|
-
} finally {
|
|
104
|
-
try {
|
|
105
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
106
|
-
} finally {
|
|
107
|
-
if (e_2) throw e_2.error;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
result += ')';
|
|
112
|
-
return result;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
return CSSMathMax;
|
|
116
|
-
}(CSSMathVariadic);
|
|
117
|
-
|
|
118
|
-
export { CSSMathMax };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
|
|
3
|
-
* It inherits properties and methods from its parent CSSNumericValue.
|
|
4
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
|
|
5
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMin
|
|
6
|
-
*/
|
|
7
|
-
import { CSSMathVariadic } from './CSSMathVariadic';
|
|
8
|
-
import type { CSSNumericValue, CSSNumericSumValue } from '.';
|
|
9
|
-
import { CSSStyleValueType, Nested, ParenLess } from '.';
|
|
10
|
-
export declare class CSSMathMin extends CSSMathVariadic {
|
|
11
|
-
static create(values: CSSNumericValue[]): CSSMathMin;
|
|
12
|
-
operator: string;
|
|
13
|
-
clone(): CSSMathMin;
|
|
14
|
-
getType(): CSSStyleValueType;
|
|
15
|
-
sumValue(): CSSNumericSumValue;
|
|
16
|
-
buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
|
|
17
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { __extends, __values } from "tslib";
|
|
2
|
-
/**
|
|
3
|
-
* The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
|
|
4
|
-
* It inherits properties and methods from its parent CSSNumericValue.
|
|
5
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
|
|
6
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMin
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { CSSMathVariadic } from './CSSMathVariadic';
|
|
10
|
-
import { CSSNumericValueType, CSSStyleValueType, typeCheck, Nested, ParenLess } from '.'; // Represents the minimum of one or more CSSNumericValues.
|
|
11
|
-
// @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
|
|
12
|
-
|
|
13
|
-
var CSSMathMin =
|
|
14
|
-
/** @class */
|
|
15
|
-
function (_super) {
|
|
16
|
-
__extends(CSSMathMin, _super);
|
|
17
|
-
|
|
18
|
-
function CSSMathMin() {
|
|
19
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
20
|
-
|
|
21
|
-
_this.operator = 'min';
|
|
22
|
-
return _this;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
CSSMathMin.create = function (values) {
|
|
26
|
-
var error = false;
|
|
27
|
-
var final_type = typeCheck(values, CSSNumericValueType.add, error);
|
|
28
|
-
return error ? null : new CSSMathMin(values, final_type);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
CSSMathMin.prototype.clone = function () {
|
|
32
|
-
return new CSSMathMin(this.values, this.type_);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
CSSMathMin.prototype.getType = function () {
|
|
36
|
-
return CSSStyleValueType.kMinType;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
CSSMathMin.prototype.sumValue = function () {
|
|
40
|
-
var e_1, _a;
|
|
41
|
-
|
|
42
|
-
var cur_min = this.numericValues()[0].sumValue();
|
|
43
|
-
|
|
44
|
-
if (!cur_min.length) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
for (var _b = __values(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
50
|
-
var value = _c.value;
|
|
51
|
-
var child_sum = value.sumValue();
|
|
52
|
-
|
|
53
|
-
if (!child_sum.length || JSON.stringify(child_sum[0].units) !== JSON.stringify(cur_min[0].units)) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (child_sum[0].value < cur_min[0].value) {
|
|
58
|
-
cur_min = child_sum;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
} catch (e_1_1) {
|
|
62
|
-
e_1 = {
|
|
63
|
-
error: e_1_1
|
|
64
|
-
};
|
|
65
|
-
} finally {
|
|
66
|
-
try {
|
|
67
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
68
|
-
} finally {
|
|
69
|
-
if (e_1) throw e_1.error;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return cur_min;
|
|
74
|
-
}; // toCalcExpressionNode() {
|
|
75
|
-
// const operands: CSSMathExpressionOperation[] = [];
|
|
76
|
-
// for (const value of this.numericValues()) {
|
|
77
|
-
// const operand = value.toCalcExpressionNode();
|
|
78
|
-
// if (!operand) {
|
|
79
|
-
// continue;
|
|
80
|
-
// }
|
|
81
|
-
// operands.push(operand as CSSMathExpressionOperation);
|
|
82
|
-
// }
|
|
83
|
-
// return CSSMathExpressionOperation.createComparisonFunction(operands, CSSMathOperator.kMin);
|
|
84
|
-
// }
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
CSSMathMin.prototype.buildCSSText = function (nested, paren_less, result) {
|
|
88
|
-
var e_2, _a;
|
|
89
|
-
|
|
90
|
-
result += 'min(';
|
|
91
|
-
var first_iteration = true;
|
|
92
|
-
|
|
93
|
-
try {
|
|
94
|
-
for (var _b = __values(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
95
|
-
var value = _c.value;
|
|
96
|
-
if (!first_iteration) result += ', ';
|
|
97
|
-
first_iteration = false;
|
|
98
|
-
result = value.buildCSSText(Nested.kYes, ParenLess.kYes, result);
|
|
99
|
-
}
|
|
100
|
-
} catch (e_2_1) {
|
|
101
|
-
e_2 = {
|
|
102
|
-
error: e_2_1
|
|
103
|
-
};
|
|
104
|
-
} finally {
|
|
105
|
-
try {
|
|
106
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
107
|
-
} finally {
|
|
108
|
-
if (e_2) throw e_2.error;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
result += ')';
|
|
113
|
-
return result;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
return CSSMathMin;
|
|
117
|
-
}(CSSMathVariadic);
|
|
118
|
-
|
|
119
|
-
export { CSSMathMin };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CSSNumericSumValue, CSSNumericValueType, CSSNumericValue } from '.';
|
|
2
|
-
import { CSSMathValue } from './CSSMathValue';
|
|
3
|
-
import { Nested, ParenLess, CSSStyleValueType } from '.';
|
|
4
|
-
export declare class CSSMathNegate extends CSSMathValue {
|
|
5
|
-
value: CSSNumericValue;
|
|
6
|
-
static create(value: CSSNumericValue): CSSMathNegate;
|
|
7
|
-
constructor(value: CSSNumericValue, type: CSSNumericValueType);
|
|
8
|
-
operator: string;
|
|
9
|
-
clone(): CSSMathNegate;
|
|
10
|
-
getType(): CSSStyleValueType;
|
|
11
|
-
equals(other: CSSNumericValue): any;
|
|
12
|
-
sumValue(): CSSNumericSumValue;
|
|
13
|
-
buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
|
|
14
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
|
-
import { CSSMathValue } from './CSSMathValue';
|
|
3
|
-
import { Nested, ParenLess, CSSStyleValueType } from '.';
|
|
4
|
-
|
|
5
|
-
var CSSMathNegate =
|
|
6
|
-
/** @class */
|
|
7
|
-
function (_super) {
|
|
8
|
-
__extends(CSSMathNegate, _super);
|
|
9
|
-
|
|
10
|
-
function CSSMathNegate(value, type) {
|
|
11
|
-
var _this = _super.call(this, type) || this;
|
|
12
|
-
|
|
13
|
-
_this.value = value;
|
|
14
|
-
_this.operator = 'negate';
|
|
15
|
-
return _this;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
CSSMathNegate.create = function (value) {
|
|
19
|
-
return new CSSMathNegate(value, value.type_);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
CSSMathNegate.prototype.clone = function () {
|
|
23
|
-
return new CSSMathNegate(this.value, this.type_);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
CSSMathNegate.prototype.getType = function () {
|
|
27
|
-
return CSSStyleValueType.kNegateType;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
CSSMathNegate.prototype.equals = function (other) {
|
|
31
|
-
if (other.getType() !== CSSStyleValueType.kNegateType) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var other_invert = other;
|
|
36
|
-
return this.value.equals(other_invert.value);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
CSSMathNegate.prototype.sumValue = function () {
|
|
40
|
-
var sum = this.value.sumValue();
|
|
41
|
-
|
|
42
|
-
if (sum.length === 0) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
sum.forEach(function (term) {
|
|
47
|
-
term.value *= -1;
|
|
48
|
-
});
|
|
49
|
-
return sum;
|
|
50
|
-
}; // toCalcExpressionNode(): CSSMathExpressionNode {
|
|
51
|
-
// const right_side = this.value.toCalcExpressionNode();
|
|
52
|
-
// if (!right_side) {
|
|
53
|
-
// return null;
|
|
54
|
-
// }
|
|
55
|
-
// // return CSSMathExpressionOperation::CreateArithmeticOperationSimplified(
|
|
56
|
-
// // CSSMathExpressionNumericLiteral::Create(
|
|
57
|
-
// // -1, CSSPrimitiveValue::UnitType::kNumber),
|
|
58
|
-
// // right_side, CSSMathOperator::kMultiply);
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
CSSMathNegate.prototype.buildCSSText = function (nested, paren_less, result) {
|
|
63
|
-
if (paren_less == ParenLess.kNo) {
|
|
64
|
-
result += nested === Nested.kYes ? '(' : 'calc(';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
result += '-';
|
|
68
|
-
result = this.value.buildCSSText(Nested.kYes, ParenLess.kNo, result);
|
|
69
|
-
|
|
70
|
-
if (paren_less === ParenLess.kNo) {
|
|
71
|
-
result += ')';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return result;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return CSSMathNegate;
|
|
78
|
-
}(CSSMathValue);
|
|
79
|
-
|
|
80
|
-
export { CSSMathNegate };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { CSSNumericValue, CSSNumericSumValue, UnitMap } from '.';
|
|
2
|
-
import { CSSMathVariadic } from './CSSMathVariadic';
|
|
3
|
-
import { CSSStyleValueType, Nested, ParenLess } from '.';
|
|
4
|
-
/**
|
|
5
|
-
* Represents the product of one or more CSSNumericValues.
|
|
6
|
-
* @see https://drafts.css-houdini.org/css-typed-om/#cssmathproduct
|
|
7
|
-
*/
|
|
8
|
-
export declare class CSSMathProduct extends CSSMathVariadic {
|
|
9
|
-
static create(values: CSSNumericValue[]): CSSMathProduct;
|
|
10
|
-
static multiplyUnitMaps(a: UnitMap, b: UnitMap): UnitMap;
|
|
11
|
-
operator: string;
|
|
12
|
-
clone(): CSSMathProduct;
|
|
13
|
-
getType(): CSSStyleValueType;
|
|
14
|
-
sumValue(): CSSNumericSumValue;
|
|
15
|
-
buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
|
|
16
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
|
-
import { DCHECK_NE } from '../../utils';
|
|
3
|
-
import { CSSMathVariadic } from './CSSMathVariadic';
|
|
4
|
-
import { typeCheck, CSSStyleValueType, CSSNumericValueType, Nested, ParenLess } from '.';
|
|
5
|
-
/**
|
|
6
|
-
* Represents the product of one or more CSSNumericValues.
|
|
7
|
-
* @see https://drafts.css-houdini.org/css-typed-om/#cssmathproduct
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var CSSMathProduct =
|
|
11
|
-
/** @class */
|
|
12
|
-
function (_super) {
|
|
13
|
-
__extends(CSSMathProduct, _super);
|
|
14
|
-
|
|
15
|
-
function CSSMathProduct() {
|
|
16
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
17
|
-
|
|
18
|
-
_this.operator = 'product';
|
|
19
|
-
return _this;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
CSSMathProduct.create = function (values) {
|
|
23
|
-
var error = false;
|
|
24
|
-
var finalType = typeCheck(values, CSSNumericValueType.multiply, error);
|
|
25
|
-
return error ? null : new CSSMathProduct(values, finalType);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
CSSMathProduct.multiplyUnitMaps = function (a, b) {
|
|
29
|
-
Object.keys(b).forEach(function (key) {
|
|
30
|
-
DCHECK_NE(b[key].value, 0);
|
|
31
|
-
var old_value = key in a ? a[key].value : 0;
|
|
32
|
-
|
|
33
|
-
if (old_value + b[key].value === 0) {
|
|
34
|
-
delete a[key];
|
|
35
|
-
} else {
|
|
36
|
-
a[key] = old_value + b[key].value;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return a;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
CSSMathProduct.prototype.clone = function () {
|
|
43
|
-
return new CSSMathProduct(this.values, this.type_);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
CSSMathProduct.prototype.getType = function () {
|
|
47
|
-
return CSSStyleValueType.kProductType;
|
|
48
|
-
}; // toCalcExpressionNode() {
|
|
49
|
-
// return this.toCalcExporessionNodeForVariadic(CSSMathOperator.kMultiply);
|
|
50
|
-
// }
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
CSSMathProduct.prototype.sumValue = function () {
|
|
54
|
-
var sum = [{
|
|
55
|
-
value: 1,
|
|
56
|
-
units: {}
|
|
57
|
-
}];
|
|
58
|
-
this.numericValues().forEach(function (value) {
|
|
59
|
-
var child_sum = value.sumValue();
|
|
60
|
-
|
|
61
|
-
if (!child_sum.length) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
var new_sum = [];
|
|
66
|
-
sum.forEach(function (a) {
|
|
67
|
-
child_sum.forEach(function (b) {
|
|
68
|
-
new_sum.push({
|
|
69
|
-
value: a.value * b.value,
|
|
70
|
-
units: CSSMathProduct.multiplyUnitMaps(a.units, b.units)
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
sum = new_sum;
|
|
75
|
-
});
|
|
76
|
-
return sum;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
CSSMathProduct.prototype.buildCSSText = function (nested, paren_less, result) {
|
|
80
|
-
if (paren_less == ParenLess.kNo) {
|
|
81
|
-
result += nested === Nested.kYes ? '(' : 'calc(';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var values = this.numericValues();
|
|
85
|
-
result = values[0].buildCSSText(Nested.kYes, ParenLess.kNo, result);
|
|
86
|
-
|
|
87
|
-
for (var i = 1; i < values.length; i++) {
|
|
88
|
-
var arg = values[i];
|
|
89
|
-
|
|
90
|
-
if (arg.getType() === CSSStyleValueType.kInvertType) {
|
|
91
|
-
result += ' / ';
|
|
92
|
-
result = arg.value.buildCSSText(Nested.kYes, ParenLess.kNo, result);
|
|
93
|
-
} else {
|
|
94
|
-
result += ' * ';
|
|
95
|
-
result = arg.buildCSSText(Nested.kYes, ParenLess.kNo, result);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (paren_less === ParenLess.kNo) {
|
|
100
|
-
result += ')';
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return result;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
return CSSMathProduct;
|
|
107
|
-
}(CSSMathVariadic);
|
|
108
|
-
|
|
109
|
-
export { CSSMathProduct };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { CSSNumericValue, CSSNumericSumValue, UnitMap } from '.';
|
|
2
|
-
import { CSSMathVariadic } from './CSSMathVariadic';
|
|
3
|
-
import { CSSStyleValueType, CSSNumericValueType, Nested, ParenLess } from '.';
|
|
4
|
-
/**
|
|
5
|
-
* Represents the sum of one or more CSSNumericValues.
|
|
6
|
-
* @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
|
|
7
|
-
*/
|
|
8
|
-
export declare class CSSMathSum extends CSSMathVariadic {
|
|
9
|
-
static create(values: CSSNumericValue[]): CSSMathSum;
|
|
10
|
-
static numericTypeFromUnitMap(units: UnitMap): CSSNumericValueType;
|
|
11
|
-
static canCreateNumericTypeFromSumValue(sum: CSSNumericSumValue): boolean;
|
|
12
|
-
operator: string;
|
|
13
|
-
clone(): CSSMathSum;
|
|
14
|
-
getType(): CSSStyleValueType;
|
|
15
|
-
sumValue(): CSSNumericSumValue;
|
|
16
|
-
buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
|
|
17
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { __assign, __extends } from "tslib";
|
|
2
|
-
import { DCHECK } from '../../utils';
|
|
3
|
-
import { CSSMathVariadic } from './CSSMathVariadic';
|
|
4
|
-
import { typeCheck, CSSStyleValueType, CSSNumericValueType, Nested, ParenLess } from '.';
|
|
5
|
-
/**
|
|
6
|
-
* Represents the sum of one or more CSSNumericValues.
|
|
7
|
-
* @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var CSSMathSum =
|
|
11
|
-
/** @class */
|
|
12
|
-
function (_super) {
|
|
13
|
-
__extends(CSSMathSum, _super);
|
|
14
|
-
|
|
15
|
-
function CSSMathSum() {
|
|
16
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
17
|
-
|
|
18
|
-
_this.operator = 'sum';
|
|
19
|
-
return _this;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
CSSMathSum.create = function (values) {
|
|
23
|
-
var error = false;
|
|
24
|
-
var finalType = typeCheck(values, CSSNumericValueType.add, error);
|
|
25
|
-
return error ? null : new CSSMathSum(values, finalType);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
CSSMathSum.numericTypeFromUnitMap = function (units) {
|
|
29
|
-
var type = new CSSNumericValueType();
|
|
30
|
-
Object.keys(units).forEach(function (key) {
|
|
31
|
-
var exp = units[key];
|
|
32
|
-
var error = false;
|
|
33
|
-
type = CSSNumericValueType.multiply(type, new CSSNumericValueType(Number(key), exp), error);
|
|
34
|
-
DCHECK(!error);
|
|
35
|
-
});
|
|
36
|
-
return type;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
CSSMathSum.canCreateNumericTypeFromSumValue = function (sum) {
|
|
40
|
-
var _this = this;
|
|
41
|
-
|
|
42
|
-
DCHECK(!!sum.length);
|
|
43
|
-
var first_type = this.numericTypeFromUnitMap(sum[0].units);
|
|
44
|
-
return sum.every(function (term) {
|
|
45
|
-
var error = false;
|
|
46
|
-
CSSNumericValueType.add(first_type, _this.numericTypeFromUnitMap(term.units), error);
|
|
47
|
-
return !error;
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
CSSMathSum.prototype.clone = function () {
|
|
52
|
-
return new CSSMathSum(this.values, this.type_);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
CSSMathSum.prototype.getType = function () {
|
|
56
|
-
return CSSStyleValueType.kSumType;
|
|
57
|
-
}; // toCalcExpressionNode() {
|
|
58
|
-
// return this.toCalcExporessionNodeForVariadic(CSSMathOperator.kAdd);
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
CSSMathSum.prototype.sumValue = function () {
|
|
63
|
-
var sum = [];
|
|
64
|
-
this.numericValues().forEach(function (value) {
|
|
65
|
-
var child_sum = value.sumValue();
|
|
66
|
-
|
|
67
|
-
if (!child_sum.length) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
child_sum.forEach(function (term) {
|
|
72
|
-
var index = sum.findIndex(function (s) {
|
|
73
|
-
return JSON.stringify(s.units) === JSON.stringify(term.units);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
if (index === -1) {
|
|
77
|
-
sum.push(__assign({}, term));
|
|
78
|
-
} else {
|
|
79
|
-
sum[index].value += term.value;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
if (!CSSMathSum.canCreateNumericTypeFromSumValue(sum)) return null;
|
|
84
|
-
return sum;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
CSSMathSum.prototype.buildCSSText = function (nested, paren_less, result) {
|
|
88
|
-
if (paren_less == ParenLess.kNo) {
|
|
89
|
-
result += nested === Nested.kYes ? '(' : 'calc(';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var values = this.numericValues();
|
|
93
|
-
result = values[0].buildCSSText(Nested.kYes, ParenLess.kNo, result);
|
|
94
|
-
|
|
95
|
-
for (var i = 1; i < values.length; i++) {
|
|
96
|
-
var arg = values[i];
|
|
97
|
-
|
|
98
|
-
if (arg.getType() === CSSStyleValueType.kNegateType) {
|
|
99
|
-
result += ' - ';
|
|
100
|
-
result = arg.value.buildCSSText(Nested.kYes, ParenLess.kNo, result);
|
|
101
|
-
} else {
|
|
102
|
-
result += ' + ';
|
|
103
|
-
result = arg.buildCSSText(Nested.kYes, ParenLess.kNo, result);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (paren_less === ParenLess.kNo) {
|
|
108
|
-
result += ')';
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return result;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
return CSSMathSum;
|
|
115
|
-
}(CSSMathVariadic);
|
|
116
|
-
|
|
117
|
-
export { CSSMathSum };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CSSNumericValue } from './CSSNumericValue';
|
|
2
|
-
/**
|
|
3
|
-
* The CSSMathValue interface of the CSS_Object_Model a base class for classes representing complex numeric values.
|
|
4
|
-
*
|
|
5
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathValue
|
|
6
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_value.idl
|
|
7
|
-
*/
|
|
8
|
-
export declare abstract class CSSMathValue extends CSSNumericValue {
|
|
9
|
-
abstract operator: string;
|
|
10
|
-
isUnitValue(): boolean;
|
|
11
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
|
-
import { CSSNumericValue } from './CSSNumericValue';
|
|
3
|
-
/**
|
|
4
|
-
* The CSSMathValue interface of the CSS_Object_Model a base class for classes representing complex numeric values.
|
|
5
|
-
*
|
|
6
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathValue
|
|
7
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_value.idl
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var CSSMathValue =
|
|
11
|
-
/** @class */
|
|
12
|
-
function (_super) {
|
|
13
|
-
__extends(CSSMathValue, _super);
|
|
14
|
-
|
|
15
|
-
function CSSMathValue() {
|
|
16
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
17
|
-
} // From CSSNumericValue
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
CSSMathValue.prototype.isUnitValue = function () {
|
|
21
|
-
return false;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return CSSMathValue;
|
|
25
|
-
}(CSSNumericValue);
|
|
26
|
-
|
|
27
|
-
export { CSSMathValue };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CSSMathValue } from './CSSMathValue';
|
|
2
|
-
import type { CSSNumericValue, CSSNumericValueType } from '.';
|
|
3
|
-
export declare function typeCheck(values: CSSNumericValue[], op: Function, error: boolean): CSSNumericValueType;
|
|
4
|
-
export declare abstract class CSSMathVariadic extends CSSMathValue {
|
|
5
|
-
values: CSSNumericValue[];
|
|
6
|
-
constructor(values: CSSNumericValue[], type: CSSNumericValueType);
|
|
7
|
-
numericValues(): CSSNumericValue[];
|
|
8
|
-
equals(other: CSSNumericValue): any;
|
|
9
|
-
}
|