@antv/g 5.0.23-alpha.10 → 5.0.23-alpha.13

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.
@@ -1,7 +1,8 @@
1
1
  import { __decorate, __metadata, __read, __spreadArray } from "tslib";
2
2
  import { postConstruct, singleton, GlobalContainer } from 'mana-syringe';
3
3
  import { vec3 } from 'gl-matrix';
4
- import { dirtifyToRoot, GeometryUpdaterFactory } from '../services';
4
+ import { GeometryUpdaterFactory } from '../services/aabb/interfaces';
5
+ import { dirtifyToRoot } from '../services/SceneGraphService';
5
6
  import { ElementEvent } from '../dom';
6
7
  import { Shape } from '../types';
7
8
  import { CSSKeywordValue, CSSStyleValue, CSSUnitValue } from './cssom';
@@ -409,7 +410,9 @@ export var BUILT_IN_PROPERTIES = [{
409
410
  }, {
410
411
  name: 'whiteSpace',
411
412
  layoutDependent: true
412
- }];
413
+ }]; // export const StyleValueRegistryContribution = Syringe.defineToken('StyleValueRegistry', {
414
+ // multiple: false,
415
+ // });
413
416
 
414
417
  var StyleValueRegistry =
415
418
  /** @class */
@@ -1,5 +1,5 @@
1
1
  import { __assign, __extends, __read, __spreadArray, __values } from "tslib";
2
- import { DCHECK, DCHECK_EQ, DCHECK_NE } from '../../utils';
2
+ import { DCHECK, DCHECK_EQ, DCHECK_NE } from '../../utils/assert';
3
3
  import { CSSMathOperator } from './CSSMathOperator';
4
4
  import { CSSStyleValue, CSSStyleValueType } from './CSSStyleValue';
5
5
  import { Nested, ParenLess, UnitType } from './types'; // https://drafts.css-houdini.org/css-typed-om/#enumdef-cssnumericbasetype
@@ -50,7 +50,8 @@ export var containerModule = Module(function (register) {
50
50
  }); // bind CSS property handlers
51
51
 
52
52
  register(LayoutRegistry);
53
- register(StyleValueRegistry);
53
+ register(StyleValueRegistry); // register({ token: StyleValueRegistryContribution, useClass: StyleValueRegistry });
54
+
54
55
  register(CSSPropertyLengthOrPercentage);
55
56
  register(CSSPropertyLocalPosition);
56
57
  register(CSSPropertyOpacity);
@@ -28,6 +28,7 @@ function () {
28
28
 
29
29
  _this.styleValueRegistry.recalc(object);
30
30
 
31
+ console.log(object);
31
32
  dirtifyToRoot(object);
32
33
  renderingService.dirtify();
33
34
  };
@@ -11,7 +11,9 @@ var _manaSyringe = require("mana-syringe");
11
11
 
12
12
  var _glMatrix = require("gl-matrix");
13
13
 
14
- var _services = require("../services");
14
+ var _interfaces = require("../services/aabb/interfaces");
15
+
16
+ var _SceneGraphService = require("../services/SceneGraphService");
15
17
 
16
18
  var _dom = require("../dom");
17
19
 
@@ -428,7 +430,10 @@ var BUILT_IN_PROPERTIES = [{
428
430
  }, {
429
431
  name: 'whiteSpace',
430
432
  layoutDependent: true
431
- }];
433
+ }]; // export const StyleValueRegistryContribution = Syringe.defineToken('StyleValueRegistry', {
434
+ // multiple: false,
435
+ // });
436
+
432
437
  exports.BUILT_IN_PROPERTIES = BUILT_IN_PROPERTIES;
433
438
 
434
439
  var StyleValueRegistry =
@@ -761,7 +766,7 @@ function () {
761
766
  StyleValueRegistry.prototype.updateGeometry = function (object) {
762
767
  var _a;
763
768
 
764
- var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_services.GeometryUpdaterFactory);
769
+ var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_interfaces.GeometryUpdaterFactory);
765
770
 
766
771
  var geometryUpdater = geometryUpdaterFactory(object.nodeName);
767
772
 
@@ -892,7 +897,7 @@ function () {
892
897
  usedOriginYValue -= (anchor && anchor[1].value || 0) * geometry_1.contentBounds.halfExtents[1] * 2;
893
898
  object.setOrigin(usedOriginXValue, usedOriginYValue);
894
899
  object.emit(_dom.ElementEvent.GEOMETRY_BOUNDS_CHANGED, {});
895
- (0, _services.dirtifyToRoot)(object);
900
+ (0, _SceneGraphService.dirtifyToRoot)(object);
896
901
  }
897
902
  };
898
903
 
@@ -10,7 +10,7 @@ exports.unitTypeToBaseType = unitTypeToBaseType;
10
10
 
11
11
  var _tslib = require("tslib");
12
12
 
13
- var _utils = require("../../utils");
13
+ var _assert = require("../../utils/assert");
14
14
 
15
15
  var _CSSMathOperator = require("./CSSMathOperator");
16
16
 
@@ -34,7 +34,7 @@ exports.BaseType = BaseType;
34
34
  })(BaseType || (exports.BaseType = BaseType = {}));
35
35
 
36
36
  function unitTypeToBaseType(unit) {
37
- (0, _utils.DCHECK_NE)(unit, _types.UnitType.kNumber);
37
+ (0, _assert.DCHECK_NE)(unit, _types.UnitType.kNumber);
38
38
 
39
39
  switch (unit) {
40
40
  case _types.UnitType.kEms:
@@ -165,7 +165,7 @@ function () {
165
165
  }
166
166
 
167
167
  CSSNumericValueType.prototype.applyPercentHint = function (hint) {
168
- (0, _utils.DCHECK_NE)(hint, BaseType.kPercent);
168
+ (0, _assert.DCHECK_NE)(hint, BaseType.kPercent);
169
169
  this.setExponent(hint, this.exponent(hint) + this.exponent(BaseType.kPercent));
170
170
  this.setExponent(BaseType.kPercent, 0);
171
171
  this.percentHint = hint;
@@ -177,7 +177,7 @@ function () {
177
177
  };
178
178
 
179
179
  CSSNumericValueType.prototype.isOnlyNonZeroEntry = function (baseType, value) {
180
- (0, _utils.DCHECK_NE)(value, 0);
180
+ (0, _assert.DCHECK_NE)(value, 0);
181
181
  return this.numNonZeroEntries === 1 && this.exponent(baseType) === value;
182
182
  };
183
183
 
@@ -205,7 +205,7 @@ function () {
205
205
  };
206
206
 
207
207
  CSSNumericValueType.prototype.matchesBaseType = function (baseType) {
208
- (0, _utils.DCHECK_NE)(baseType, BaseType.kPercent);
208
+ (0, _assert.DCHECK_NE)(baseType, BaseType.kPercent);
209
209
  return this.isOnlyNonZeroEntry(baseType, 1) && !this.hasPercentHint;
210
210
  };
211
211
 
@@ -214,7 +214,7 @@ function () {
214
214
  };
215
215
 
216
216
  CSSNumericValueType.prototype.matchesBaseTypePercentage = function (baseType) {
217
- (0, _utils.DCHECK_NE)(baseType, BaseType.kPercent);
217
+ (0, _assert.DCHECK_NE)(baseType, BaseType.kPercent);
218
218
  return this.isOnlyNonZeroEntry(baseType, 1) || this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
219
219
  };
220
220
 
@@ -233,7 +233,7 @@ function () {
233
233
  }
234
234
 
235
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
236
+ (0, _assert.DCHECK_EQ)(type1.percentHint, type2.percentHint); // Match up base types. Try to use the percent hint to match up any
237
237
  // differences.
238
238
 
239
239
  for (var i = 0; i < BaseType.kNumBaseTypes; ++i) {
@@ -567,7 +567,7 @@ function (_super) {
567
567
  }); // We got 'values' from a sum value, so it must be a valid CSSMathSum.
568
568
 
569
569
  var result_1 = CSSMathSum.create(values);
570
- (0, _utils.DCHECK)(!!result_1);
570
+ (0, _assert.DCHECK)(!!result_1);
571
571
  return result_1;
572
572
  }
573
573
 
@@ -575,7 +575,7 @@ function (_super) {
575
575
 
576
576
  var _loop_1 = function _loop_1(unit_string) {
577
577
  var target_unit = CSSNumericValue.unitFromName(unit_string);
578
- (0, _utils.DCHECK)(CSSNumericValue.isValidUnit(target_unit)); // Collect all the terms that are compatible with this unit.
578
+ (0, _assert.DCHECK)(CSSNumericValue.isValidUnit(target_unit)); // Collect all the terms that are compatible with this unit.
579
579
  // We mark used terms as null so we don't use them again.
580
580
 
581
581
  var total_value = values.reduce(function (cur_sum, value, i) {
@@ -710,7 +710,7 @@ function cssNumberishesToNumericValues(values) {
710
710
  }
711
711
 
712
712
  function prependValueForArithmetic(type, values, value) {
713
- (0, _utils.DCHECK)(!!value);
713
+ (0, _assert.DCHECK)(!!value);
714
714
 
715
715
  if (value.getType() === type) {
716
716
  values.unshift.apply(values, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(value.numericValues()), false));
@@ -732,7 +732,7 @@ function cssNumericSumValueEntryToUnitValue(term) {
732
732
  }
733
733
 
734
734
  function maybeSimplifyAsUnitValue(values, operator) {
735
- (0, _utils.DCHECK)(!!values.length);
735
+ (0, _assert.DCHECK)(!!values.length);
736
736
  var first_unit_value = values[0] instanceof CSSUnitValue ? values[0] : null;
737
737
  if (!first_unit_value) return null;
738
738
  var final_value = first_unit_value.value;
@@ -754,7 +754,7 @@ function maybeSimplifyAsUnitValue(values, operator) {
754
754
  }
755
755
 
756
756
  function maybeMultiplyAsUnitValue(values) {
757
- (0, _utils.DCHECK)(!!values.length); // We are allowed one unit value with type other than kNumber.
757
+ (0, _assert.DCHECK)(!!values.length); // We are allowed one unit value with type other than kNumber.
758
758
 
759
759
  var unit_other_than_number = _types.UnitType.kNumber;
760
760
  var final_value = 1.0;
@@ -800,7 +800,7 @@ function (_super) {
800
800
  unit = unitOrName;
801
801
  }
802
802
 
803
- (0, _utils.DCHECK)(CSSUnitValue.isValidUnit(unit));
803
+ (0, _assert.DCHECK)(CSSUnitValue.isValidUnit(unit));
804
804
  _this = _super.call(this, new CSSNumericValueType(unit)) || this;
805
805
  _this.unit = unit;
806
806
  _this.value = value;
@@ -833,7 +833,7 @@ function (_super) {
833
833
  if (!Number.isFinite(number)) {
834
834
  if (number > 0) result = 'infinity';else result = '-infinity';
835
835
  } else {
836
- (0, _utils.DCHECK)(Number.isNaN(number));
836
+ (0, _assert.DCHECK)(Number.isNaN(number));
837
837
  result = 'NaN';
838
838
  }
839
839
 
@@ -1490,7 +1490,7 @@ function (_super) {
1490
1490
  var exp = units[key];
1491
1491
  var error = false;
1492
1492
  type = CSSNumericValueType.multiply(type, new CSSNumericValueType(Number(key), exp), error);
1493
- (0, _utils.DCHECK)(!error);
1493
+ (0, _assert.DCHECK)(!error);
1494
1494
  });
1495
1495
  return type;
1496
1496
  };
@@ -1498,7 +1498,7 @@ function (_super) {
1498
1498
  CSSMathSum.canCreateNumericTypeFromSumValue = function (sum) {
1499
1499
  var _this = this;
1500
1500
 
1501
- (0, _utils.DCHECK)(!!sum.length);
1501
+ (0, _assert.DCHECK)(!!sum.length);
1502
1502
  var first_type = this.numericTypeFromUnitMap(sum[0].units);
1503
1503
  return sum.every(function (term) {
1504
1504
  var error = false;
@@ -1599,7 +1599,7 @@ function (_super) {
1599
1599
 
1600
1600
  CSSMathProduct.multiplyUnitMaps = function (a, b) {
1601
1601
  Object.keys(b).forEach(function (key) {
1602
- (0, _utils.DCHECK_NE)(b[key].value, 0);
1602
+ (0, _assert.DCHECK_NE)(b[key].value, 0);
1603
1603
  var old_value = key in a ? a[key].value : 0;
1604
1604
 
1605
1605
  if (old_value + b[key].value === 0) {
@@ -62,7 +62,8 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
62
62
  }); // bind CSS property handlers
63
63
 
64
64
  register(_css.LayoutRegistry);
65
- register(_css.StyleValueRegistry);
65
+ register(_css.StyleValueRegistry); // register({ token: StyleValueRegistryContribution, useClass: StyleValueRegistry });
66
+
66
67
  register(_css.CSSPropertyLengthOrPercentage);
67
68
  register(_css.CSSPropertyLocalPosition);
68
69
  register(_css.CSSPropertyOpacity);
@@ -39,6 +39,7 @@ function () {
39
39
 
40
40
  _this.styleValueRegistry.recalc(object);
41
41
 
42
+ console.log(object);
42
43
  (0, _services.dirtifyToRoot)(object);
43
44
  renderingService.dirtify();
44
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.23-alpha.10",
3
+ "version": "5.0.23-alpha.13",
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.10",
41
+ "@antv/g-math": "^1.0.20-alpha.13",
42
42
  "@antv/util": "^3.0.0",
43
43
  "@types/offscreencanvas": "^2019.6.4",
44
44
  "d3-color": "^1.4.0",