@antv/g 5.0.22 → 5.0.23-alpha.11
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 +3 -3
- package/es/AbstractRenderer.js +5 -0
- package/es/camera/Camera.js +2 -2
- package/es/css/StyleValueRegistry.d.ts +2 -0
- package/es/css/StyleValueRegistry.js +7 -3
- 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/color.js +1 -1
- package/es/css/parser/dimension.js +1 -2
- package/es/css/parser/numeric.d.ts +1 -1
- package/es/css/parser/numeric.js +2 -2
- package/es/css/parser/path.d.ts +2 -2
- package/es/css/parser/path.js +1 -1
- package/es/css/parser/points.js +1 -1
- package/es/css/parser/transform-origin.d.ts +1 -1
- package/es/css/parser/transform-origin.js +2 -2
- package/es/css/parser/transform.d.ts +1 -3
- package/es/css/parser/transform.js +9 -8
- package/es/css/properties/CSSPropertyPath.d.ts +14 -2
- package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -2
- package/es/css/properties/CSSPropertyTransform.js +3 -4
- package/es/display-objects/DisplayObject.js +4 -5
- package/es/display-objects/Path.d.ts +15 -15
- package/es/display-objects/Path.js +1 -1
- package/es/display-objects/Polygon.d.ts +8 -1
- package/es/display-objects/Polyline.d.ts +7 -5
- package/es/dom/Document.js +2 -2
- package/es/dom/Element.js +1 -2
- package/es/dom/EventTarget.js +1 -1
- package/es/dom/FederatedTouchEvent.d.ts +5 -3
- package/es/plugins/CullingPlugin.d.ts +0 -1
- package/es/plugins/CullingPlugin.js +3 -8
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/DirtyCheckPlugin.js +9 -8
- package/es/plugins/EventPlugin.d.ts +1 -1
- package/es/plugins/EventPlugin.js +163 -148
- package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/es/plugins/PrepareRendererPlugin.js +17 -18
- package/es/services/EventService.d.ts +8 -0
- package/es/services/EventService.js +274 -20
- package/es/services/RenderingService.d.ts +17 -16
- package/es/services/RenderingService.js +20 -19
- package/es/services/SceneGraphService.js +1 -1
- package/es/services/aabb/PathUpdater.d.ts +3 -3
- package/es/services/aabb/PolylineUpdater.d.ts +3 -3
- package/es/services/aabb/RectUpdater.js +1 -1
- package/es/types.d.ts +5 -3
- package/es/utils/assert.d.ts +6 -0
- package/es/utils/assert.js +18 -0
- package/es/utils/event.d.ts +18 -16
- package/es/utils/hooks.d.ts +280 -0
- package/es/utils/hooks.js +753 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/math.d.ts +1 -0
- package/es/utils/math.js +13 -2
- package/es/utils/string.d.ts +1 -0
- package/es/utils/string.js +8 -0
- package/es/utils/text.js +2 -1
- package/lib/AbstractRenderer.js +5 -0
- package/lib/camera/Camera.js +4 -4
- package/lib/css/StyleValueRegistry.d.ts +2 -0
- package/lib/css/StyleValueRegistry.js +13 -5
- 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/color.js +5 -5
- package/lib/css/parser/dimension.js +1 -3
- package/lib/css/parser/numeric.d.ts +1 -1
- package/lib/css/parser/numeric.js +7 -7
- package/lib/css/parser/path.d.ts +2 -2
- package/lib/css/parser/path.js +4 -4
- package/lib/css/parser/points.js +2 -2
- package/lib/css/parser/transform-origin.d.ts +1 -1
- package/lib/css/parser/transform-origin.js +4 -4
- package/lib/css/parser/transform.d.ts +1 -3
- package/lib/css/parser/transform.js +25 -24
- package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
- package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -2
- package/lib/css/properties/CSSPropertyTransform.js +18 -20
- package/lib/display-objects/DisplayObject.js +7 -9
- package/lib/display-objects/Path.d.ts +15 -15
- package/lib/display-objects/Path.js +3 -3
- package/lib/display-objects/Polygon.d.ts +8 -1
- package/lib/display-objects/Polyline.d.ts +7 -5
- package/lib/dom/Document.js +2 -2
- package/lib/dom/Element.js +1 -3
- package/lib/dom/EventTarget.js +9 -9
- package/lib/dom/FederatedTouchEvent.d.ts +5 -3
- package/lib/plugins/CullingPlugin.d.ts +0 -1
- package/lib/plugins/CullingPlugin.js +3 -7
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/DirtyCheckPlugin.js +10 -8
- package/lib/plugins/EventPlugin.d.ts +1 -1
- package/lib/plugins/EventPlugin.js +172 -156
- package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/lib/plugins/PrepareRendererPlugin.js +16 -16
- package/lib/services/EventService.d.ts +8 -0
- package/lib/services/EventService.js +274 -19
- package/lib/services/RenderingService.d.ts +17 -16
- package/lib/services/RenderingService.js +21 -20
- package/lib/services/SceneGraphService.js +3 -3
- package/lib/services/aabb/PathUpdater.d.ts +3 -3
- package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
- package/lib/services/aabb/RectUpdater.js +3 -3
- package/lib/types.d.ts +5 -3
- package/lib/utils/assert.d.ts +6 -0
- package/lib/utils/assert.js +30 -0
- package/lib/utils/event.d.ts +18 -16
- package/lib/utils/hooks.d.ts +280 -0
- package/lib/utils/hooks.js +759 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/math.d.ts +1 -0
- package/lib/utils/math.js +17 -4
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +11 -0
- package/lib/utils/text.js +5 -3
- package/package.json +4 -7
- 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,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
|
-
}
|