@antv/g-lite 1.0.37 → 1.0.39

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 (44) hide show
  1. package/dist/css/CSSProperty.d.ts +1 -0
  2. package/dist/css/CSSProperty.d.ts.map +1 -1
  3. package/dist/css/StyleValueRegistry.d.ts.map +1 -1
  4. package/dist/css/properties/CSSPropertyAngle.d.ts +1 -0
  5. package/dist/css/properties/CSSPropertyAngle.d.ts.map +1 -1
  6. package/dist/css/properties/CSSPropertyColor.d.ts +4 -0
  7. package/dist/css/properties/CSSPropertyColor.d.ts.map +1 -1
  8. package/dist/css/properties/CSSPropertyFilter.d.ts.map +1 -1
  9. package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -0
  10. package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts.map +1 -1
  11. package/dist/css/properties/CSSPropertyNumber.d.ts +1 -0
  12. package/dist/css/properties/CSSPropertyNumber.d.ts.map +1 -1
  13. package/dist/css/properties/CSSPropertyOffsetDistance.d.ts +1 -0
  14. package/dist/css/properties/CSSPropertyOffsetDistance.d.ts.map +1 -1
  15. package/dist/css/properties/CSSPropertyOpacity.d.ts +1 -0
  16. package/dist/css/properties/CSSPropertyOpacity.d.ts.map +1 -1
  17. package/dist/css/properties/CSSPropertyPath.d.ts +1 -0
  18. package/dist/css/properties/CSSPropertyPath.d.ts.map +1 -1
  19. package/dist/css/properties/CSSPropertyTransform.d.ts +1 -0
  20. package/dist/css/properties/CSSPropertyTransform.d.ts.map +1 -1
  21. package/dist/display-objects/Circle.d.ts.map +1 -1
  22. package/dist/display-objects/CustomElement.d.ts.map +1 -1
  23. package/dist/display-objects/DisplayObject.d.ts +8 -0
  24. package/dist/display-objects/DisplayObject.d.ts.map +1 -1
  25. package/dist/display-objects/Ellipse.d.ts.map +1 -1
  26. package/dist/display-objects/Group.d.ts.map +1 -1
  27. package/dist/display-objects/HTML.d.ts.map +1 -1
  28. package/dist/display-objects/Image.d.ts.map +1 -1
  29. package/dist/display-objects/Path.d.ts.map +1 -1
  30. package/dist/display-objects/Polygon.d.ts.map +1 -1
  31. package/dist/display-objects/Polyline.d.ts.map +1 -1
  32. package/dist/display-objects/Rect.d.ts.map +1 -1
  33. package/dist/display-objects/Text.d.ts +1 -1
  34. package/dist/display-objects/Text.d.ts.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.esm.js +85 -35
  38. package/dist/index.js +85 -35
  39. package/dist/index.umd.js +85 -35
  40. package/dist/index.umd.min.js +1 -1
  41. package/dist/utils/canvas.d.ts.map +1 -1
  42. package/dist/utils/string.d.ts +1 -0
  43. package/dist/utils/string.d.ts.map +1 -1
  44. package/package.json +3 -3
package/dist/index.umd.js CHANGED
@@ -6599,6 +6599,11 @@
6599
6599
  return g[1].toUpperCase();
6600
6600
  });
6601
6601
  });
6602
+ var kebabize = function kebabize(str) {
6603
+ return str.split('').map(function (letter, idx) {
6604
+ return letter.toUpperCase() === letter ? "" + (idx !== 0 ? '-' : '') + letter.toLowerCase() : letter;
6605
+ }).join('');
6606
+ };
6602
6607
 
6603
6608
  function DCHECK(bool) {
6604
6609
  if (!bool) {
@@ -12559,6 +12564,7 @@
12559
12564
  var CSSPropertyAngle = /*#__PURE__*/function () {
12560
12565
  function CSSPropertyAngle() {
12561
12566
  this.parser = parseAngle;
12567
+ this.parserWithCSSDisabled = null;
12562
12568
  this.mixer = mergeNumbers;
12563
12569
  }
12564
12570
  var _proto = CSSPropertyAngle.prototype;
@@ -12596,6 +12602,7 @@
12596
12602
  var CSSPropertyColor = /*#__PURE__*/function () {
12597
12603
  function CSSPropertyColor() {
12598
12604
  this.parser = parseColor;
12605
+ this.parserWithCSSDisabled = parseColor;
12599
12606
  this.mixer = mergeColors;
12600
12607
  }
12601
12608
  var _proto = CSSPropertyColor.prototype;
@@ -12634,6 +12641,7 @@
12634
12641
  var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
12635
12642
  function CSSPropertyLengthOrPercentage() {
12636
12643
  this.parser = parseLengthOrPercentage;
12644
+ this.parserWithCSSDisabled = null;
12637
12645
  this.mixer = mergeNumbers;
12638
12646
  }
12639
12647
  var _proto = CSSPropertyLengthOrPercentage.prototype;
@@ -12857,6 +12865,7 @@
12857
12865
  function CSSPropertyNumber() {
12858
12866
  this.mixer = mergeNumbers;
12859
12867
  this.parser = parseNumber;
12868
+ this.parserWithCSSDisabled = null;
12860
12869
  }
12861
12870
  var _proto = CSSPropertyNumber.prototype;
12862
12871
  _proto.calculator = function calculator(name, oldParsed, computed) {
@@ -12868,6 +12877,7 @@
12868
12877
  var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
12869
12878
  function CSSPropertyOffsetDistance() {
12870
12879
  this.parser = parseNumber;
12880
+ this.parserWithCSSDisabled = null;
12871
12881
  this.mixer = clampedMergeNumbers(0, 1);
12872
12882
  }
12873
12883
  var _proto = CSSPropertyOffsetDistance.prototype;
@@ -12901,6 +12911,7 @@
12901
12911
  var CSSPropertyOpacity = /*#__PURE__*/function () {
12902
12912
  function CSSPropertyOpacity() {
12903
12913
  this.parser = parseNumber;
12914
+ this.parserWithCSSDisabled = null;
12904
12915
  this.mixer = clampedMergeNumbers(0, 1);
12905
12916
  }
12906
12917
  var _proto = CSSPropertyOpacity.prototype;
@@ -12913,6 +12924,7 @@
12913
12924
  var CSSPropertyPath = /*#__PURE__*/function () {
12914
12925
  function CSSPropertyPath() {
12915
12926
  this.parser = parsePath;
12927
+ this.parserWithCSSDisabled = parsePath;
12916
12928
  this.mixer = mergePaths;
12917
12929
  }
12918
12930
  var _proto = CSSPropertyPath.prototype;
@@ -13059,6 +13071,7 @@
13059
13071
  var CSSPropertyTransform = /*#__PURE__*/function () {
13060
13072
  function CSSPropertyTransform() {
13061
13073
  this.parser = parseTransform;
13074
+ this.parserWithCSSDisabled = parseTransform;
13062
13075
  this.mixer = mergeTransforms;
13063
13076
  }
13064
13077
  var _proto = CSSPropertyTransform.prototype;
@@ -15309,7 +15322,8 @@
15309
15322
  transform: [],
15310
15323
  zIndex: 0,
15311
15324
  filter: [],
15312
- shadowType: 'outer'
15325
+ shadowType: 'outer',
15326
+ miterLimit: 10
15313
15327
  };
15314
15328
  var DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = _extends({}, DEFAULT_PARSED_STYLE_PROPS, {
15315
15329
  opacity: 1,
@@ -15327,6 +15341,7 @@
15327
15341
 
15328
15342
  var INHERITABLE_BASE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting'];
15329
15343
  var INHERITABLE_STYLE_PROPS = [].concat(INHERITABLE_BASE_STYLE_PROPS, ['fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform']);
15344
+ var DATASET_PREFIX = 'data-';
15330
15345
  /**
15331
15346
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
15332
15347
  *
@@ -15355,6 +15370,14 @@
15355
15370
  * push to active animations after calling `animate()`
15356
15371
  */
15357
15372
 
15373
+ /**
15374
+ * Use data-* attribute.
15375
+ * @see https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
15376
+ * @example
15377
+ * group.dataset.prop1 = 1;
15378
+ * group.getAttribute('data-prop1'); // 1
15379
+ */
15380
+
15358
15381
  function DisplayObject(config) {
15359
15382
  var _this$config$capture;
15360
15383
  var _this;
@@ -15365,6 +15388,7 @@
15365
15388
  _this.isCustomElement = false;
15366
15389
  _this.isMutationObserved = false;
15367
15390
  _this.activeAnimations = [];
15391
+ _this.dataset = void 0;
15368
15392
  _this.getClip = function () {
15369
15393
  return this.style.clipPath || null;
15370
15394
  };
@@ -15399,6 +15423,19 @@
15399
15423
  }
15400
15424
  // start to process attributes
15401
15425
  _this.initAttributes(_this.config.style);
15426
+ _this.dataset = new Proxy({}, {
15427
+ get: function get(target, name) {
15428
+ var formattedName = "" + DATASET_PREFIX + kebabize(name);
15429
+ if (target[formattedName] !== undefined) {
15430
+ return target[formattedName];
15431
+ }
15432
+ return _this.getAttribute(formattedName);
15433
+ },
15434
+ set: function set(_, prop, value) {
15435
+ _this.setAttribute("" + DATASET_PREFIX + kebabize(prop), value);
15436
+ return true;
15437
+ }
15438
+ });
15402
15439
  _this.style = new Proxy(
15403
15440
  // @ts-ignore
15404
15441
  {
@@ -16056,11 +16093,11 @@
16056
16093
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
16057
16094
  return _DisplayObject.call(this, _extends({
16058
16095
  type: exports.Shape.CIRCLE,
16059
- style: _extends({
16096
+ style: runtime.enableCSSParsing ? _extends({
16060
16097
  cx: '',
16061
16098
  cy: '',
16062
16099
  r: ''
16063
- }, style),
16100
+ }, style) : _extends({}, style),
16064
16101
  initialParsedStyle: {
16065
16102
  anchor: [0.5, 0.5],
16066
16103
  transformOrigin: runtime.enableCSSParsing ? null : [getOrCreateUnitValue(50, '%'), getOrCreateUnitValue(50, '%')]
@@ -16088,10 +16125,10 @@
16088
16125
  style = _ref.style,
16089
16126
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
16090
16127
  _this = _DisplayObject.call(this, _extends({
16091
- style: _extends({
16128
+ style: runtime.enableCSSParsing ? _extends({
16092
16129
  x: '',
16093
16130
  y: ''
16094
- }, style)
16131
+ }, style) : _extends({}, style)
16095
16132
  }, rest)) || this;
16096
16133
  _this.isCustomElement = true;
16097
16134
  return _this;
@@ -16143,12 +16180,12 @@
16143
16180
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
16144
16181
  return _DisplayObject.call(this, _extends({
16145
16182
  type: exports.Shape.ELLIPSE,
16146
- style: _extends({
16183
+ style: runtime.enableCSSParsing ? _extends({
16147
16184
  cx: '',
16148
16185
  cy: '',
16149
16186
  rx: '',
16150
16187
  ry: ''
16151
- }, style),
16188
+ }, style) : _extends({}, style),
16152
16189
  initialParsedStyle: {
16153
16190
  anchor: [0.5, 0.5],
16154
16191
  transformOrigin: runtime.enableCSSParsing ? null : [getOrCreateUnitValue(50, '%'), getOrCreateUnitValue(50, '%')]
@@ -16177,12 +16214,12 @@
16177
16214
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
16178
16215
  return _DisplayObject.call(this, _extends({
16179
16216
  type: exports.Shape.GROUP,
16180
- style: _extends({
16217
+ style: runtime.enableCSSParsing ? _extends({
16181
16218
  x: '',
16182
16219
  y: '',
16183
16220
  width: '',
16184
16221
  height: ''
16185
- }, style)
16222
+ }, style) : _extends({}, style)
16186
16223
  }, rest)) || this;
16187
16224
  }
16188
16225
  return Group;
@@ -16202,13 +16239,13 @@
16202
16239
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
16203
16240
  _this = _DisplayObject.call(this, _extends({
16204
16241
  type: exports.Shape.HTML,
16205
- style: _extends({
16242
+ style: runtime.enableCSSParsing ? _extends({
16206
16243
  x: '',
16207
16244
  y: '',
16208
16245
  width: 'auto',
16209
16246
  height: 'auto',
16210
16247
  innerHTML: ''
16211
- }, style)
16248
+ }, style) : _extends({}, style)
16212
16249
  }, rest)) || this;
16213
16250
  _this.cullable.enable = false;
16214
16251
  return _this;
@@ -16275,13 +16312,13 @@
16275
16312
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
16276
16313
  return _DisplayObject.call(this, _extends({
16277
16314
  type: exports.Shape.IMAGE,
16278
- style: _extends({
16315
+ style: runtime.enableCSSParsing ? _extends({
16279
16316
  x: '',
16280
16317
  y: '',
16281
16318
  img: '',
16282
16319
  width: '',
16283
16320
  height: ''
16284
- }, style)
16321
+ }, style) : _extends({}, style)
16285
16322
  }, rest)) || this;
16286
16323
  }
16287
16324
  return Image;
@@ -16467,6 +16504,7 @@
16467
16504
  miterLimit: ''
16468
16505
  }, style),
16469
16506
  initialParsedStyle: runtime.enableCSSParsing ? null : {
16507
+ miterLimit: 4,
16470
16508
  path: _extends({}, EMPTY_PARSED_PATH)
16471
16509
  }
16472
16510
  }, rest)) || this;
@@ -16693,7 +16731,10 @@
16693
16731
  points: '',
16694
16732
  miterLimit: '',
16695
16733
  isClosed: true
16696
- }, style)
16734
+ }, style),
16735
+ initialParsedStyle: runtime.enableCSSParsing ? null : {
16736
+ miterLimit: 4
16737
+ }
16697
16738
  }, rest)) || this;
16698
16739
  _this.markerStartAngle = 0;
16699
16740
  _this.markerEndAngle = 0;
@@ -16839,7 +16880,10 @@
16839
16880
  points: '',
16840
16881
  miterLimit: '',
16841
16882
  isClosed: false
16842
- }, style)
16883
+ }, style),
16884
+ initialParsedStyle: runtime.enableCSSParsing ? null : {
16885
+ miterLimit: 4
16886
+ }
16843
16887
  }, rest)) || this;
16844
16888
  }
16845
16889
  var _proto = Polyline.prototype;
@@ -16904,13 +16948,13 @@
16904
16948
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
16905
16949
  return _DisplayObject.call(this, _extends({
16906
16950
  type: exports.Shape.RECT,
16907
- style: _extends({
16951
+ style: runtime.enableCSSParsing ? _extends({
16908
16952
  x: '',
16909
16953
  y: '',
16910
16954
  width: '',
16911
16955
  height: '',
16912
16956
  radius: ''
16913
- }, style)
16957
+ }, style) : _extends({}, style)
16914
16958
  }, rest)) || this;
16915
16959
  }
16916
16960
  return Rect;
@@ -16956,9 +17000,12 @@
16956
17000
  leading: 0,
16957
17001
  dx: '',
16958
17002
  dy: ''
16959
- }, style) : _extends({}, style),
17003
+ }, style) : _extends({
17004
+ fill: 'black'
17005
+ }, style),
16960
17006
  initialParsedStyle: runtime.enableCSSParsing ? {} : {
16961
- fill: 'black',
17007
+ x: 0,
17008
+ y: 0,
16962
17009
  fontSize: 16,
16963
17010
  fontFamily: 'sans-serif',
16964
17011
  fontStyle: 'normal',
@@ -16968,7 +17015,6 @@
16968
17015
  letterSpacing: 0,
16969
17016
  textBaseline: 'alphabetic',
16970
17017
  textAlign: 'start',
16971
- miterLimit: 10,
16972
17018
  wordWrap: false,
16973
17019
  wordWrapWidth: 0,
16974
17020
  leading: 0,
@@ -17612,14 +17658,14 @@
17612
17658
  }
17613
17659
  // Rect
17614
17660
  // @ts-ignore
17615
- if (attributes.radius) {
17661
+ if (!isNil(attributes.radius)) {
17616
17662
  // @ts-ignore
17617
17663
  object.parsedStyle.radius = parseDimensionArrayFormat(
17618
17664
  // @ts-ignore
17619
17665
  attributes.radius, 4);
17620
17666
  }
17621
17667
  // Polyline
17622
- if (attributes.lineDash) {
17668
+ if (!isNil(attributes.lineDash)) {
17623
17669
  object.parsedStyle.lineDash = parseDimensionArrayFormat(attributes.lineDash, 2);
17624
17670
  }
17625
17671
  // @ts-ignore
@@ -17690,31 +17736,35 @@
17690
17736
  attributes.markerMid, null, null);
17691
17737
  }
17692
17738
  if (
17739
+ // Circle & Ellipse
17740
+ (object.nodeName === exports.Shape.CIRCLE || object.nodeName === exports.Shape.ELLIPSE) && (
17693
17741
  // @ts-ignore
17694
- attributes.cx ||
17742
+ !isNil(attributes.cx) ||
17695
17743
  // @ts-ignore
17696
- attributes.cy ||
17744
+ !isNil(attributes.cy)) || (object.nodeName === exports.Shape.RECT || object.nodeName === exports.Shape.IMAGE || object.nodeName === exports.Shape.GROUP || object.nodeName === exports.Shape.HTML || object.nodeName === exports.Shape.TEXT || object.nodeName === exports.Shape.MESH) && (
17697
17745
  // @ts-ignore
17698
- attributes.x ||
17746
+ !isNil(attributes.x) ||
17699
17747
  // @ts-ignore
17700
- attributes.y ||
17748
+ !isNil(attributes.y) ||
17701
17749
  // @ts-ignore
17702
- attributes.z ||
17750
+ !isNil(attributes.z)) ||
17751
+ // Line
17752
+ object.nodeName === exports.Shape.LINE && (
17703
17753
  // @ts-ignore
17704
- attributes.x1 ||
17754
+ !isNil(attributes.x1) ||
17705
17755
  // @ts-ignore
17706
- attributes.y1 ||
17756
+ !isNil(attributes.y1) ||
17707
17757
  // @ts-ignore
17708
- attributes.z1 ||
17758
+ !isNil(attributes.z1) ||
17709
17759
  // @ts-ignore
17710
- attributes.x2 ||
17760
+ !isNil(attributes.x2) ||
17711
17761
  // @ts-ignore
17712
- attributes.y2 ||
17762
+ !isNil(attributes.y2) ||
17713
17763
  // @ts-ignore
17714
- attributes.z2) {
17764
+ !isNil(attributes.z2))) {
17715
17765
  runtime.CSSPropertySyntaxFactory['<coordinate>'].postProcessor(object, _attributeNames);
17716
17766
  }
17717
- if (attributes.zIndex) {
17767
+ if (!isNil(attributes.zIndex)) {
17718
17768
  runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, _attributeNames);
17719
17769
  }
17720
17770
  // @ts-ignore
@@ -17725,7 +17775,7 @@
17725
17775
  if (attributes.points) {
17726
17776
  runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object, _attributeNames);
17727
17777
  }
17728
- if (attributes.offsetDistance) {
17778
+ if (!isNil(attributes.offsetDistance)) {
17729
17779
  runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, _attributeNames);
17730
17780
  }
17731
17781
  if (attributes.transform) {