@antv/g 5.0.22-alpha.6 → 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 (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 +108 -4
  7. package/es/css/cssom/CSSNumericValue.js +908 -5
  8. package/es/css/cssom/CSSNumericValueType.d.ts +1 -1
  9. package/es/css/cssom/CSSNumericValueType.js +1 -1
  10. package/es/css/cssom/CSSTransformValue.d.ts +1 -1
  11. package/es/css/cssom/index.d.ts +0 -9
  12. package/es/css/cssom/index.js +1 -10
  13. package/es/css/parser/color.js +1 -1
  14. package/es/css/parser/dimension.js +1 -2
  15. package/es/css/parser/numeric.js +1 -1
  16. package/es/css/parser/path.d.ts +2 -2
  17. package/es/css/parser/path.js +1 -1
  18. package/es/css/parser/points.js +1 -1
  19. package/es/css/parser/transform-origin.js +1 -1
  20. package/es/css/properties/CSSPropertyPath.d.ts +14 -2
  21. package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  22. package/es/css/properties/CSSPropertyTransform.js +1 -2
  23. package/es/display-objects/DisplayObject.js +4 -5
  24. package/es/display-objects/Path.d.ts +15 -15
  25. package/es/display-objects/Path.js +1 -1
  26. package/es/display-objects/Polygon.d.ts +8 -1
  27. package/es/display-objects/Polyline.d.ts +7 -5
  28. package/es/dom/Document.js +2 -2
  29. package/es/dom/Element.js +1 -2
  30. package/es/dom/EventTarget.js +1 -1
  31. package/es/dom/FederatedTouchEvent.d.ts +5 -3
  32. package/es/plugins/CullingPlugin.d.ts +0 -1
  33. package/es/plugins/CullingPlugin.js +3 -8
  34. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  35. package/es/plugins/DirtyCheckPlugin.js +9 -8
  36. package/es/plugins/EventPlugin.d.ts +1 -1
  37. package/es/plugins/EventPlugin.js +163 -148
  38. package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
  39. package/es/plugins/PrepareRendererPlugin.js +15 -16
  40. package/es/services/EventService.d.ts +8 -0
  41. package/es/services/EventService.js +274 -20
  42. package/es/services/RenderingService.d.ts +17 -16
  43. package/es/services/RenderingService.js +18 -17
  44. package/es/services/SceneGraphService.js +1 -1
  45. package/es/services/aabb/PathUpdater.d.ts +3 -3
  46. package/es/services/aabb/PolylineUpdater.d.ts +3 -3
  47. package/es/services/aabb/RectUpdater.js +1 -1
  48. package/es/types.d.ts +5 -3
  49. package/es/utils/assert.d.ts +6 -0
  50. package/es/utils/assert.js +18 -0
  51. package/es/utils/event.d.ts +18 -16
  52. package/es/utils/hooks.d.ts +280 -0
  53. package/es/utils/hooks.js +753 -0
  54. package/es/utils/index.d.ts +1 -0
  55. package/es/utils/index.js +2 -1
  56. package/es/utils/math.d.ts +1 -0
  57. package/es/utils/math.js +13 -2
  58. package/es/utils/string.d.ts +1 -0
  59. package/es/utils/string.js +8 -0
  60. package/es/utils/text.js +2 -1
  61. package/lib/AbstractRenderer.js +5 -0
  62. package/lib/camera/Camera.js +4 -4
  63. package/lib/css/cssom/CSSKeywordValue.d.ts +1 -1
  64. package/lib/css/cssom/CSSNumericSumValue.d.ts +1 -1
  65. package/lib/css/cssom/CSSNumericValue.d.ts +108 -4
  66. package/lib/css/cssom/CSSNumericValue.js +965 -52
  67. package/lib/css/cssom/CSSNumericValueType.d.ts +1 -1
  68. package/lib/css/cssom/CSSNumericValueType.js +59 -59
  69. package/lib/css/cssom/CSSTransformValue.d.ts +1 -1
  70. package/lib/css/cssom/index.d.ts +0 -9
  71. package/lib/css/cssom/index.js +0 -117
  72. package/lib/css/parser/color.js +5 -5
  73. package/lib/css/parser/dimension.js +1 -3
  74. package/lib/css/parser/numeric.js +3 -3
  75. package/lib/css/parser/path.d.ts +2 -2
  76. package/lib/css/parser/path.js +4 -4
  77. package/lib/css/parser/points.js +2 -2
  78. package/lib/css/parser/transform-origin.js +2 -2
  79. package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
  80. package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  81. package/lib/css/properties/CSSPropertyTransform.js +0 -2
  82. package/lib/display-objects/DisplayObject.js +7 -9
  83. package/lib/display-objects/Path.d.ts +15 -15
  84. package/lib/display-objects/Path.js +3 -3
  85. package/lib/display-objects/Polygon.d.ts +8 -1
  86. package/lib/display-objects/Polyline.d.ts +7 -5
  87. package/lib/dom/Document.js +2 -2
  88. package/lib/dom/Element.js +1 -3
  89. package/lib/dom/EventTarget.js +9 -9
  90. package/lib/dom/FederatedTouchEvent.d.ts +5 -3
  91. package/lib/plugins/CullingPlugin.d.ts +0 -1
  92. package/lib/plugins/CullingPlugin.js +3 -7
  93. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  94. package/lib/plugins/DirtyCheckPlugin.js +10 -8
  95. package/lib/plugins/EventPlugin.d.ts +1 -1
  96. package/lib/plugins/EventPlugin.js +172 -156
  97. package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
  98. package/lib/plugins/PrepareRendererPlugin.js +14 -14
  99. package/lib/services/EventService.d.ts +8 -0
  100. package/lib/services/EventService.js +274 -19
  101. package/lib/services/RenderingService.d.ts +17 -16
  102. package/lib/services/RenderingService.js +19 -18
  103. package/lib/services/SceneGraphService.js +3 -3
  104. package/lib/services/aabb/PathUpdater.d.ts +3 -3
  105. package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
  106. package/lib/services/aabb/RectUpdater.js +3 -3
  107. package/lib/types.d.ts +5 -3
  108. package/lib/utils/assert.d.ts +6 -0
  109. package/lib/utils/assert.js +30 -0
  110. package/lib/utils/event.d.ts +18 -16
  111. package/lib/utils/hooks.d.ts +280 -0
  112. package/lib/utils/hooks.js +759 -0
  113. package/lib/utils/index.d.ts +1 -0
  114. package/lib/utils/index.js +13 -0
  115. package/lib/utils/math.d.ts +1 -0
  116. package/lib/utils/math.js +17 -4
  117. package/lib/utils/string.d.ts +1 -0
  118. package/lib/utils/string.js +11 -0
  119. package/lib/utils/text.js +5 -3
  120. package/package.json +4 -7
  121. package/es/css/cssom/CSSMathInvert.d.ts +0 -14
  122. package/es/css/cssom/CSSMathInvert.js +0 -84
  123. package/es/css/cssom/CSSMathMax.d.ts +0 -17
  124. package/es/css/cssom/CSSMathMax.js +0 -118
  125. package/es/css/cssom/CSSMathMin.d.ts +0 -17
  126. package/es/css/cssom/CSSMathMin.js +0 -119
  127. package/es/css/cssom/CSSMathNegate.d.ts +0 -14
  128. package/es/css/cssom/CSSMathNegate.js +0 -80
  129. package/es/css/cssom/CSSMathProduct.d.ts +0 -16
  130. package/es/css/cssom/CSSMathProduct.js +0 -109
  131. package/es/css/cssom/CSSMathSum.d.ts +0 -17
  132. package/es/css/cssom/CSSMathSum.js +0 -117
  133. package/es/css/cssom/CSSMathValue.d.ts +0 -11
  134. package/es/css/cssom/CSSMathValue.js +0 -27
  135. package/es/css/cssom/CSSMathVariadic.d.ts +0 -9
  136. package/es/css/cssom/CSSMathVariadic.js +0 -44
  137. package/es/css/cssom/CSSUnitValue.d.ts +0 -33
  138. package/es/css/cssom/CSSUnitValue.js +0 -252
  139. package/lib/css/cssom/CSSMathInvert.d.ts +0 -14
  140. package/lib/css/cssom/CSSMathInvert.js +0 -94
  141. package/lib/css/cssom/CSSMathMax.d.ts +0 -17
  142. package/lib/css/cssom/CSSMathMax.js +0 -128
  143. package/lib/css/cssom/CSSMathMin.d.ts +0 -17
  144. package/lib/css/cssom/CSSMathMin.js +0 -128
  145. package/lib/css/cssom/CSSMathNegate.d.ts +0 -14
  146. package/lib/css/cssom/CSSMathNegate.js +0 -89
  147. package/lib/css/cssom/CSSMathProduct.d.ts +0 -16
  148. package/lib/css/cssom/CSSMathProduct.js +0 -119
  149. package/lib/css/cssom/CSSMathSum.d.ts +0 -17
  150. package/lib/css/cssom/CSSMathSum.js +0 -129
  151. package/lib/css/cssom/CSSMathValue.d.ts +0 -11
  152. package/lib/css/cssom/CSSMathValue.js +0 -35
  153. package/lib/css/cssom/CSSMathVariadic.d.ts +0 -9
  154. package/lib/css/cssom/CSSMathVariadic.js +0 -55
  155. package/lib/css/cssom/CSSUnitValue.d.ts +0 -33
  156. package/lib/css/cssom/CSSUnitValue.js +0 -267
@@ -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
- }
@@ -1,89 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CSSMathNegate = void 0;
7
-
8
- var _tslib = require("tslib");
9
-
10
- var _CSSMathValue = require("./CSSMathValue");
11
-
12
- var _ = require(".");
13
-
14
- var CSSMathNegate =
15
- /** @class */
16
- function (_super) {
17
- (0, _tslib.__extends)(CSSMathNegate, _super);
18
-
19
- function CSSMathNegate(value, type) {
20
- var _this = _super.call(this, type) || this;
21
-
22
- _this.value = value;
23
- _this.operator = 'negate';
24
- return _this;
25
- }
26
-
27
- CSSMathNegate.create = function (value) {
28
- return new CSSMathNegate(value, value.type_);
29
- };
30
-
31
- CSSMathNegate.prototype.clone = function () {
32
- return new CSSMathNegate(this.value, this.type_);
33
- };
34
-
35
- CSSMathNegate.prototype.getType = function () {
36
- return _.CSSStyleValueType.kNegateType;
37
- };
38
-
39
- CSSMathNegate.prototype.equals = function (other) {
40
- if (other.getType() !== _.CSSStyleValueType.kNegateType) {
41
- return false;
42
- }
43
-
44
- var other_invert = other;
45
- return this.value.equals(other_invert.value);
46
- };
47
-
48
- CSSMathNegate.prototype.sumValue = function () {
49
- var sum = this.value.sumValue();
50
-
51
- if (sum.length === 0) {
52
- return null;
53
- }
54
-
55
- sum.forEach(function (term) {
56
- term.value *= -1;
57
- });
58
- return sum;
59
- }; // toCalcExpressionNode(): CSSMathExpressionNode {
60
- // const right_side = this.value.toCalcExpressionNode();
61
- // if (!right_side) {
62
- // return null;
63
- // }
64
- // // return CSSMathExpressionOperation::CreateArithmeticOperationSimplified(
65
- // // CSSMathExpressionNumericLiteral::Create(
66
- // // -1, CSSPrimitiveValue::UnitType::kNumber),
67
- // // right_side, CSSMathOperator::kMultiply);
68
- // }
69
-
70
-
71
- CSSMathNegate.prototype.buildCSSText = function (nested, paren_less, result) {
72
- if (paren_less == _.ParenLess.kNo) {
73
- result += nested === _.Nested.kYes ? '(' : 'calc(';
74
- }
75
-
76
- result += '-';
77
- result = this.value.buildCSSText(_.Nested.kYes, _.ParenLess.kNo, result);
78
-
79
- if (paren_less === _.ParenLess.kNo) {
80
- result += ')';
81
- }
82
-
83
- return result;
84
- };
85
-
86
- return CSSMathNegate;
87
- }(_CSSMathValue.CSSMathValue);
88
-
89
- exports.CSSMathNegate = CSSMathNegate;
@@ -1,16 +0,0 @@
1
- import type { CSSNumericValue, CSSNumericSumValue, UnitMap } from '.';
2
- import { CSSMathVariadic } from './CSSMathVariadic';
3
- import { CSSStyleValueType, Nested, ParenLess } from '.';
4
- /**
5
- * Represents the product of one or more CSSNumericValues.
6
- * @see https://drafts.css-houdini.org/css-typed-om/#cssmathproduct
7
- */
8
- export declare class CSSMathProduct extends CSSMathVariadic {
9
- static create(values: CSSNumericValue[]): CSSMathProduct;
10
- static multiplyUnitMaps(a: UnitMap, b: UnitMap): UnitMap;
11
- operator: string;
12
- clone(): CSSMathProduct;
13
- getType(): CSSStyleValueType;
14
- sumValue(): CSSNumericSumValue;
15
- buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
16
- }
@@ -1,119 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CSSMathProduct = void 0;
7
-
8
- var _tslib = require("tslib");
9
-
10
- var _utils = require("../../utils");
11
-
12
- var _CSSMathVariadic = require("./CSSMathVariadic");
13
-
14
- var _ = require(".");
15
-
16
- /**
17
- * Represents the product of one or more CSSNumericValues.
18
- * @see https://drafts.css-houdini.org/css-typed-om/#cssmathproduct
19
- */
20
- var CSSMathProduct =
21
- /** @class */
22
- function (_super) {
23
- (0, _tslib.__extends)(CSSMathProduct, _super);
24
-
25
- function CSSMathProduct() {
26
- var _this = _super !== null && _super.apply(this, arguments) || this;
27
-
28
- _this.operator = 'product';
29
- return _this;
30
- }
31
-
32
- CSSMathProduct.create = function (values) {
33
- var error = false;
34
- var finalType = (0, _.typeCheck)(values, _.CSSNumericValueType.multiply, error);
35
- return error ? null : new CSSMathProduct(values, finalType);
36
- };
37
-
38
- CSSMathProduct.multiplyUnitMaps = function (a, b) {
39
- Object.keys(b).forEach(function (key) {
40
- (0, _utils.DCHECK_NE)(b[key].value, 0);
41
- var old_value = key in a ? a[key].value : 0;
42
-
43
- if (old_value + b[key].value === 0) {
44
- delete a[key];
45
- } else {
46
- a[key] = old_value + b[key].value;
47
- }
48
- });
49
- return a;
50
- };
51
-
52
- CSSMathProduct.prototype.clone = function () {
53
- return new CSSMathProduct(this.values, this.type_);
54
- };
55
-
56
- CSSMathProduct.prototype.getType = function () {
57
- return _.CSSStyleValueType.kProductType;
58
- }; // toCalcExpressionNode() {
59
- // return this.toCalcExporessionNodeForVariadic(CSSMathOperator.kMultiply);
60
- // }
61
-
62
-
63
- CSSMathProduct.prototype.sumValue = function () {
64
- var sum = [{
65
- value: 1,
66
- units: {}
67
- }];
68
- this.numericValues().forEach(function (value) {
69
- var child_sum = value.sumValue();
70
-
71
- if (!child_sum.length) {
72
- return null;
73
- }
74
-
75
- var new_sum = [];
76
- sum.forEach(function (a) {
77
- child_sum.forEach(function (b) {
78
- new_sum.push({
79
- value: a.value * b.value,
80
- units: CSSMathProduct.multiplyUnitMaps(a.units, b.units)
81
- });
82
- });
83
- });
84
- sum = new_sum;
85
- });
86
- return sum;
87
- };
88
-
89
- CSSMathProduct.prototype.buildCSSText = function (nested, paren_less, result) {
90
- if (paren_less == _.ParenLess.kNo) {
91
- result += nested === _.Nested.kYes ? '(' : 'calc(';
92
- }
93
-
94
- var values = this.numericValues();
95
- result = values[0].buildCSSText(_.Nested.kYes, _.ParenLess.kNo, result);
96
-
97
- for (var i = 1; i < values.length; i++) {
98
- var arg = values[i];
99
-
100
- if (arg.getType() === _.CSSStyleValueType.kInvertType) {
101
- result += ' / ';
102
- result = arg.value.buildCSSText(_.Nested.kYes, _.ParenLess.kNo, result);
103
- } else {
104
- result += ' * ';
105
- result = arg.buildCSSText(_.Nested.kYes, _.ParenLess.kNo, result);
106
- }
107
- }
108
-
109
- if (paren_less === _.ParenLess.kNo) {
110
- result += ')';
111
- }
112
-
113
- return result;
114
- };
115
-
116
- return CSSMathProduct;
117
- }(_CSSMathVariadic.CSSMathVariadic);
118
-
119
- exports.CSSMathProduct = CSSMathProduct;
@@ -1,17 +0,0 @@
1
- import type { CSSNumericValue, CSSNumericSumValue, UnitMap } from '.';
2
- import { CSSMathVariadic } from './CSSMathVariadic';
3
- import { CSSStyleValueType, CSSNumericValueType, Nested, ParenLess } from '.';
4
- /**
5
- * Represents the sum of one or more CSSNumericValues.
6
- * @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
7
- */
8
- export declare class CSSMathSum extends CSSMathVariadic {
9
- static create(values: CSSNumericValue[]): CSSMathSum;
10
- static numericTypeFromUnitMap(units: UnitMap): CSSNumericValueType;
11
- static canCreateNumericTypeFromSumValue(sum: CSSNumericSumValue): boolean;
12
- operator: string;
13
- clone(): CSSMathSum;
14
- getType(): CSSStyleValueType;
15
- sumValue(): CSSNumericSumValue;
16
- buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
17
- }