@antv/g 5.0.23-alpha.2 → 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.
- package/dist/index.umd.min.js +1 -1
- package/es/css/cssom/CSSNumericValue.d.ts +32 -1
- package/es/css/cssom/CSSNumericValue.js +259 -3
- package/es/css/cssom/index.d.ts +0 -1
- package/es/css/cssom/index.js +0 -1
- package/lib/css/cssom/CSSNumericValue.d.ts +32 -1
- package/lib/css/cssom/CSSNumericValue.js +280 -23
- package/lib/css/cssom/index.d.ts +0 -1
- package/lib/css/cssom/index.js +0 -13
- package/package.json +3 -3
- package/es/css/cssom/CSSNumericValueType.d.ts +0 -33
- package/es/css/cssom/CSSNumericValueType.js +0 -259
- package/lib/css/cssom/CSSNumericValueType.d.ts +0 -33
- package/lib/css/cssom/CSSNumericValueType.js +0 -272
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.CSSUnitValue = exports.CSSNumericValue = exports.CSSMathVariadic = exports.CSSMathValue = exports.CSSMathSum = exports.CSSMathProduct = exports.CSSMathNegate = exports.CSSMathMin = exports.CSSMathMax = exports.CSSMathInvert = void 0;
|
|
6
|
+
exports.CSSUnitValue = exports.CSSNumericValueType = exports.CSSNumericValue = exports.CSSMathVariadic = exports.CSSMathValue = exports.CSSMathSum = exports.CSSMathProduct = exports.CSSMathNegate = exports.CSSMathMin = exports.CSSMathMax = exports.CSSMathInvert = exports.BaseType = void 0;
|
|
7
|
+
exports.baseTypeToString = baseTypeToString;
|
|
7
8
|
exports.typeCheck = typeCheck;
|
|
9
|
+
exports.unitTypeToBaseType = unitTypeToBaseType;
|
|
8
10
|
|
|
9
11
|
var _tslib = require("tslib");
|
|
10
12
|
|
|
@@ -12,12 +14,270 @@ var _utils = require("../../utils");
|
|
|
12
14
|
|
|
13
15
|
var _CSSMathOperator = require("./CSSMathOperator");
|
|
14
16
|
|
|
15
|
-
var _CSSNumericValueType = require("./CSSNumericValueType");
|
|
16
|
-
|
|
17
17
|
var _CSSStyleValue = require("./CSSStyleValue");
|
|
18
18
|
|
|
19
19
|
var _types = require("./types");
|
|
20
20
|
|
|
21
|
+
// https://drafts.css-houdini.org/css-typed-om/#enumdef-cssnumericbasetype
|
|
22
|
+
var BaseType;
|
|
23
|
+
exports.BaseType = BaseType;
|
|
24
|
+
|
|
25
|
+
(function (BaseType) {
|
|
26
|
+
BaseType[BaseType["kLength"] = 0] = "kLength";
|
|
27
|
+
BaseType[BaseType["kAngle"] = 1] = "kAngle";
|
|
28
|
+
BaseType[BaseType["kTime"] = 2] = "kTime";
|
|
29
|
+
BaseType[BaseType["kFrequency"] = 3] = "kFrequency";
|
|
30
|
+
BaseType[BaseType["kResolution"] = 4] = "kResolution";
|
|
31
|
+
BaseType[BaseType["kFlex"] = 5] = "kFlex";
|
|
32
|
+
BaseType[BaseType["kPercent"] = 6] = "kPercent";
|
|
33
|
+
BaseType[BaseType["kNumBaseTypes"] = 7] = "kNumBaseTypes";
|
|
34
|
+
})(BaseType || (exports.BaseType = BaseType = {}));
|
|
35
|
+
|
|
36
|
+
function unitTypeToBaseType(unit) {
|
|
37
|
+
(0, _utils.DCHECK_NE)(unit, _types.UnitType.kNumber);
|
|
38
|
+
|
|
39
|
+
switch (unit) {
|
|
40
|
+
case _types.UnitType.kEms:
|
|
41
|
+
case _types.UnitType.kExs:
|
|
42
|
+
case _types.UnitType.kPixels:
|
|
43
|
+
case _types.UnitType.kCentimeters:
|
|
44
|
+
case _types.UnitType.kMillimeters:
|
|
45
|
+
case _types.UnitType.kQuarterMillimeters:
|
|
46
|
+
case _types.UnitType.kInches:
|
|
47
|
+
case _types.UnitType.kPoints:
|
|
48
|
+
case _types.UnitType.kPicas:
|
|
49
|
+
case _types.UnitType.kUserUnits:
|
|
50
|
+
case _types.UnitType.kViewportWidth:
|
|
51
|
+
case _types.UnitType.kViewportHeight:
|
|
52
|
+
case _types.UnitType.kViewportInlineSize:
|
|
53
|
+
case _types.UnitType.kViewportBlockSize:
|
|
54
|
+
case _types.UnitType.kViewportMin:
|
|
55
|
+
case _types.UnitType.kViewportMax:
|
|
56
|
+
case _types.UnitType.kSmallViewportWidth:
|
|
57
|
+
case _types.UnitType.kSmallViewportHeight:
|
|
58
|
+
case _types.UnitType.kSmallViewportInlineSize:
|
|
59
|
+
case _types.UnitType.kSmallViewportBlockSize:
|
|
60
|
+
case _types.UnitType.kSmallViewportMin:
|
|
61
|
+
case _types.UnitType.kSmallViewportMax:
|
|
62
|
+
case _types.UnitType.kLargeViewportWidth:
|
|
63
|
+
case _types.UnitType.kLargeViewportHeight:
|
|
64
|
+
case _types.UnitType.kLargeViewportInlineSize:
|
|
65
|
+
case _types.UnitType.kLargeViewportBlockSize:
|
|
66
|
+
case _types.UnitType.kLargeViewportMin:
|
|
67
|
+
case _types.UnitType.kLargeViewportMax:
|
|
68
|
+
case _types.UnitType.kDynamicViewportWidth:
|
|
69
|
+
case _types.UnitType.kDynamicViewportHeight:
|
|
70
|
+
case _types.UnitType.kDynamicViewportInlineSize:
|
|
71
|
+
case _types.UnitType.kDynamicViewportBlockSize:
|
|
72
|
+
case _types.UnitType.kDynamicViewportMin:
|
|
73
|
+
case _types.UnitType.kDynamicViewportMax:
|
|
74
|
+
case _types.UnitType.kContainerWidth:
|
|
75
|
+
case _types.UnitType.kContainerHeight:
|
|
76
|
+
case _types.UnitType.kContainerInlineSize:
|
|
77
|
+
case _types.UnitType.kContainerBlockSize:
|
|
78
|
+
case _types.UnitType.kContainerMin:
|
|
79
|
+
case _types.UnitType.kContainerMax:
|
|
80
|
+
case _types.UnitType.kRems:
|
|
81
|
+
case _types.UnitType.kChs:
|
|
82
|
+
return BaseType.kLength;
|
|
83
|
+
|
|
84
|
+
case _types.UnitType.kMilliseconds:
|
|
85
|
+
case _types.UnitType.kSeconds:
|
|
86
|
+
return BaseType.kTime;
|
|
87
|
+
|
|
88
|
+
case _types.UnitType.kDegrees:
|
|
89
|
+
case _types.UnitType.kRadians:
|
|
90
|
+
case _types.UnitType.kGradians:
|
|
91
|
+
case _types.UnitType.kTurns:
|
|
92
|
+
return BaseType.kAngle;
|
|
93
|
+
|
|
94
|
+
case _types.UnitType.kHertz:
|
|
95
|
+
case _types.UnitType.kKilohertz:
|
|
96
|
+
return BaseType.kFrequency;
|
|
97
|
+
|
|
98
|
+
case _types.UnitType.kDotsPerPixel:
|
|
99
|
+
case _types.UnitType.kDotsPerInch:
|
|
100
|
+
case _types.UnitType.kDotsPerCentimeter:
|
|
101
|
+
return BaseType.kResolution;
|
|
102
|
+
|
|
103
|
+
case _types.UnitType.kFraction:
|
|
104
|
+
return BaseType.kFlex;
|
|
105
|
+
|
|
106
|
+
case _types.UnitType.kPercentage:
|
|
107
|
+
return BaseType.kPercent;
|
|
108
|
+
|
|
109
|
+
default:
|
|
110
|
+
return BaseType.kLength;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function baseTypeToString(baseType) {
|
|
115
|
+
switch (baseType) {
|
|
116
|
+
case BaseType.kLength:
|
|
117
|
+
return 'length';
|
|
118
|
+
|
|
119
|
+
case BaseType.kAngle:
|
|
120
|
+
return 'angle';
|
|
121
|
+
|
|
122
|
+
case BaseType.kTime:
|
|
123
|
+
return 'time';
|
|
124
|
+
|
|
125
|
+
case BaseType.kFrequency:
|
|
126
|
+
return 'frequency';
|
|
127
|
+
|
|
128
|
+
case BaseType.kResolution:
|
|
129
|
+
return 'resolution';
|
|
130
|
+
|
|
131
|
+
case BaseType.kFlex:
|
|
132
|
+
return 'flex';
|
|
133
|
+
|
|
134
|
+
case BaseType.kPercent:
|
|
135
|
+
return 'percent';
|
|
136
|
+
|
|
137
|
+
default:
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return '';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var CSSNumericValueType =
|
|
145
|
+
/** @class */
|
|
146
|
+
function () {
|
|
147
|
+
function CSSNumericValueType(unit, exponent) {
|
|
148
|
+
if (unit === void 0) {
|
|
149
|
+
unit = _types.UnitType.kNumber;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (exponent === void 0) {
|
|
153
|
+
exponent = 1;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.exponents = [];
|
|
157
|
+
this.numNonZeroEntries = 0;
|
|
158
|
+
this.percentHint = BaseType.kPercent;
|
|
159
|
+
this.hasPercentHint = false;
|
|
160
|
+
this.exponents = new Array(BaseType.kNumBaseTypes).fill(0);
|
|
161
|
+
|
|
162
|
+
if (unit !== _types.UnitType.kNumber) {
|
|
163
|
+
this.setExponent(unitTypeToBaseType(unit), exponent);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
CSSNumericValueType.prototype.applyPercentHint = function (hint) {
|
|
168
|
+
(0, _utils.DCHECK_NE)(hint, BaseType.kPercent);
|
|
169
|
+
this.setExponent(hint, this.exponent(hint) + this.exponent(BaseType.kPercent));
|
|
170
|
+
this.setExponent(BaseType.kPercent, 0);
|
|
171
|
+
this.percentHint = hint;
|
|
172
|
+
this.hasPercentHint = true;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
CSSNumericValueType.prototype.hasNonZeroEntries = function () {
|
|
176
|
+
return this.numNonZeroEntries > 0;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
CSSNumericValueType.prototype.isOnlyNonZeroEntry = function (baseType, value) {
|
|
180
|
+
(0, _utils.DCHECK_NE)(value, 0);
|
|
181
|
+
return this.numNonZeroEntries === 1 && this.exponent(baseType) === value;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
CSSNumericValueType.prototype.exponent = function (type) {
|
|
185
|
+
return this.exponents[type];
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
CSSNumericValueType.prototype.setExponent = function (type, newValue) {
|
|
189
|
+
var oldValue = this.exponents[type];
|
|
190
|
+
|
|
191
|
+
if (oldValue == 0 && newValue !== 0) {
|
|
192
|
+
this.numNonZeroEntries++;
|
|
193
|
+
} else if (oldValue !== 0 && newValue == 0) {
|
|
194
|
+
this.numNonZeroEntries--;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
this.exponents[type] = newValue;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
CSSNumericValueType.negateExponents = function (type) {
|
|
201
|
+
type.exponents.forEach(function (v) {
|
|
202
|
+
return v *= -1;
|
|
203
|
+
});
|
|
204
|
+
return type;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
CSSNumericValueType.prototype.matchesBaseType = function (baseType) {
|
|
208
|
+
(0, _utils.DCHECK_NE)(baseType, BaseType.kPercent);
|
|
209
|
+
return this.isOnlyNonZeroEntry(baseType, 1) && !this.hasPercentHint;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
CSSNumericValueType.prototype.matchesPercentage = function () {
|
|
213
|
+
return this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
CSSNumericValueType.prototype.matchesBaseTypePercentage = function (baseType) {
|
|
217
|
+
(0, _utils.DCHECK_NE)(baseType, BaseType.kPercent);
|
|
218
|
+
return this.isOnlyNonZeroEntry(baseType, 1) || this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
CSSNumericValueType.prototype.matchesNumber = function () {
|
|
222
|
+
return !this.hasNonZeroEntries() && !this.hasPercentHint;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
CSSNumericValueType.prototype.matchesNumberPercentage = function () {
|
|
226
|
+
return !this.hasNonZeroEntries() || this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
CSSNumericValueType.add = function (type1, type2, error) {
|
|
230
|
+
if (type1.hasPercentHint && type2.hasPercentHint && type1.percentHint != type2.percentHint) {
|
|
231
|
+
error = true;
|
|
232
|
+
return type1;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (type1.hasPercentHint) type2.applyPercentHint(type1.percentHint);else if (type2.hasPercentHint) type1.applyPercentHint(type2.percentHint);
|
|
236
|
+
(0, _utils.DCHECK_EQ)(type1.percentHint, type2.percentHint); // Match up base types. Try to use the percent hint to match up any
|
|
237
|
+
// differences.
|
|
238
|
+
|
|
239
|
+
for (var i = 0; i < BaseType.kNumBaseTypes; ++i) {
|
|
240
|
+
var base_type = i;
|
|
241
|
+
|
|
242
|
+
if (type1.exponents[i] !== type2.exponents[i]) {
|
|
243
|
+
if (base_type !== BaseType.kPercent) {
|
|
244
|
+
type1.applyPercentHint(base_type);
|
|
245
|
+
type2.applyPercentHint(base_type);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (type1.exponents[i] !== type2.exponents[i]) {
|
|
249
|
+
error = true;
|
|
250
|
+
return type1;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
error = false;
|
|
256
|
+
return type1;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
CSSNumericValueType.multiply = function (type1, type2, error) {
|
|
260
|
+
if (type1.hasPercentHint && type2.hasPercentHint && type1.percentHint != type2.percentHint) {
|
|
261
|
+
error = true;
|
|
262
|
+
return type1;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (type1.hasPercentHint) type2.applyPercentHint(type1.percentHint);else if (type2.hasPercentHint) type1.applyPercentHint(type2.percentHint);
|
|
266
|
+
|
|
267
|
+
for (var i = 0; i < BaseType.kNumBaseTypes; ++i) {
|
|
268
|
+
var base_type = i;
|
|
269
|
+
type1.setExponent(base_type, type1.exponent(base_type) + type2.exponent(base_type));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
error = false;
|
|
273
|
+
return type1;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
return CSSNumericValueType;
|
|
277
|
+
}();
|
|
278
|
+
|
|
279
|
+
exports.CSSNumericValueType = CSSNumericValueType;
|
|
280
|
+
|
|
21
281
|
/**
|
|
22
282
|
* CSSNumericValue is the base class for numeric and length typed CSS Values.
|
|
23
283
|
* @see https://drafts.css-houdini.org/css-typed-om/#numeric-objects
|
|
@@ -377,50 +637,50 @@ function (_super) {
|
|
|
377
637
|
percent: 0,
|
|
378
638
|
percentHint: 'length'
|
|
379
639
|
};
|
|
380
|
-
var exponent = this.type_.exponent(
|
|
640
|
+
var exponent = this.type_.exponent(BaseType.kLength);
|
|
381
641
|
|
|
382
642
|
if (exponent) {
|
|
383
643
|
type.length = exponent;
|
|
384
644
|
}
|
|
385
645
|
|
|
386
|
-
exponent = this.type_.exponent(
|
|
646
|
+
exponent = this.type_.exponent(BaseType.kAngle);
|
|
387
647
|
|
|
388
648
|
if (exponent) {
|
|
389
649
|
type.angle = exponent;
|
|
390
650
|
}
|
|
391
651
|
|
|
392
|
-
exponent = this.type_.exponent(
|
|
652
|
+
exponent = this.type_.exponent(BaseType.kTime);
|
|
393
653
|
|
|
394
654
|
if (exponent) {
|
|
395
655
|
type.time = exponent;
|
|
396
656
|
}
|
|
397
657
|
|
|
398
|
-
exponent = this.type_.exponent(
|
|
658
|
+
exponent = this.type_.exponent(BaseType.kFrequency);
|
|
399
659
|
|
|
400
660
|
if (exponent) {
|
|
401
661
|
type.frequency = exponent;
|
|
402
662
|
}
|
|
403
663
|
|
|
404
|
-
exponent = this.type_.exponent(
|
|
664
|
+
exponent = this.type_.exponent(BaseType.kResolution);
|
|
405
665
|
|
|
406
666
|
if (exponent) {
|
|
407
667
|
type.resolution = exponent;
|
|
408
668
|
}
|
|
409
669
|
|
|
410
|
-
exponent = this.type_.exponent(
|
|
670
|
+
exponent = this.type_.exponent(BaseType.kFlex);
|
|
411
671
|
|
|
412
672
|
if (exponent) {
|
|
413
673
|
type.flex = exponent;
|
|
414
674
|
}
|
|
415
675
|
|
|
416
|
-
exponent = this.type_.exponent(
|
|
676
|
+
exponent = this.type_.exponent(BaseType.kPercent);
|
|
417
677
|
|
|
418
678
|
if (exponent) {
|
|
419
679
|
type.percent = exponent;
|
|
420
680
|
}
|
|
421
681
|
|
|
422
682
|
if (this.type_.hasPercentHint) {
|
|
423
|
-
type.percentHint =
|
|
683
|
+
type.percentHint = baseTypeToString(this.type_.percentHint);
|
|
424
684
|
}
|
|
425
685
|
|
|
426
686
|
return type;
|
|
@@ -541,7 +801,7 @@ function (_super) {
|
|
|
541
801
|
}
|
|
542
802
|
|
|
543
803
|
(0, _utils.DCHECK)(CSSUnitValue.isValidUnit(unit));
|
|
544
|
-
_this = _super.call(this, new
|
|
804
|
+
_this = _super.call(this, new CSSNumericValueType(unit)) || this;
|
|
545
805
|
_this.unit = unit;
|
|
546
806
|
_this.value = value;
|
|
547
807
|
return _this;
|
|
@@ -794,8 +1054,7 @@ function (_super) {
|
|
|
794
1054
|
}
|
|
795
1055
|
|
|
796
1056
|
CSSMathInvert.create = function (value) {
|
|
797
|
-
var type =
|
|
798
|
-
|
|
1057
|
+
var type = CSSNumericValueType.negateExponents(value.type_);
|
|
799
1058
|
return new CSSMathInvert(value, type);
|
|
800
1059
|
};
|
|
801
1060
|
|
|
@@ -999,7 +1258,7 @@ function (_super) {
|
|
|
999
1258
|
|
|
1000
1259
|
CSSMathMin.create = function (values) {
|
|
1001
1260
|
var error = false;
|
|
1002
|
-
var final_type = typeCheck(values,
|
|
1261
|
+
var final_type = typeCheck(values, CSSNumericValueType.add, error);
|
|
1003
1262
|
return error ? null : new CSSMathMin(values, final_type);
|
|
1004
1263
|
};
|
|
1005
1264
|
|
|
@@ -1109,7 +1368,7 @@ function (_super) {
|
|
|
1109
1368
|
|
|
1110
1369
|
CSSMathMax.create = function (values) {
|
|
1111
1370
|
var error = false;
|
|
1112
|
-
var final_type = typeCheck(values,
|
|
1371
|
+
var final_type = typeCheck(values, CSSNumericValueType.add, error);
|
|
1113
1372
|
return error ? null : new CSSMathMax(values, final_type);
|
|
1114
1373
|
};
|
|
1115
1374
|
|
|
@@ -1221,16 +1480,16 @@ function (_super) {
|
|
|
1221
1480
|
|
|
1222
1481
|
CSSMathSum.create = function (values) {
|
|
1223
1482
|
var error = false;
|
|
1224
|
-
var finalType = typeCheck(values,
|
|
1483
|
+
var finalType = typeCheck(values, CSSNumericValueType.add, error);
|
|
1225
1484
|
return error ? null : new CSSMathSum(values, finalType);
|
|
1226
1485
|
};
|
|
1227
1486
|
|
|
1228
1487
|
CSSMathSum.numericTypeFromUnitMap = function (units) {
|
|
1229
|
-
var type = new
|
|
1488
|
+
var type = new CSSNumericValueType();
|
|
1230
1489
|
Object.keys(units).forEach(function (key) {
|
|
1231
1490
|
var exp = units[key];
|
|
1232
1491
|
var error = false;
|
|
1233
|
-
type =
|
|
1492
|
+
type = CSSNumericValueType.multiply(type, new CSSNumericValueType(Number(key), exp), error);
|
|
1234
1493
|
(0, _utils.DCHECK)(!error);
|
|
1235
1494
|
});
|
|
1236
1495
|
return type;
|
|
@@ -1243,9 +1502,7 @@ function (_super) {
|
|
|
1243
1502
|
var first_type = this.numericTypeFromUnitMap(sum[0].units);
|
|
1244
1503
|
return sum.every(function (term) {
|
|
1245
1504
|
var error = false;
|
|
1246
|
-
|
|
1247
|
-
_CSSNumericValueType.CSSNumericValueType.add(first_type, _this.numericTypeFromUnitMap(term.units), error);
|
|
1248
|
-
|
|
1505
|
+
CSSNumericValueType.add(first_type, _this.numericTypeFromUnitMap(term.units), error);
|
|
1249
1506
|
return !error;
|
|
1250
1507
|
});
|
|
1251
1508
|
};
|
|
@@ -1336,7 +1593,7 @@ function (_super) {
|
|
|
1336
1593
|
|
|
1337
1594
|
CSSMathProduct.create = function (values) {
|
|
1338
1595
|
var error = false;
|
|
1339
|
-
var finalType = typeCheck(values,
|
|
1596
|
+
var finalType = typeCheck(values, CSSNumericValueType.multiply, error);
|
|
1340
1597
|
return error ? null : new CSSMathProduct(values, finalType);
|
|
1341
1598
|
};
|
|
1342
1599
|
|
package/lib/css/cssom/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export * from './CSSKeywordValue';
|
|
|
12
12
|
export * from './CSSMathOperator';
|
|
13
13
|
export * from './CSSNumericSumValue';
|
|
14
14
|
export * from './CSSNumericValue';
|
|
15
|
-
export * from './CSSNumericValueType';
|
|
16
15
|
export * from './CSSRGB';
|
|
17
16
|
export * from './CSSGradientValue';
|
|
18
17
|
export * from './CSSStyleValue';
|
package/lib/css/cssom/index.js
CHANGED
|
@@ -82,19 +82,6 @@ Object.keys(_CSSNumericValue).forEach(function (key) {
|
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
var _CSSNumericValueType = require("./CSSNumericValueType");
|
|
86
|
-
|
|
87
|
-
Object.keys(_CSSNumericValueType).forEach(function (key) {
|
|
88
|
-
if (key === "default" || key === "__esModule") return;
|
|
89
|
-
if (key in exports && exports[key] === _CSSNumericValueType[key]) return;
|
|
90
|
-
Object.defineProperty(exports, key, {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function get() {
|
|
93
|
-
return _CSSNumericValueType[key];
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
85
|
var _CSSRGB = require("./CSSRGB");
|
|
99
86
|
|
|
100
87
|
Object.keys(_CSSRGB).forEach(function (key) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g",
|
|
3
|
-
"version": "5.0.23-alpha.
|
|
3
|
+
"version": "5.0.23-alpha.4",
|
|
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.
|
|
41
|
+
"@antv/g-math": "^1.0.20-alpha.4",
|
|
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": "
|
|
55
|
+
"gitHead": "07a45d1dcaeda55f64acd5486b1c19d132fac8bc"
|
|
56
56
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { UnitType } from './types';
|
|
2
|
-
export declare enum BaseType {
|
|
3
|
-
kLength = 0,
|
|
4
|
-
kAngle = 1,
|
|
5
|
-
kTime = 2,
|
|
6
|
-
kFrequency = 3,
|
|
7
|
-
kResolution = 4,
|
|
8
|
-
kFlex = 5,
|
|
9
|
-
kPercent = 6,
|
|
10
|
-
kNumBaseTypes = 7
|
|
11
|
-
}
|
|
12
|
-
export declare function unitTypeToBaseType(unit: UnitType): BaseType.kLength | BaseType.kAngle | BaseType.kTime | BaseType.kFrequency | BaseType.kResolution | BaseType.kFlex | BaseType.kPercent;
|
|
13
|
-
export declare function baseTypeToString(baseType: BaseType): "" | "percent" | "length" | "angle" | "time" | "frequency" | "resolution" | "flex";
|
|
14
|
-
export declare class CSSNumericValueType {
|
|
15
|
-
private exponents;
|
|
16
|
-
private numNonZeroEntries;
|
|
17
|
-
percentHint: BaseType;
|
|
18
|
-
hasPercentHint: boolean;
|
|
19
|
-
constructor(unit?: UnitType, exponent?: number);
|
|
20
|
-
applyPercentHint(hint: BaseType): void;
|
|
21
|
-
hasNonZeroEntries(): boolean;
|
|
22
|
-
isOnlyNonZeroEntry(baseType: BaseType, value: number): boolean;
|
|
23
|
-
exponent(type: BaseType): number;
|
|
24
|
-
setExponent(type: BaseType, newValue: number): void;
|
|
25
|
-
static negateExponents(type: CSSNumericValueType): CSSNumericValueType;
|
|
26
|
-
matchesBaseType(baseType: BaseType): boolean;
|
|
27
|
-
matchesPercentage(): boolean;
|
|
28
|
-
matchesBaseTypePercentage(baseType: BaseType): boolean;
|
|
29
|
-
matchesNumber(): boolean;
|
|
30
|
-
matchesNumberPercentage(): boolean;
|
|
31
|
-
static add(type1: CSSNumericValueType, type2: CSSNumericValueType, error: boolean): CSSNumericValueType;
|
|
32
|
-
static multiply(type1: CSSNumericValueType, type2: CSSNumericValueType, error: boolean): CSSNumericValueType;
|
|
33
|
-
}
|