@antv/g 5.0.23-alpha.0 → 5.0.23-alpha.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.
Files changed (56) hide show
  1. package/dist/index.umd.min.js +2 -2
  2. package/es/css/cssom/CSSKeywordValue.d.ts +1 -1
  3. package/es/css/cssom/CSSNumericSumValue.d.ts +1 -1
  4. package/es/css/cssom/CSSNumericValue.d.ts +108 -4
  5. package/es/css/cssom/CSSNumericValue.js +908 -5
  6. package/es/css/cssom/CSSNumericValueType.d.ts +1 -1
  7. package/es/css/cssom/CSSNumericValueType.js +1 -1
  8. package/es/css/cssom/CSSTransformValue.d.ts +1 -1
  9. package/es/css/cssom/index.d.ts +0 -9
  10. package/es/css/cssom/index.js +1 -10
  11. package/lib/css/cssom/CSSKeywordValue.d.ts +1 -1
  12. package/lib/css/cssom/CSSNumericSumValue.d.ts +1 -1
  13. package/lib/css/cssom/CSSNumericValue.d.ts +108 -4
  14. package/lib/css/cssom/CSSNumericValue.js +965 -52
  15. package/lib/css/cssom/CSSNumericValueType.d.ts +1 -1
  16. package/lib/css/cssom/CSSNumericValueType.js +59 -59
  17. package/lib/css/cssom/CSSTransformValue.d.ts +1 -1
  18. package/lib/css/cssom/index.d.ts +0 -9
  19. package/lib/css/cssom/index.js +0 -117
  20. package/package.json +3 -3
  21. package/es/css/cssom/CSSMathInvert.d.ts +0 -14
  22. package/es/css/cssom/CSSMathInvert.js +0 -84
  23. package/es/css/cssom/CSSMathMax.d.ts +0 -17
  24. package/es/css/cssom/CSSMathMax.js +0 -118
  25. package/es/css/cssom/CSSMathMin.d.ts +0 -17
  26. package/es/css/cssom/CSSMathMin.js +0 -119
  27. package/es/css/cssom/CSSMathNegate.d.ts +0 -14
  28. package/es/css/cssom/CSSMathNegate.js +0 -80
  29. package/es/css/cssom/CSSMathProduct.d.ts +0 -16
  30. package/es/css/cssom/CSSMathProduct.js +0 -109
  31. package/es/css/cssom/CSSMathSum.d.ts +0 -17
  32. package/es/css/cssom/CSSMathSum.js +0 -117
  33. package/es/css/cssom/CSSMathValue.d.ts +0 -11
  34. package/es/css/cssom/CSSMathValue.js +0 -27
  35. package/es/css/cssom/CSSMathVariadic.d.ts +0 -9
  36. package/es/css/cssom/CSSMathVariadic.js +0 -44
  37. package/es/css/cssom/CSSUnitValue.d.ts +0 -33
  38. package/es/css/cssom/CSSUnitValue.js +0 -252
  39. package/lib/css/cssom/CSSMathInvert.d.ts +0 -14
  40. package/lib/css/cssom/CSSMathInvert.js +0 -94
  41. package/lib/css/cssom/CSSMathMax.d.ts +0 -17
  42. package/lib/css/cssom/CSSMathMax.js +0 -128
  43. package/lib/css/cssom/CSSMathMin.d.ts +0 -17
  44. package/lib/css/cssom/CSSMathMin.js +0 -128
  45. package/lib/css/cssom/CSSMathNegate.d.ts +0 -14
  46. package/lib/css/cssom/CSSMathNegate.js +0 -89
  47. package/lib/css/cssom/CSSMathProduct.d.ts +0 -16
  48. package/lib/css/cssom/CSSMathProduct.js +0 -119
  49. package/lib/css/cssom/CSSMathSum.d.ts +0 -17
  50. package/lib/css/cssom/CSSMathSum.js +0 -129
  51. package/lib/css/cssom/CSSMathValue.d.ts +0 -11
  52. package/lib/css/cssom/CSSMathValue.js +0 -35
  53. package/lib/css/cssom/CSSMathVariadic.d.ts +0 -9
  54. package/lib/css/cssom/CSSMathVariadic.js +0 -55
  55. package/lib/css/cssom/CSSUnitValue.d.ts +0 -33
  56. package/lib/css/cssom/CSSUnitValue.js +0 -267
@@ -1,4 +1,4 @@
1
- import { UnitType } from '.';
1
+ import { UnitType } from './types';
2
2
  export declare enum BaseType {
3
3
  kLength = 0,
4
4
  kAngle = 1,
@@ -9,7 +9,7 @@ exports.unitTypeToBaseType = unitTypeToBaseType;
9
9
 
10
10
  var _utils = require("../../utils");
11
11
 
12
- var _ = require(".");
12
+ var _types = require("./types");
13
13
 
14
14
  // https://drafts.css-houdini.org/css-typed-om/#enumdef-cssnumericbasetype
15
15
  var BaseType;
@@ -27,76 +27,76 @@ exports.BaseType = BaseType;
27
27
  })(BaseType || (exports.BaseType = BaseType = {}));
28
28
 
29
29
  function unitTypeToBaseType(unit) {
30
- (0, _utils.DCHECK_NE)(unit, _.UnitType.kNumber);
30
+ (0, _utils.DCHECK_NE)(unit, _types.UnitType.kNumber);
31
31
 
32
32
  switch (unit) {
33
- case _.UnitType.kEms:
34
- case _.UnitType.kExs:
35
- case _.UnitType.kPixels:
36
- case _.UnitType.kCentimeters:
37
- case _.UnitType.kMillimeters:
38
- case _.UnitType.kQuarterMillimeters:
39
- case _.UnitType.kInches:
40
- case _.UnitType.kPoints:
41
- case _.UnitType.kPicas:
42
- case _.UnitType.kUserUnits:
43
- case _.UnitType.kViewportWidth:
44
- case _.UnitType.kViewportHeight:
45
- case _.UnitType.kViewportInlineSize:
46
- case _.UnitType.kViewportBlockSize:
47
- case _.UnitType.kViewportMin:
48
- case _.UnitType.kViewportMax:
49
- case _.UnitType.kSmallViewportWidth:
50
- case _.UnitType.kSmallViewportHeight:
51
- case _.UnitType.kSmallViewportInlineSize:
52
- case _.UnitType.kSmallViewportBlockSize:
53
- case _.UnitType.kSmallViewportMin:
54
- case _.UnitType.kSmallViewportMax:
55
- case _.UnitType.kLargeViewportWidth:
56
- case _.UnitType.kLargeViewportHeight:
57
- case _.UnitType.kLargeViewportInlineSize:
58
- case _.UnitType.kLargeViewportBlockSize:
59
- case _.UnitType.kLargeViewportMin:
60
- case _.UnitType.kLargeViewportMax:
61
- case _.UnitType.kDynamicViewportWidth:
62
- case _.UnitType.kDynamicViewportHeight:
63
- case _.UnitType.kDynamicViewportInlineSize:
64
- case _.UnitType.kDynamicViewportBlockSize:
65
- case _.UnitType.kDynamicViewportMin:
66
- case _.UnitType.kDynamicViewportMax:
67
- case _.UnitType.kContainerWidth:
68
- case _.UnitType.kContainerHeight:
69
- case _.UnitType.kContainerInlineSize:
70
- case _.UnitType.kContainerBlockSize:
71
- case _.UnitType.kContainerMin:
72
- case _.UnitType.kContainerMax:
73
- case _.UnitType.kRems:
74
- case _.UnitType.kChs:
33
+ case _types.UnitType.kEms:
34
+ case _types.UnitType.kExs:
35
+ case _types.UnitType.kPixels:
36
+ case _types.UnitType.kCentimeters:
37
+ case _types.UnitType.kMillimeters:
38
+ case _types.UnitType.kQuarterMillimeters:
39
+ case _types.UnitType.kInches:
40
+ case _types.UnitType.kPoints:
41
+ case _types.UnitType.kPicas:
42
+ case _types.UnitType.kUserUnits:
43
+ case _types.UnitType.kViewportWidth:
44
+ case _types.UnitType.kViewportHeight:
45
+ case _types.UnitType.kViewportInlineSize:
46
+ case _types.UnitType.kViewportBlockSize:
47
+ case _types.UnitType.kViewportMin:
48
+ case _types.UnitType.kViewportMax:
49
+ case _types.UnitType.kSmallViewportWidth:
50
+ case _types.UnitType.kSmallViewportHeight:
51
+ case _types.UnitType.kSmallViewportInlineSize:
52
+ case _types.UnitType.kSmallViewportBlockSize:
53
+ case _types.UnitType.kSmallViewportMin:
54
+ case _types.UnitType.kSmallViewportMax:
55
+ case _types.UnitType.kLargeViewportWidth:
56
+ case _types.UnitType.kLargeViewportHeight:
57
+ case _types.UnitType.kLargeViewportInlineSize:
58
+ case _types.UnitType.kLargeViewportBlockSize:
59
+ case _types.UnitType.kLargeViewportMin:
60
+ case _types.UnitType.kLargeViewportMax:
61
+ case _types.UnitType.kDynamicViewportWidth:
62
+ case _types.UnitType.kDynamicViewportHeight:
63
+ case _types.UnitType.kDynamicViewportInlineSize:
64
+ case _types.UnitType.kDynamicViewportBlockSize:
65
+ case _types.UnitType.kDynamicViewportMin:
66
+ case _types.UnitType.kDynamicViewportMax:
67
+ case _types.UnitType.kContainerWidth:
68
+ case _types.UnitType.kContainerHeight:
69
+ case _types.UnitType.kContainerInlineSize:
70
+ case _types.UnitType.kContainerBlockSize:
71
+ case _types.UnitType.kContainerMin:
72
+ case _types.UnitType.kContainerMax:
73
+ case _types.UnitType.kRems:
74
+ case _types.UnitType.kChs:
75
75
  return BaseType.kLength;
76
76
 
77
- case _.UnitType.kMilliseconds:
78
- case _.UnitType.kSeconds:
77
+ case _types.UnitType.kMilliseconds:
78
+ case _types.UnitType.kSeconds:
79
79
  return BaseType.kTime;
80
80
 
81
- case _.UnitType.kDegrees:
82
- case _.UnitType.kRadians:
83
- case _.UnitType.kGradians:
84
- case _.UnitType.kTurns:
81
+ case _types.UnitType.kDegrees:
82
+ case _types.UnitType.kRadians:
83
+ case _types.UnitType.kGradians:
84
+ case _types.UnitType.kTurns:
85
85
  return BaseType.kAngle;
86
86
 
87
- case _.UnitType.kHertz:
88
- case _.UnitType.kKilohertz:
87
+ case _types.UnitType.kHertz:
88
+ case _types.UnitType.kKilohertz:
89
89
  return BaseType.kFrequency;
90
90
 
91
- case _.UnitType.kDotsPerPixel:
92
- case _.UnitType.kDotsPerInch:
93
- case _.UnitType.kDotsPerCentimeter:
91
+ case _types.UnitType.kDotsPerPixel:
92
+ case _types.UnitType.kDotsPerInch:
93
+ case _types.UnitType.kDotsPerCentimeter:
94
94
  return BaseType.kResolution;
95
95
 
96
- case _.UnitType.kFraction:
96
+ case _types.UnitType.kFraction:
97
97
  return BaseType.kFlex;
98
98
 
99
- case _.UnitType.kPercentage:
99
+ case _types.UnitType.kPercentage:
100
100
  return BaseType.kPercent;
101
101
 
102
102
  default:
@@ -139,7 +139,7 @@ var CSSNumericValueType =
139
139
  function () {
140
140
  function CSSNumericValueType(unit, exponent) {
141
141
  if (unit === void 0) {
142
- unit = _.UnitType.kNumber;
142
+ unit = _types.UnitType.kNumber;
143
143
  }
144
144
 
145
145
  if (exponent === void 0) {
@@ -152,7 +152,7 @@ function () {
152
152
  this.hasPercentHint = false;
153
153
  this.exponents = new Array(BaseType.kNumBaseTypes).fill(0);
154
154
 
155
- if (unit !== _.UnitType.kNumber) {
155
+ if (unit !== _types.UnitType.kNumber) {
156
156
  this.setExponent(unitTypeToBaseType(unit), exponent);
157
157
  }
158
158
  }
@@ -1,4 +1,4 @@
1
- import type { Nested, ParenLess } from '.';
1
+ import type { Nested, ParenLess } from './types';
2
2
  import { CSSStyleValue, CSSStyleValueType } from './CSSStyleValue';
3
3
  import type { CSSTransformComponent } from './CSSTransformComponent';
4
4
  /**
@@ -10,14 +10,6 @@ export * from './types';
10
10
  export * from './CSSColorValue';
11
11
  export * from './CSSKeywordValue';
12
12
  export * from './CSSMathOperator';
13
- export * from './CSSMathInvert';
14
- export * from './CSSMathMax';
15
- export * from './CSSMathMin';
16
- export * from './CSSMathNegate';
17
- export * from './CSSMathProduct';
18
- export * from './CSSMathSum';
19
- export * from './CSSMathValue';
20
- export * from './CSSMathVariadic';
21
13
  export * from './CSSNumericSumValue';
22
14
  export * from './CSSNumericValue';
23
15
  export * from './CSSNumericValueType';
@@ -26,4 +18,3 @@ export * from './CSSGradientValue';
26
18
  export * from './CSSStyleValue';
27
19
  export * from './CSSTransformValue';
28
20
  export * from './CSSTranslate';
29
- export * from './CSSUnitValue';
@@ -56,110 +56,6 @@ Object.keys(_CSSMathOperator).forEach(function (key) {
56
56
  });
57
57
  });
58
58
 
59
- var _CSSMathInvert = require("./CSSMathInvert");
60
-
61
- Object.keys(_CSSMathInvert).forEach(function (key) {
62
- if (key === "default" || key === "__esModule") return;
63
- if (key in exports && exports[key] === _CSSMathInvert[key]) return;
64
- Object.defineProperty(exports, key, {
65
- enumerable: true,
66
- get: function get() {
67
- return _CSSMathInvert[key];
68
- }
69
- });
70
- });
71
-
72
- var _CSSMathMax = require("./CSSMathMax");
73
-
74
- Object.keys(_CSSMathMax).forEach(function (key) {
75
- if (key === "default" || key === "__esModule") return;
76
- if (key in exports && exports[key] === _CSSMathMax[key]) return;
77
- Object.defineProperty(exports, key, {
78
- enumerable: true,
79
- get: function get() {
80
- return _CSSMathMax[key];
81
- }
82
- });
83
- });
84
-
85
- var _CSSMathMin = require("./CSSMathMin");
86
-
87
- Object.keys(_CSSMathMin).forEach(function (key) {
88
- if (key === "default" || key === "__esModule") return;
89
- if (key in exports && exports[key] === _CSSMathMin[key]) return;
90
- Object.defineProperty(exports, key, {
91
- enumerable: true,
92
- get: function get() {
93
- return _CSSMathMin[key];
94
- }
95
- });
96
- });
97
-
98
- var _CSSMathNegate = require("./CSSMathNegate");
99
-
100
- Object.keys(_CSSMathNegate).forEach(function (key) {
101
- if (key === "default" || key === "__esModule") return;
102
- if (key in exports && exports[key] === _CSSMathNegate[key]) return;
103
- Object.defineProperty(exports, key, {
104
- enumerable: true,
105
- get: function get() {
106
- return _CSSMathNegate[key];
107
- }
108
- });
109
- });
110
-
111
- var _CSSMathProduct = require("./CSSMathProduct");
112
-
113
- Object.keys(_CSSMathProduct).forEach(function (key) {
114
- if (key === "default" || key === "__esModule") return;
115
- if (key in exports && exports[key] === _CSSMathProduct[key]) return;
116
- Object.defineProperty(exports, key, {
117
- enumerable: true,
118
- get: function get() {
119
- return _CSSMathProduct[key];
120
- }
121
- });
122
- });
123
-
124
- var _CSSMathSum = require("./CSSMathSum");
125
-
126
- Object.keys(_CSSMathSum).forEach(function (key) {
127
- if (key === "default" || key === "__esModule") return;
128
- if (key in exports && exports[key] === _CSSMathSum[key]) return;
129
- Object.defineProperty(exports, key, {
130
- enumerable: true,
131
- get: function get() {
132
- return _CSSMathSum[key];
133
- }
134
- });
135
- });
136
-
137
- var _CSSMathValue = require("./CSSMathValue");
138
-
139
- Object.keys(_CSSMathValue).forEach(function (key) {
140
- if (key === "default" || key === "__esModule") return;
141
- if (key in exports && exports[key] === _CSSMathValue[key]) return;
142
- Object.defineProperty(exports, key, {
143
- enumerable: true,
144
- get: function get() {
145
- return _CSSMathValue[key];
146
- }
147
- });
148
- });
149
-
150
- var _CSSMathVariadic = require("./CSSMathVariadic");
151
-
152
- Object.keys(_CSSMathVariadic).forEach(function (key) {
153
- if (key === "default" || key === "__esModule") return;
154
- if (key in exports && exports[key] === _CSSMathVariadic[key]) return;
155
- Object.defineProperty(exports, key, {
156
- enumerable: true,
157
- get: function get() {
158
- return _CSSMathVariadic[key];
159
- }
160
- });
161
- });
162
-
163
59
  var _CSSNumericSumValue = require("./CSSNumericSumValue");
164
60
 
165
61
  Object.keys(_CSSNumericSumValue).forEach(function (key) {
@@ -262,17 +158,4 @@ Object.keys(_CSSTranslate).forEach(function (key) {
262
158
  return _CSSTranslate[key];
263
159
  }
264
160
  });
265
- });
266
-
267
- var _CSSUnitValue = require("./CSSUnitValue");
268
-
269
- Object.keys(_CSSUnitValue).forEach(function (key) {
270
- if (key === "default" || key === "__esModule") return;
271
- if (key in exports && exports[key] === _CSSUnitValue[key]) return;
272
- Object.defineProperty(exports, key, {
273
- enumerable: true,
274
- get: function get() {
275
- return _CSSUnitValue[key];
276
- }
277
- });
278
161
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.23-alpha.0",
3
+ "version": "5.0.23-alpha.2",
4
4
  "description": "A core module including ECS and DI container.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://github.com/antvis/g#readme",
40
40
  "dependencies": {
41
- "@antv/g-math": "^1.0.20-alpha.0",
41
+ "@antv/g-math": "^1.0.20-alpha.2",
42
42
  "@antv/util": "^3.0.0",
43
43
  "@types/offscreencanvas": "^2019.6.4",
44
44
  "d3-color": "^1.4.0",
@@ -52,5 +52,5 @@
52
52
  "scripts": {
53
53
  "umd": "webpack"
54
54
  },
55
- "gitHead": "b382a7445d9fa350107dba29d20eb7e6d6da9e79"
55
+ "gitHead": "af1c0b90600f8b68d1008877bc98aefa308fefa8"
56
56
  }
@@ -1,14 +0,0 @@
1
- import { CSSMathValue } from './CSSMathValue';
2
- import type { CSSNumericSumValue, CSSNumericValue } from '.';
3
- import { CSSNumericValueType, CSSStyleValueType, Nested, ParenLess } from '.';
4
- export declare class CSSMathInvert extends CSSMathValue {
5
- private value;
6
- static create(value: CSSNumericValue): CSSMathInvert;
7
- constructor(value: CSSNumericValue, type: CSSNumericValueType);
8
- operator: string;
9
- clone(): CSSMathInvert;
10
- getType(): CSSStyleValueType;
11
- equals(other: CSSNumericValue): any;
12
- sumValue(): CSSNumericSumValue;
13
- buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
14
- }
@@ -1,84 +0,0 @@
1
- import { __extends } from "tslib";
2
- import { CSSMathValue } from './CSSMathValue';
3
- import { CSSNumericValueType, CSSStyleValueType, Nested, ParenLess } from '.';
4
-
5
- var CSSMathInvert =
6
- /** @class */
7
- function (_super) {
8
- __extends(CSSMathInvert, _super);
9
-
10
- function CSSMathInvert(value, type) {
11
- var _this = _super.call(this, type) || this;
12
-
13
- _this.value = value;
14
- _this.operator = 'invert';
15
- return _this;
16
- }
17
-
18
- CSSMathInvert.create = function (value) {
19
- var type = CSSNumericValueType.negateExponents(value.type_);
20
- return new CSSMathInvert(value, type);
21
- };
22
-
23
- CSSMathInvert.prototype.clone = function () {
24
- return new CSSMathInvert(this.value, this.type_);
25
- };
26
-
27
- CSSMathInvert.prototype.getType = function () {
28
- return CSSStyleValueType.kInvertType;
29
- };
30
-
31
- CSSMathInvert.prototype.equals = function (other) {
32
- if (other.getType() !== CSSStyleValueType.kInvertType) {
33
- return false;
34
- } // We can safely cast here as we know 'other' has the same type as us.
35
-
36
-
37
- var other_invert = other;
38
- return this.value.equals(other_invert.value);
39
- };
40
-
41
- CSSMathInvert.prototype.sumValue = function () {
42
- var sum = this.value.sumValue();
43
-
44
- if (sum.length === 0 || sum.length !== 1 || sum[0].value === 0) {
45
- return null;
46
- }
47
-
48
- Object.keys(sum[0].units).forEach(function (key) {
49
- sum[0].units[key] *= -1;
50
- });
51
- sum[0].value = 1.0 / sum[0].value;
52
- return sum;
53
- }; // toCalcExpressionNode(): CSSMathExpressionNode {
54
- // const right_side = this.value.toCalcExpressionNode();
55
- // if (!right_side) {
56
- // return null;
57
- // }
58
- // // return CSSMathExpressionOperation::CreateArithmeticOperation(
59
- // // CSSMathExpressionNumericLiteral::Create(
60
- // // 1, UnitType.kNumber),
61
- // // right_side, CSSMathOperator.kDivide);
62
- // return null;
63
- // }
64
-
65
-
66
- CSSMathInvert.prototype.buildCSSText = function (nested, paren_less, result) {
67
- if (paren_less == ParenLess.kNo) {
68
- result += nested === Nested.kYes ? '(' : 'calc(';
69
- }
70
-
71
- result += '1 / ';
72
- result = this.value.buildCSSText(Nested.kYes, ParenLess.kNo, result);
73
-
74
- if (paren_less === ParenLess.kNo) {
75
- result += ')';
76
- }
77
-
78
- return result;
79
- };
80
-
81
- return CSSMathInvert;
82
- }(CSSMathValue);
83
-
84
- export { CSSMathInvert };
@@ -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/CSSMathMax
6
- */
7
- import { CSSMathVariadic } from './CSSMathVariadic';
8
- import type { CSSNumericValue, CSSNumericSumValue } from '.';
9
- import { Nested, ParenLess, CSSStyleValueType } from '.';
10
- export declare class CSSMathMax extends CSSMathVariadic {
11
- static create(values: CSSNumericValue[]): CSSMathMax;
12
- operator: string;
13
- clone(): CSSMathMax;
14
- getType(): CSSStyleValueType;
15
- sumValue(): CSSNumericSumValue;
16
- buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
17
- }
@@ -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
- }