@antv/g 5.0.22 → 5.0.23-alpha.4

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 (156) hide show
  1. package/dist/index.umd.min.js +3 -3
  2. package/es/AbstractRenderer.js +5 -0
  3. package/es/camera/Camera.js +2 -2
  4. package/es/css/cssom/CSSKeywordValue.d.ts +1 -1
  5. package/es/css/cssom/CSSNumericSumValue.d.ts +1 -1
  6. package/es/css/cssom/CSSNumericValue.d.ts +139 -4
  7. package/es/css/cssom/CSSNumericValue.js +1164 -5
  8. package/es/css/cssom/CSSTransformValue.d.ts +1 -1
  9. package/es/css/cssom/index.d.ts +0 -10
  10. package/es/css/cssom/index.js +1 -11
  11. package/es/css/parser/color.js +1 -1
  12. package/es/css/parser/dimension.js +1 -2
  13. package/es/css/parser/numeric.js +1 -1
  14. package/es/css/parser/path.d.ts +2 -2
  15. package/es/css/parser/path.js +1 -1
  16. package/es/css/parser/points.js +1 -1
  17. package/es/css/parser/transform-origin.js +1 -1
  18. package/es/css/properties/CSSPropertyPath.d.ts +14 -2
  19. package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  20. package/es/css/properties/CSSPropertyTransform.js +1 -2
  21. package/es/display-objects/DisplayObject.js +4 -5
  22. package/es/display-objects/Path.d.ts +15 -15
  23. package/es/display-objects/Path.js +1 -1
  24. package/es/display-objects/Polygon.d.ts +8 -1
  25. package/es/display-objects/Polyline.d.ts +7 -5
  26. package/es/dom/Document.js +2 -2
  27. package/es/dom/Element.js +1 -2
  28. package/es/dom/EventTarget.js +1 -1
  29. package/es/dom/FederatedTouchEvent.d.ts +5 -3
  30. package/es/plugins/CullingPlugin.d.ts +0 -1
  31. package/es/plugins/CullingPlugin.js +3 -8
  32. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  33. package/es/plugins/DirtyCheckPlugin.js +9 -8
  34. package/es/plugins/EventPlugin.d.ts +1 -1
  35. package/es/plugins/EventPlugin.js +163 -148
  36. package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
  37. package/es/plugins/PrepareRendererPlugin.js +15 -16
  38. package/es/services/EventService.d.ts +8 -0
  39. package/es/services/EventService.js +274 -20
  40. package/es/services/RenderingService.d.ts +17 -16
  41. package/es/services/RenderingService.js +18 -17
  42. package/es/services/SceneGraphService.js +1 -1
  43. package/es/services/aabb/PathUpdater.d.ts +3 -3
  44. package/es/services/aabb/PolylineUpdater.d.ts +3 -3
  45. package/es/services/aabb/RectUpdater.js +1 -1
  46. package/es/types.d.ts +5 -3
  47. package/es/utils/assert.d.ts +6 -0
  48. package/es/utils/assert.js +18 -0
  49. package/es/utils/event.d.ts +18 -16
  50. package/es/utils/hooks.d.ts +280 -0
  51. package/es/utils/hooks.js +753 -0
  52. package/es/utils/index.d.ts +1 -0
  53. package/es/utils/index.js +2 -1
  54. package/es/utils/math.d.ts +1 -0
  55. package/es/utils/math.js +13 -2
  56. package/es/utils/string.d.ts +1 -0
  57. package/es/utils/string.js +8 -0
  58. package/es/utils/text.js +2 -1
  59. package/lib/AbstractRenderer.js +5 -0
  60. package/lib/camera/Camera.js +4 -4
  61. package/lib/css/cssom/CSSKeywordValue.d.ts +1 -1
  62. package/lib/css/cssom/CSSNumericSumValue.d.ts +1 -1
  63. package/lib/css/cssom/CSSNumericValue.d.ts +139 -4
  64. package/lib/css/cssom/CSSNumericValue.js +1222 -52
  65. package/lib/css/cssom/CSSTransformValue.d.ts +1 -1
  66. package/lib/css/cssom/index.d.ts +0 -10
  67. package/lib/css/cssom/index.js +0 -130
  68. package/lib/css/parser/color.js +5 -5
  69. package/lib/css/parser/dimension.js +1 -3
  70. package/lib/css/parser/numeric.js +3 -3
  71. package/lib/css/parser/path.d.ts +2 -2
  72. package/lib/css/parser/path.js +4 -4
  73. package/lib/css/parser/points.js +2 -2
  74. package/lib/css/parser/transform-origin.js +2 -2
  75. package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
  76. package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  77. package/lib/css/properties/CSSPropertyTransform.js +0 -2
  78. package/lib/display-objects/DisplayObject.js +7 -9
  79. package/lib/display-objects/Path.d.ts +15 -15
  80. package/lib/display-objects/Path.js +3 -3
  81. package/lib/display-objects/Polygon.d.ts +8 -1
  82. package/lib/display-objects/Polyline.d.ts +7 -5
  83. package/lib/dom/Document.js +2 -2
  84. package/lib/dom/Element.js +1 -3
  85. package/lib/dom/EventTarget.js +9 -9
  86. package/lib/dom/FederatedTouchEvent.d.ts +5 -3
  87. package/lib/plugins/CullingPlugin.d.ts +0 -1
  88. package/lib/plugins/CullingPlugin.js +3 -7
  89. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  90. package/lib/plugins/DirtyCheckPlugin.js +10 -8
  91. package/lib/plugins/EventPlugin.d.ts +1 -1
  92. package/lib/plugins/EventPlugin.js +172 -156
  93. package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
  94. package/lib/plugins/PrepareRendererPlugin.js +14 -14
  95. package/lib/services/EventService.d.ts +8 -0
  96. package/lib/services/EventService.js +274 -19
  97. package/lib/services/RenderingService.d.ts +17 -16
  98. package/lib/services/RenderingService.js +19 -18
  99. package/lib/services/SceneGraphService.js +3 -3
  100. package/lib/services/aabb/PathUpdater.d.ts +3 -3
  101. package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
  102. package/lib/services/aabb/RectUpdater.js +3 -3
  103. package/lib/types.d.ts +5 -3
  104. package/lib/utils/assert.d.ts +6 -0
  105. package/lib/utils/assert.js +30 -0
  106. package/lib/utils/event.d.ts +18 -16
  107. package/lib/utils/hooks.d.ts +280 -0
  108. package/lib/utils/hooks.js +759 -0
  109. package/lib/utils/index.d.ts +1 -0
  110. package/lib/utils/index.js +13 -0
  111. package/lib/utils/math.d.ts +1 -0
  112. package/lib/utils/math.js +17 -4
  113. package/lib/utils/string.d.ts +1 -0
  114. package/lib/utils/string.js +11 -0
  115. package/lib/utils/text.js +5 -3
  116. package/package.json +4 -7
  117. package/es/css/cssom/CSSMathInvert.d.ts +0 -14
  118. package/es/css/cssom/CSSMathInvert.js +0 -84
  119. package/es/css/cssom/CSSMathMax.d.ts +0 -17
  120. package/es/css/cssom/CSSMathMax.js +0 -118
  121. package/es/css/cssom/CSSMathMin.d.ts +0 -17
  122. package/es/css/cssom/CSSMathMin.js +0 -119
  123. package/es/css/cssom/CSSMathNegate.d.ts +0 -14
  124. package/es/css/cssom/CSSMathNegate.js +0 -80
  125. package/es/css/cssom/CSSMathProduct.d.ts +0 -16
  126. package/es/css/cssom/CSSMathProduct.js +0 -109
  127. package/es/css/cssom/CSSMathSum.d.ts +0 -17
  128. package/es/css/cssom/CSSMathSum.js +0 -117
  129. package/es/css/cssom/CSSMathValue.d.ts +0 -11
  130. package/es/css/cssom/CSSMathValue.js +0 -27
  131. package/es/css/cssom/CSSMathVariadic.d.ts +0 -9
  132. package/es/css/cssom/CSSMathVariadic.js +0 -44
  133. package/es/css/cssom/CSSNumericValueType.d.ts +0 -33
  134. package/es/css/cssom/CSSNumericValueType.js +0 -259
  135. package/es/css/cssom/CSSUnitValue.d.ts +0 -33
  136. package/es/css/cssom/CSSUnitValue.js +0 -252
  137. package/lib/css/cssom/CSSMathInvert.d.ts +0 -14
  138. package/lib/css/cssom/CSSMathInvert.js +0 -94
  139. package/lib/css/cssom/CSSMathMax.d.ts +0 -17
  140. package/lib/css/cssom/CSSMathMax.js +0 -128
  141. package/lib/css/cssom/CSSMathMin.d.ts +0 -17
  142. package/lib/css/cssom/CSSMathMin.js +0 -128
  143. package/lib/css/cssom/CSSMathNegate.d.ts +0 -14
  144. package/lib/css/cssom/CSSMathNegate.js +0 -89
  145. package/lib/css/cssom/CSSMathProduct.d.ts +0 -16
  146. package/lib/css/cssom/CSSMathProduct.js +0 -119
  147. package/lib/css/cssom/CSSMathSum.d.ts +0 -17
  148. package/lib/css/cssom/CSSMathSum.js +0 -129
  149. package/lib/css/cssom/CSSMathValue.d.ts +0 -11
  150. package/lib/css/cssom/CSSMathValue.js +0 -35
  151. package/lib/css/cssom/CSSMathVariadic.d.ts +0 -9
  152. package/lib/css/cssom/CSSMathVariadic.js +0 -55
  153. package/lib/css/cssom/CSSNumericValueType.d.ts +0 -33
  154. package/lib/css/cssom/CSSNumericValueType.js +0 -272
  155. package/lib/css/cssom/CSSUnitValue.d.ts +0 -33
  156. package/lib/css/cssom/CSSUnitValue.js +0 -267
@@ -1,252 +0,0 @@
1
- /**
2
- * The CSSUnitValue interface of the CSS_Object_Model represents values that contain a single unit type.
3
- * For example, "42px" would be represented by a CSSNumericValue.
4
- *
5
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSUnitValue
6
- */
7
- import { __extends } from "tslib";
8
- import { DCHECK } from '../../utils';
9
- import { CSSMathInvert } from './CSSMathInvert';
10
- import { CSSNumericValue } from './CSSNumericValue';
11
- import { CSSNumericValueType } from './CSSNumericValueType';
12
- import { CSSStyleValueType, UnitType } from '.';
13
- import { CSSStyleValue } from './CSSStyleValue';
14
- /**
15
- * Represents numeric values that can be expressed as a single number plus a
16
- * unit (or a naked number or percentage).
17
- * @see https://drafts.css-houdini.org/css-typed-om/#cssunitvalue
18
- */
19
-
20
- var CSSUnitValue =
21
- /** @class */
22
- function (_super) {
23
- __extends(CSSUnitValue, _super);
24
-
25
- function CSSUnitValue(value, unitOrName) {
26
- if (unitOrName === void 0) {
27
- unitOrName = UnitType.kNumber;
28
- }
29
-
30
- var _this = this;
31
-
32
- var unit;
33
-
34
- if (typeof unitOrName === 'string') {
35
- unit = CSSUnitValue.unitFromName(unitOrName);
36
- } else {
37
- unit = unitOrName;
38
- }
39
-
40
- DCHECK(CSSUnitValue.isValidUnit(unit));
41
- _this = _super.call(this, new CSSNumericValueType(unit)) || this;
42
- _this.unit = unit;
43
- _this.value = value;
44
- return _this;
45
- } // static fromCSSValue(value: CSSNumericLiteralValue) {
46
- // let unit = value.type;
47
- // if (unit === UnitType.kInteger) unit = UnitType.kNumber;
48
- // if (!this.isValidUnit(unit)) return null;
49
- // return new CSSUnitValue(value.getDoubleValue(), unit);
50
- // }
51
-
52
-
53
- CSSUnitValue.toCanonicalUnit = function (unit) {
54
- return this.canonicalUnitTypeForCategory(this.unitTypeToUnitCategory(unit));
55
- };
56
-
57
- CSSUnitValue.toCanonicalUnitIfPossible = function (unit) {
58
- var canonical_unit = this.toCanonicalUnit(unit);
59
- if (canonical_unit === UnitType.kUnknown) return unit;
60
- return canonical_unit;
61
- };
62
-
63
- CSSUnitValue.formatInfinityOrNaN = function (number, suffix) {
64
- if (suffix === void 0) {
65
- suffix = '';
66
- }
67
-
68
- var result = '';
69
-
70
- if (!Number.isFinite(number)) {
71
- if (number > 0) result = 'infinity';else result = '-infinity';
72
- } else {
73
- DCHECK(Number.isNaN(number));
74
- result = 'NaN';
75
- }
76
-
77
- return result += suffix;
78
- };
79
-
80
- CSSUnitValue.formatNumber = function (number, suffix) {
81
- if (suffix === void 0) {
82
- suffix = '';
83
- }
84
-
85
- return number + suffix;
86
- };
87
-
88
- CSSUnitValue.prototype.clone = function () {
89
- return new CSSUnitValue(this.value, this.unit);
90
- };
91
-
92
- CSSUnitValue.prototype.convertTo = function (target_unit) {
93
- if (this.unit === target_unit) {
94
- return new CSSUnitValue(this.value, this.unit);
95
- } // Instead of defining the scale factors for every unit to every other unit,
96
- // we simply convert to the canonical unit and back since we already have
97
- // the scale factors for canonical units.
98
-
99
-
100
- var canonical_unit = CSSUnitValue.toCanonicalUnit(this.unit);
101
-
102
- if (canonical_unit !== CSSUnitValue.toCanonicalUnit(target_unit) || canonical_unit === UnitType.kUnknown) {
103
- return null;
104
- }
105
-
106
- var scale_factor = CSSStyleValue.conversionToCanonicalUnitsScaleFactor(this.unit) / CSSStyleValue.conversionToCanonicalUnitsScaleFactor(target_unit);
107
- return new CSSUnitValue(this.value * scale_factor, target_unit);
108
- };
109
-
110
- CSSUnitValue.prototype.equals = function (other) {
111
- var other_unit_value = other;
112
- return this.value === other_unit_value.value && this.unit === other_unit_value.unit;
113
- };
114
-
115
- CSSUnitValue.prototype.getType = function () {
116
- return CSSStyleValueType.kUnitType;
117
- }; // toCSSValue() {
118
- // return new CSSNumericLiteralValue(this.value, this.unit);
119
- // }
120
- // // const CSSPrimitiveValue* ToCSSValueWithProperty(CSSPropertyID) const final;
121
- // toCalcExpressionNode() {
122
- // return CSSMathExpressionNumericLiteral.create(
123
- // new CSSNumericLiteralValue(this.value, this.unit),
124
- // );
125
- // }
126
-
127
-
128
- CSSUnitValue.prototype.sumValue = function () {
129
- var sum = [];
130
- var unit_map = {};
131
-
132
- if (this.unit !== UnitType.kNumber) {
133
- unit_map[CSSUnitValue.toCanonicalUnitIfPossible(this.unit)] = 1;
134
- }
135
-
136
- sum.push({
137
- value: this.value * CSSStyleValue.conversionToCanonicalUnitsScaleFactor(this.unit),
138
- units: unit_map
139
- });
140
- return sum;
141
- };
142
-
143
- CSSUnitValue.prototype.negate = function () {
144
- return new CSSUnitValue(-this.value, this.unit);
145
- };
146
-
147
- CSSUnitValue.prototype.invert = function () {
148
- if (this.unit === UnitType.kNumber) {
149
- if (this.value === 0) return null;
150
- return new CSSUnitValue(1.0 / this.value, this.unit);
151
- }
152
-
153
- return CSSMathInvert.create(this);
154
- };
155
-
156
- CSSUnitValue.prototype.buildCSSText = function (n, p, result) {
157
- var text;
158
-
159
- switch (this.unit) {
160
- case UnitType.kUnknown:
161
- // FIXME
162
- break;
163
-
164
- case UnitType.kInteger:
165
- text = Number(this.value).toFixed(0);
166
- break;
167
-
168
- case UnitType.kNumber:
169
- case UnitType.kPercentage:
170
- case UnitType.kEms:
171
- case UnitType.kQuirkyEms:
172
- case UnitType.kExs:
173
- case UnitType.kRems:
174
- case UnitType.kChs:
175
- case UnitType.kPixels:
176
- case UnitType.kCentimeters:
177
- case UnitType.kDotsPerPixel:
178
- case UnitType.kDotsPerInch:
179
- case UnitType.kDotsPerCentimeter:
180
- case UnitType.kMillimeters:
181
- case UnitType.kQuarterMillimeters:
182
- case UnitType.kInches:
183
- case UnitType.kPoints:
184
- case UnitType.kPicas:
185
- case UnitType.kUserUnits:
186
- case UnitType.kDegrees:
187
- case UnitType.kRadians:
188
- case UnitType.kGradians:
189
- case UnitType.kMilliseconds:
190
- case UnitType.kSeconds:
191
- case UnitType.kHertz:
192
- case UnitType.kKilohertz:
193
- case UnitType.kTurns:
194
- case UnitType.kFraction:
195
- case UnitType.kViewportWidth:
196
- case UnitType.kViewportHeight:
197
- case UnitType.kViewportInlineSize:
198
- case UnitType.kViewportBlockSize:
199
- case UnitType.kViewportMin:
200
- case UnitType.kViewportMax:
201
- case UnitType.kSmallViewportWidth:
202
- case UnitType.kSmallViewportHeight:
203
- case UnitType.kSmallViewportInlineSize:
204
- case UnitType.kSmallViewportBlockSize:
205
- case UnitType.kSmallViewportMin:
206
- case UnitType.kSmallViewportMax:
207
- case UnitType.kLargeViewportWidth:
208
- case UnitType.kLargeViewportHeight:
209
- case UnitType.kLargeViewportInlineSize:
210
- case UnitType.kLargeViewportBlockSize:
211
- case UnitType.kLargeViewportMin:
212
- case UnitType.kLargeViewportMax:
213
- case UnitType.kDynamicViewportWidth:
214
- case UnitType.kDynamicViewportHeight:
215
- case UnitType.kDynamicViewportInlineSize:
216
- case UnitType.kDynamicViewportBlockSize:
217
- case UnitType.kDynamicViewportMin:
218
- case UnitType.kDynamicViewportMax:
219
- case UnitType.kContainerWidth:
220
- case UnitType.kContainerHeight:
221
- case UnitType.kContainerInlineSize:
222
- case UnitType.kContainerBlockSize:
223
- case UnitType.kContainerMin:
224
- case UnitType.kContainerMax:
225
- {
226
- var kMinInteger = -999999;
227
- var kMaxInteger = 999999;
228
- var value = this.value;
229
- var unit = CSSUnitValue.unitTypeToString(this.unit);
230
-
231
- if (value < kMinInteger || value > kMaxInteger) {
232
- var unit_1 = CSSUnitValue.unitTypeToString(this.unit);
233
-
234
- if (!Number.isFinite(value) || Number.isNaN(value)) {
235
- text = CSSUnitValue.formatInfinityOrNaN(value, unit_1);
236
- } else {
237
- text = CSSUnitValue.formatNumber(value, unit_1);
238
- }
239
- } else {
240
- text = "".concat(value).concat(unit);
241
- }
242
- }
243
- }
244
-
245
- result += text;
246
- return result;
247
- };
248
-
249
- return CSSUnitValue;
250
- }(CSSNumericValue);
251
-
252
- export { CSSUnitValue };
@@ -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,94 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CSSMathInvert = void 0;
7
-
8
- var _tslib = require("tslib");
9
-
10
- var _CSSMathValue = require("./CSSMathValue");
11
-
12
- var _ = require(".");
13
-
14
- var CSSMathInvert =
15
- /** @class */
16
- function (_super) {
17
- (0, _tslib.__extends)(CSSMathInvert, _super);
18
-
19
- function CSSMathInvert(value, type) {
20
- var _this = _super.call(this, type) || this;
21
-
22
- _this.value = value;
23
- _this.operator = 'invert';
24
- return _this;
25
- }
26
-
27
- CSSMathInvert.create = function (value) {
28
- var type = _.CSSNumericValueType.negateExponents(value.type_);
29
-
30
- return new CSSMathInvert(value, type);
31
- };
32
-
33
- CSSMathInvert.prototype.clone = function () {
34
- return new CSSMathInvert(this.value, this.type_);
35
- };
36
-
37
- CSSMathInvert.prototype.getType = function () {
38
- return _.CSSStyleValueType.kInvertType;
39
- };
40
-
41
- CSSMathInvert.prototype.equals = function (other) {
42
- if (other.getType() !== _.CSSStyleValueType.kInvertType) {
43
- return false;
44
- } // We can safely cast here as we know 'other' has the same type as us.
45
-
46
-
47
- var other_invert = other;
48
- return this.value.equals(other_invert.value);
49
- };
50
-
51
- CSSMathInvert.prototype.sumValue = function () {
52
- var sum = this.value.sumValue();
53
-
54
- if (sum.length === 0 || sum.length !== 1 || sum[0].value === 0) {
55
- return null;
56
- }
57
-
58
- Object.keys(sum[0].units).forEach(function (key) {
59
- sum[0].units[key] *= -1;
60
- });
61
- sum[0].value = 1.0 / sum[0].value;
62
- return sum;
63
- }; // toCalcExpressionNode(): CSSMathExpressionNode {
64
- // const right_side = this.value.toCalcExpressionNode();
65
- // if (!right_side) {
66
- // return null;
67
- // }
68
- // // return CSSMathExpressionOperation::CreateArithmeticOperation(
69
- // // CSSMathExpressionNumericLiteral::Create(
70
- // // 1, UnitType.kNumber),
71
- // // right_side, CSSMathOperator.kDivide);
72
- // return null;
73
- // }
74
-
75
-
76
- CSSMathInvert.prototype.buildCSSText = function (nested, paren_less, result) {
77
- if (paren_less == _.ParenLess.kNo) {
78
- result += nested === _.Nested.kYes ? '(' : 'calc(';
79
- }
80
-
81
- result += '1 / ';
82
- result = this.value.buildCSSText(_.Nested.kYes, _.ParenLess.kNo, result);
83
-
84
- if (paren_less === _.ParenLess.kNo) {
85
- result += ')';
86
- }
87
-
88
- return result;
89
- };
90
-
91
- return CSSMathInvert;
92
- }(_CSSMathValue.CSSMathValue);
93
-
94
- exports.CSSMathInvert = 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,128 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CSSMathMax = void 0;
7
-
8
- var _tslib = require("tslib");
9
-
10
- var _CSSMathVariadic = require("./CSSMathVariadic");
11
-
12
- var _ = require(".");
13
-
14
- /**
15
- * The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
16
- * It inherits properties and methods from its parent CSSNumericValue.
17
- * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
18
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMax
19
- */
20
- // Represents the maximum of one or more CSSNumericValues.
21
- // @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
22
- var CSSMathMax =
23
- /** @class */
24
- function (_super) {
25
- (0, _tslib.__extends)(CSSMathMax, _super);
26
-
27
- function CSSMathMax() {
28
- var _this = _super !== null && _super.apply(this, arguments) || this;
29
-
30
- _this.operator = 'max';
31
- return _this;
32
- }
33
-
34
- CSSMathMax.create = function (values) {
35
- var error = false;
36
- var final_type = (0, _.typeCheck)(values, _.CSSNumericValueType.add, error);
37
- return error ? null : new CSSMathMax(values, final_type);
38
- };
39
-
40
- CSSMathMax.prototype.clone = function () {
41
- return new CSSMathMax(this.values, this.type_);
42
- };
43
-
44
- CSSMathMax.prototype.getType = function () {
45
- return _.CSSStyleValueType.kMaxType;
46
- };
47
-
48
- CSSMathMax.prototype.sumValue = function () {
49
- var e_1, _a;
50
-
51
- var cur_max = this.numericValues()[0].sumValue();
52
-
53
- if (!cur_max.length) {
54
- return null;
55
- }
56
-
57
- try {
58
- for (var _b = (0, _tslib.__values)(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
59
- var value = _c.value;
60
- var child_sum = value.sumValue();
61
-
62
- if (!child_sum.length || JSON.stringify(child_sum[0].units) !== JSON.stringify(cur_max[0].units)) {
63
- return null;
64
- }
65
-
66
- if (child_sum[0].value < cur_max[0].value) {
67
- cur_max = child_sum;
68
- }
69
- }
70
- } catch (e_1_1) {
71
- e_1 = {
72
- error: e_1_1
73
- };
74
- } finally {
75
- try {
76
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
77
- } finally {
78
- if (e_1) throw e_1.error;
79
- }
80
- }
81
-
82
- return cur_max;
83
- }; // toCalcExpressionNode() {
84
- // const operands: CSSMathExpressionOperation[] = [];
85
- // for (const value of this.numericValues()) {
86
- // const operand = value.toCalcExpressionNode();
87
- // if (!operand) {
88
- // continue;
89
- // }
90
- // operands.push(operand as CSSMathExpressionOperation);
91
- // }
92
- // return CSSMathExpressionOperation.createComparisonFunction(operands, CSSMathOperator.kMax);
93
- // }
94
-
95
-
96
- CSSMathMax.prototype.buildCSSText = function (nested, paren_less, result) {
97
- var e_2, _a;
98
-
99
- result += 'max(';
100
- var first_iteration = true;
101
-
102
- try {
103
- for (var _b = (0, _tslib.__values)(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
104
- var value = _c.value;
105
- if (!first_iteration) result += ', ';
106
- first_iteration = false;
107
- result = value.buildCSSText(_.Nested.kYes, _.ParenLess.kYes, result);
108
- }
109
- } catch (e_2_1) {
110
- e_2 = {
111
- error: e_2_1
112
- };
113
- } finally {
114
- try {
115
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
116
- } finally {
117
- if (e_2) throw e_2.error;
118
- }
119
- }
120
-
121
- result += ')';
122
- return result;
123
- };
124
-
125
- return CSSMathMax;
126
- }(_CSSMathVariadic.CSSMathVariadic);
127
-
128
- exports.CSSMathMax = 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,128 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CSSMathMin = void 0;
7
-
8
- var _tslib = require("tslib");
9
-
10
- var _CSSMathVariadic = require("./CSSMathVariadic");
11
-
12
- var _ = require(".");
13
-
14
- /**
15
- * The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
16
- * It inherits properties and methods from its parent CSSNumericValue.
17
- * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
18
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMin
19
- */
20
- // Represents the minimum of one or more CSSNumericValues.
21
- // @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
22
- var CSSMathMin =
23
- /** @class */
24
- function (_super) {
25
- (0, _tslib.__extends)(CSSMathMin, _super);
26
-
27
- function CSSMathMin() {
28
- var _this = _super !== null && _super.apply(this, arguments) || this;
29
-
30
- _this.operator = 'min';
31
- return _this;
32
- }
33
-
34
- CSSMathMin.create = function (values) {
35
- var error = false;
36
- var final_type = (0, _.typeCheck)(values, _.CSSNumericValueType.add, error);
37
- return error ? null : new CSSMathMin(values, final_type);
38
- };
39
-
40
- CSSMathMin.prototype.clone = function () {
41
- return new CSSMathMin(this.values, this.type_);
42
- };
43
-
44
- CSSMathMin.prototype.getType = function () {
45
- return _.CSSStyleValueType.kMinType;
46
- };
47
-
48
- CSSMathMin.prototype.sumValue = function () {
49
- var e_1, _a;
50
-
51
- var cur_min = this.numericValues()[0].sumValue();
52
-
53
- if (!cur_min.length) {
54
- return null;
55
- }
56
-
57
- try {
58
- for (var _b = (0, _tslib.__values)(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
59
- var value = _c.value;
60
- var child_sum = value.sumValue();
61
-
62
- if (!child_sum.length || JSON.stringify(child_sum[0].units) !== JSON.stringify(cur_min[0].units)) {
63
- return null;
64
- }
65
-
66
- if (child_sum[0].value < cur_min[0].value) {
67
- cur_min = child_sum;
68
- }
69
- }
70
- } catch (e_1_1) {
71
- e_1 = {
72
- error: e_1_1
73
- };
74
- } finally {
75
- try {
76
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
77
- } finally {
78
- if (e_1) throw e_1.error;
79
- }
80
- }
81
-
82
- return cur_min;
83
- }; // toCalcExpressionNode() {
84
- // const operands: CSSMathExpressionOperation[] = [];
85
- // for (const value of this.numericValues()) {
86
- // const operand = value.toCalcExpressionNode();
87
- // if (!operand) {
88
- // continue;
89
- // }
90
- // operands.push(operand as CSSMathExpressionOperation);
91
- // }
92
- // return CSSMathExpressionOperation.createComparisonFunction(operands, CSSMathOperator.kMin);
93
- // }
94
-
95
-
96
- CSSMathMin.prototype.buildCSSText = function (nested, paren_less, result) {
97
- var e_2, _a;
98
-
99
- result += 'min(';
100
- var first_iteration = true;
101
-
102
- try {
103
- for (var _b = (0, _tslib.__values)(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
104
- var value = _c.value;
105
- if (!first_iteration) result += ', ';
106
- first_iteration = false;
107
- result = value.buildCSSText(_.Nested.kYes, _.ParenLess.kYes, result);
108
- }
109
- } catch (e_2_1) {
110
- e_2 = {
111
- error: e_2_1
112
- };
113
- } finally {
114
- try {
115
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
116
- } finally {
117
- if (e_2) throw e_2.error;
118
- }
119
- }
120
-
121
- result += ')';
122
- return result;
123
- };
124
-
125
- return CSSMathMin;
126
- }(_CSSMathVariadic.CSSMathVariadic);
127
-
128
- exports.CSSMathMin = 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
- }