@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
@@ -6,3 +6,4 @@ export * from './text';
6
6
  export * from './string';
7
7
  export * from './event';
8
8
  export * from './canvas';
9
+ export * from './hooks';
@@ -106,4 +106,17 @@ Object.keys(_canvas).forEach(function (key) {
106
106
  return _canvas[key];
107
107
  }
108
108
  });
109
+ });
110
+
111
+ var _hooks = require("./hooks");
112
+
113
+ Object.keys(_hooks).forEach(function (key) {
114
+ if (key === "default" || key === "__esModule") return;
115
+ if (key in exports && exports[key] === _hooks[key]) return;
116
+ Object.defineProperty(exports, key, {
117
+ enumerable: true,
118
+ get: function get() {
119
+ return _hooks[key];
120
+ }
121
+ });
109
122
  });
@@ -1,5 +1,6 @@
1
1
  import type { quat, vec2, vec4 } from 'gl-matrix';
2
2
  import { mat3, mat4, vec3 } from 'gl-matrix';
3
+ export declare function clamp(number: number, boundOne: number, boundTwo: number): number;
3
4
  export declare function getAngle(angle?: number): number;
4
5
  export declare function createVec3(x: number | vec2 | vec3 | vec4, y?: number, z?: number): vec3;
5
6
  export declare function deg2rad(deg: number): number;
package/lib/utils/math.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.clamp = clamp;
6
7
  exports.createVec3 = createVec3;
7
8
  exports.decompose = decompose;
8
9
  exports.deg2rad = deg2rad;
@@ -20,10 +21,22 @@ exports.turn2deg = turn2deg;
20
21
 
21
22
  var _tslib = require("tslib");
22
23
 
23
- var _lodashEs = require("lodash-es");
24
-
25
24
  var _glMatrix = require("gl-matrix");
26
25
 
26
+ var _assert = require("./assert");
27
+
28
+ function clamp(number, boundOne, boundTwo) {
29
+ if (!boundTwo) {
30
+ return Math.max(number, boundOne) === boundOne ? number : boundOne;
31
+ } else if (Math.min(number, boundOne) === number) {
32
+ return boundOne;
33
+ } else if (Math.max(number, boundTwo) === number) {
34
+ return boundTwo;
35
+ }
36
+
37
+ return number;
38
+ }
39
+
27
40
  function getAngle(angle) {
28
41
  if (angle === undefined) {
29
42
  return 0;
@@ -43,11 +56,11 @@ function createVec3(x, y, z) {
43
56
  z = 0;
44
57
  }
45
58
 
46
- if ((0, _lodashEs.isNumber)(x)) {
59
+ if ((0, _assert.isNumber)(x)) {
47
60
  return _glMatrix.vec3.fromValues(x, y, z);
48
61
  }
49
62
 
50
- if ((0, _lodashEs.isArray)(x) && x.length === 3) {
63
+ if (Array.isArray(x) && x.length === 3) {
51
64
  return _glMatrix.vec3.clone(x);
52
65
  }
53
66
 
@@ -1 +1,2 @@
1
1
  export declare function camelCase(str?: string): string;
2
+ export declare function isString(str: any): str is string;
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.camelCase = camelCase;
7
+ exports.isString = isString;
8
+
9
+ var _assert = require("./assert");
7
10
 
8
11
  function camelCase(str) {
9
12
  if (str === void 0) {
@@ -13,4 +16,12 @@ function camelCase(str) {
13
16
  return str.replace(/-([a-z])/g, function (g) {
14
17
  return g[1].toUpperCase();
15
18
  });
19
+ }
20
+
21
+ function isString(str) {
22
+ if (!(0, _assert.isNil)(str) && typeof str === 'string') {
23
+ return true;
24
+ }
25
+
26
+ return false;
16
27
  }
package/lib/utils/text.js CHANGED
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toFontString = toFontString;
7
7
 
8
- var _lodashEs = require("lodash-es");
8
+ var _assert = require("./assert");
9
+
10
+ var _string = require("./string");
9
11
 
10
12
  var genericFontFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui'];
11
13
 
@@ -16,11 +18,11 @@ function toFontString(attributes) {
16
18
  fontVariant = attributes.fontVariant,
17
19
  fontWeight = attributes.fontWeight; // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
18
20
 
19
- var fontSizeString = (0, _lodashEs.isNumber)(fontSize) ? "".concat(fontSize, "px") : fontSize.toString(); // Clean-up fontFamily property by quoting each font name
21
+ var fontSizeString = (0, _assert.isNumber)(fontSize) ? "".concat(fontSize, "px") : fontSize.toString(); // Clean-up fontFamily property by quoting each font name
20
22
  // this will support font names with spaces
21
23
  // @ts-ignore
22
24
 
23
- var fontFamilies = (0, _lodashEs.isString)(fontFamily) ? fontFamily.split(',') : [fontFamily.value];
25
+ var fontFamilies = (0, _string.isString)(fontFamily) ? fontFamily.split(',') : [fontFamily.value];
24
26
 
25
27
  for (var i = fontFamilies.length - 1; i >= 0; i--) {
26
28
  // Trim any extra white-space
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.22",
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",
@@ -34,26 +34,23 @@
34
34
  "devDependencies": {
35
35
  "@types/d3-color": "^3.0.2",
36
36
  "@types/gl-matrix": "^2.4.5",
37
- "@types/lodash-es": "^4.17.6",
38
37
  "@types/offscreencanvas": "^2019.6.1"
39
38
  },
40
39
  "homepage": "https://github.com/antvis/g#readme",
41
40
  "dependencies": {
42
- "@antv/g-math": "^1.0.19",
43
- "@antv/path-util": "^3.0.1",
41
+ "@antv/g-math": "^1.0.20-alpha.4",
42
+ "@antv/util": "^3.0.0",
44
43
  "@types/offscreencanvas": "^2019.6.4",
45
44
  "d3-color": "^1.4.0",
46
45
  "eventemitter3": "^4.0.0",
47
46
  "gl-matrix": "^3.1.0",
48
- "lodash-es": "^4.17.21",
49
47
  "mana-syringe": "^0.3.0",
50
48
  "reflect-metadata": "^0.1.13",
51
49
  "request-animation-frame-polyfill": "^1.1.2",
52
- "tapable": "^2.2.1",
53
50
  "tslib": "^2.3.1"
54
51
  },
55
52
  "scripts": {
56
53
  "umd": "webpack"
57
54
  },
58
- "gitHead": "a52a7c8d754925e5732baf3faea156332748365f"
55
+ "gitHead": "07a45d1dcaeda55f64acd5486b1c19d132fac8bc"
59
56
  }
@@ -1,14 +0,0 @@
1
- import { CSSMathValue } from './CSSMathValue';
2
- import type { CSSNumericSumValue, CSSNumericValue } from '.';
3
- import { CSSNumericValueType, CSSStyleValueType, Nested, ParenLess } from '.';
4
- export declare class CSSMathInvert extends CSSMathValue {
5
- private value;
6
- static create(value: CSSNumericValue): CSSMathInvert;
7
- constructor(value: CSSNumericValue, type: CSSNumericValueType);
8
- operator: string;
9
- clone(): CSSMathInvert;
10
- getType(): CSSStyleValueType;
11
- equals(other: CSSNumericValue): any;
12
- sumValue(): CSSNumericSumValue;
13
- buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
14
- }
@@ -1,84 +0,0 @@
1
- import { __extends } from "tslib";
2
- import { CSSMathValue } from './CSSMathValue';
3
- import { CSSNumericValueType, CSSStyleValueType, Nested, ParenLess } from '.';
4
-
5
- var CSSMathInvert =
6
- /** @class */
7
- function (_super) {
8
- __extends(CSSMathInvert, _super);
9
-
10
- function CSSMathInvert(value, type) {
11
- var _this = _super.call(this, type) || this;
12
-
13
- _this.value = value;
14
- _this.operator = 'invert';
15
- return _this;
16
- }
17
-
18
- CSSMathInvert.create = function (value) {
19
- var type = CSSNumericValueType.negateExponents(value.type_);
20
- return new CSSMathInvert(value, type);
21
- };
22
-
23
- CSSMathInvert.prototype.clone = function () {
24
- return new CSSMathInvert(this.value, this.type_);
25
- };
26
-
27
- CSSMathInvert.prototype.getType = function () {
28
- return CSSStyleValueType.kInvertType;
29
- };
30
-
31
- CSSMathInvert.prototype.equals = function (other) {
32
- if (other.getType() !== CSSStyleValueType.kInvertType) {
33
- return false;
34
- } // We can safely cast here as we know 'other' has the same type as us.
35
-
36
-
37
- var other_invert = other;
38
- return this.value.equals(other_invert.value);
39
- };
40
-
41
- CSSMathInvert.prototype.sumValue = function () {
42
- var sum = this.value.sumValue();
43
-
44
- if (sum.length === 0 || sum.length !== 1 || sum[0].value === 0) {
45
- return null;
46
- }
47
-
48
- Object.keys(sum[0].units).forEach(function (key) {
49
- sum[0].units[key] *= -1;
50
- });
51
- sum[0].value = 1.0 / sum[0].value;
52
- return sum;
53
- }; // toCalcExpressionNode(): CSSMathExpressionNode {
54
- // const right_side = this.value.toCalcExpressionNode();
55
- // if (!right_side) {
56
- // return null;
57
- // }
58
- // // return CSSMathExpressionOperation::CreateArithmeticOperation(
59
- // // CSSMathExpressionNumericLiteral::Create(
60
- // // 1, UnitType.kNumber),
61
- // // right_side, CSSMathOperator.kDivide);
62
- // return null;
63
- // }
64
-
65
-
66
- CSSMathInvert.prototype.buildCSSText = function (nested, paren_less, result) {
67
- if (paren_less == ParenLess.kNo) {
68
- result += nested === Nested.kYes ? '(' : 'calc(';
69
- }
70
-
71
- result += '1 / ';
72
- result = this.value.buildCSSText(Nested.kYes, ParenLess.kNo, result);
73
-
74
- if (paren_less === ParenLess.kNo) {
75
- result += ')';
76
- }
77
-
78
- return result;
79
- };
80
-
81
- return CSSMathInvert;
82
- }(CSSMathValue);
83
-
84
- export { CSSMathInvert };
@@ -1,17 +0,0 @@
1
- /**
2
- * The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
3
- * It inherits properties and methods from its parent CSSNumericValue.
4
- * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
5
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMax
6
- */
7
- import { CSSMathVariadic } from './CSSMathVariadic';
8
- import type { CSSNumericValue, CSSNumericSumValue } from '.';
9
- import { Nested, ParenLess, CSSStyleValueType } from '.';
10
- export declare class CSSMathMax extends CSSMathVariadic {
11
- static create(values: CSSNumericValue[]): CSSMathMax;
12
- operator: string;
13
- clone(): CSSMathMax;
14
- getType(): CSSStyleValueType;
15
- sumValue(): CSSNumericSumValue;
16
- buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
17
- }
@@ -1,118 +0,0 @@
1
- /**
2
- * The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
3
- * It inherits properties and methods from its parent CSSNumericValue.
4
- * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
5
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMax
6
- */
7
- import { __extends, __values } from "tslib";
8
- import { CSSMathVariadic } from './CSSMathVariadic';
9
- import { Nested, ParenLess, CSSNumericValueType, CSSStyleValueType, typeCheck } from '.'; // Represents the maximum of one or more CSSNumericValues.
10
- // @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
11
-
12
- var CSSMathMax =
13
- /** @class */
14
- function (_super) {
15
- __extends(CSSMathMax, _super);
16
-
17
- function CSSMathMax() {
18
- var _this = _super !== null && _super.apply(this, arguments) || this;
19
-
20
- _this.operator = 'max';
21
- return _this;
22
- }
23
-
24
- CSSMathMax.create = function (values) {
25
- var error = false;
26
- var final_type = typeCheck(values, CSSNumericValueType.add, error);
27
- return error ? null : new CSSMathMax(values, final_type);
28
- };
29
-
30
- CSSMathMax.prototype.clone = function () {
31
- return new CSSMathMax(this.values, this.type_);
32
- };
33
-
34
- CSSMathMax.prototype.getType = function () {
35
- return CSSStyleValueType.kMaxType;
36
- };
37
-
38
- CSSMathMax.prototype.sumValue = function () {
39
- var e_1, _a;
40
-
41
- var cur_max = this.numericValues()[0].sumValue();
42
-
43
- if (!cur_max.length) {
44
- return null;
45
- }
46
-
47
- try {
48
- for (var _b = __values(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
49
- var value = _c.value;
50
- var child_sum = value.sumValue();
51
-
52
- if (!child_sum.length || JSON.stringify(child_sum[0].units) !== JSON.stringify(cur_max[0].units)) {
53
- return null;
54
- }
55
-
56
- if (child_sum[0].value < cur_max[0].value) {
57
- cur_max = child_sum;
58
- }
59
- }
60
- } catch (e_1_1) {
61
- e_1 = {
62
- error: e_1_1
63
- };
64
- } finally {
65
- try {
66
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
67
- } finally {
68
- if (e_1) throw e_1.error;
69
- }
70
- }
71
-
72
- return cur_max;
73
- }; // toCalcExpressionNode() {
74
- // const operands: CSSMathExpressionOperation[] = [];
75
- // for (const value of this.numericValues()) {
76
- // const operand = value.toCalcExpressionNode();
77
- // if (!operand) {
78
- // continue;
79
- // }
80
- // operands.push(operand as CSSMathExpressionOperation);
81
- // }
82
- // return CSSMathExpressionOperation.createComparisonFunction(operands, CSSMathOperator.kMax);
83
- // }
84
-
85
-
86
- CSSMathMax.prototype.buildCSSText = function (nested, paren_less, result) {
87
- var e_2, _a;
88
-
89
- result += 'max(';
90
- var first_iteration = true;
91
-
92
- try {
93
- for (var _b = __values(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
94
- var value = _c.value;
95
- if (!first_iteration) result += ', ';
96
- first_iteration = false;
97
- result = value.buildCSSText(Nested.kYes, ParenLess.kYes, result);
98
- }
99
- } catch (e_2_1) {
100
- e_2 = {
101
- error: e_2_1
102
- };
103
- } finally {
104
- try {
105
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
106
- } finally {
107
- if (e_2) throw e_2.error;
108
- }
109
- }
110
-
111
- result += ')';
112
- return result;
113
- };
114
-
115
- return CSSMathMax;
116
- }(CSSMathVariadic);
117
-
118
- export { CSSMathMax };
@@ -1,17 +0,0 @@
1
- /**
2
- * The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
3
- * It inherits properties and methods from its parent CSSNumericValue.
4
- * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
5
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMin
6
- */
7
- import { CSSMathVariadic } from './CSSMathVariadic';
8
- import type { CSSNumericValue, CSSNumericSumValue } from '.';
9
- import { CSSStyleValueType, Nested, ParenLess } from '.';
10
- export declare class CSSMathMin extends CSSMathVariadic {
11
- static create(values: CSSNumericValue[]): CSSMathMin;
12
- operator: string;
13
- clone(): CSSMathMin;
14
- getType(): CSSStyleValueType;
15
- sumValue(): CSSNumericSumValue;
16
- buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
17
- }
@@ -1,119 +0,0 @@
1
- import { __extends, __values } from "tslib";
2
- /**
3
- * The CSSMathMin interface of the CSS_Object_Model represents the CSS min() function.
4
- * It inherits properties and methods from its parent CSSNumericValue.
5
- * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_min.idl
6
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMin
7
- */
8
-
9
- import { CSSMathVariadic } from './CSSMathVariadic';
10
- import { CSSNumericValueType, CSSStyleValueType, typeCheck, Nested, ParenLess } from '.'; // Represents the minimum of one or more CSSNumericValues.
11
- // @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
12
-
13
- var CSSMathMin =
14
- /** @class */
15
- function (_super) {
16
- __extends(CSSMathMin, _super);
17
-
18
- function CSSMathMin() {
19
- var _this = _super !== null && _super.apply(this, arguments) || this;
20
-
21
- _this.operator = 'min';
22
- return _this;
23
- }
24
-
25
- CSSMathMin.create = function (values) {
26
- var error = false;
27
- var final_type = typeCheck(values, CSSNumericValueType.add, error);
28
- return error ? null : new CSSMathMin(values, final_type);
29
- };
30
-
31
- CSSMathMin.prototype.clone = function () {
32
- return new CSSMathMin(this.values, this.type_);
33
- };
34
-
35
- CSSMathMin.prototype.getType = function () {
36
- return CSSStyleValueType.kMinType;
37
- };
38
-
39
- CSSMathMin.prototype.sumValue = function () {
40
- var e_1, _a;
41
-
42
- var cur_min = this.numericValues()[0].sumValue();
43
-
44
- if (!cur_min.length) {
45
- return null;
46
- }
47
-
48
- try {
49
- for (var _b = __values(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
50
- var value = _c.value;
51
- var child_sum = value.sumValue();
52
-
53
- if (!child_sum.length || JSON.stringify(child_sum[0].units) !== JSON.stringify(cur_min[0].units)) {
54
- return null;
55
- }
56
-
57
- if (child_sum[0].value < cur_min[0].value) {
58
- cur_min = child_sum;
59
- }
60
- }
61
- } catch (e_1_1) {
62
- e_1 = {
63
- error: e_1_1
64
- };
65
- } finally {
66
- try {
67
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
68
- } finally {
69
- if (e_1) throw e_1.error;
70
- }
71
- }
72
-
73
- return cur_min;
74
- }; // toCalcExpressionNode() {
75
- // const operands: CSSMathExpressionOperation[] = [];
76
- // for (const value of this.numericValues()) {
77
- // const operand = value.toCalcExpressionNode();
78
- // if (!operand) {
79
- // continue;
80
- // }
81
- // operands.push(operand as CSSMathExpressionOperation);
82
- // }
83
- // return CSSMathExpressionOperation.createComparisonFunction(operands, CSSMathOperator.kMin);
84
- // }
85
-
86
-
87
- CSSMathMin.prototype.buildCSSText = function (nested, paren_less, result) {
88
- var e_2, _a;
89
-
90
- result += 'min(';
91
- var first_iteration = true;
92
-
93
- try {
94
- for (var _b = __values(this.numericValues()), _c = _b.next(); !_c.done; _c = _b.next()) {
95
- var value = _c.value;
96
- if (!first_iteration) result += ', ';
97
- first_iteration = false;
98
- result = value.buildCSSText(Nested.kYes, ParenLess.kYes, result);
99
- }
100
- } catch (e_2_1) {
101
- e_2 = {
102
- error: e_2_1
103
- };
104
- } finally {
105
- try {
106
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
107
- } finally {
108
- if (e_2) throw e_2.error;
109
- }
110
- }
111
-
112
- result += ')';
113
- return result;
114
- };
115
-
116
- return CSSMathMin;
117
- }(CSSMathVariadic);
118
-
119
- export { 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,80 +0,0 @@
1
- import { __extends } from "tslib";
2
- import { CSSMathValue } from './CSSMathValue';
3
- import { Nested, ParenLess, CSSStyleValueType } from '.';
4
-
5
- var CSSMathNegate =
6
- /** @class */
7
- function (_super) {
8
- __extends(CSSMathNegate, _super);
9
-
10
- function CSSMathNegate(value, type) {
11
- var _this = _super.call(this, type) || this;
12
-
13
- _this.value = value;
14
- _this.operator = 'negate';
15
- return _this;
16
- }
17
-
18
- CSSMathNegate.create = function (value) {
19
- return new CSSMathNegate(value, value.type_);
20
- };
21
-
22
- CSSMathNegate.prototype.clone = function () {
23
- return new CSSMathNegate(this.value, this.type_);
24
- };
25
-
26
- CSSMathNegate.prototype.getType = function () {
27
- return CSSStyleValueType.kNegateType;
28
- };
29
-
30
- CSSMathNegate.prototype.equals = function (other) {
31
- if (other.getType() !== CSSStyleValueType.kNegateType) {
32
- return false;
33
- }
34
-
35
- var other_invert = other;
36
- return this.value.equals(other_invert.value);
37
- };
38
-
39
- CSSMathNegate.prototype.sumValue = function () {
40
- var sum = this.value.sumValue();
41
-
42
- if (sum.length === 0) {
43
- return null;
44
- }
45
-
46
- sum.forEach(function (term) {
47
- term.value *= -1;
48
- });
49
- return sum;
50
- }; // toCalcExpressionNode(): CSSMathExpressionNode {
51
- // const right_side = this.value.toCalcExpressionNode();
52
- // if (!right_side) {
53
- // return null;
54
- // }
55
- // // return CSSMathExpressionOperation::CreateArithmeticOperationSimplified(
56
- // // CSSMathExpressionNumericLiteral::Create(
57
- // // -1, CSSPrimitiveValue::UnitType::kNumber),
58
- // // right_side, CSSMathOperator::kMultiply);
59
- // }
60
-
61
-
62
- CSSMathNegate.prototype.buildCSSText = function (nested, paren_less, result) {
63
- if (paren_less == ParenLess.kNo) {
64
- result += nested === Nested.kYes ? '(' : 'calc(';
65
- }
66
-
67
- result += '-';
68
- result = this.value.buildCSSText(Nested.kYes, ParenLess.kNo, result);
69
-
70
- if (paren_less === ParenLess.kNo) {
71
- result += ')';
72
- }
73
-
74
- return result;
75
- };
76
-
77
- return CSSMathNegate;
78
- }(CSSMathValue);
79
-
80
- export { 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
- }