@antv/g-lite 1.0.18 → 1.0.20

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 +1 @@
1
- {"version":3,"file":"StyleValueRegistry.d.ts","sourceRoot":"","sources":["../src/css/StyleValueRegistry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,UAAU,CAAC;AAGrE,OAAO,KAAK,EAAU,aAAa,EAAE,MAAM,SAAS,CAAC;AAGrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAM/F,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,EAAE,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAAgB,EAsjBjD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAM,CAAC;AAoB1E,qBAAa,yBAA0B,YAAW,kBAAkB;IAClE;;OAEG;;IASH,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB;IAO3C,kBAAkB,CAAC,IAAI,EAAE,MAAM;IAI/B,iBAAiB,CAAC,MAAM,EAAE,MAAM;IAIhC;;;;;;;;OAQG;IACH,iBAAiB,CACf,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,cAAc,EAC1B,OAAO,GAAE,OAAO,CAAC,oBAAoB,CAKpC;IAiFH;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,GAAG,aAAa;IA8B7E;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa;IAgE5E,mBAAmB,CAAC,IAAI,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G;IACH,aAAa,CACX,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,aAAa,GACpB,aAAa;IA8BhB;;OAEG;IACH,eAAe,CACb,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,aAAa;IAqEvB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa;IAcvD;;OAEG;IACH,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM;IAYxD,oBAAoB,CAClB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAO;IAkCvC,MAAM,CAAC,MAAM,EAAE,aAAa;IAa5B;;;OAGG;IACH,OAAO,CAAC,cAAc;IA+KtB,OAAO,CAAC,qBAAqB;CAQ9B"}
@@ -1,10 +1,11 @@
1
+ import { Rect } from '../..';
1
2
  import type { CSSGradientValue } from '../cssom';
2
3
  import { CSSRGB } from '../cssom';
3
4
  /**
4
5
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createPattern
5
6
  */
6
7
  export interface Pattern {
7
- image: string | CanvasImageSource;
8
+ image: string | CanvasImageSource | Rect;
8
9
  repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
9
10
  transform: string;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/css/parser/color.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAAC;IAClC,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;IAC7D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@ import { mergeTransforms, parseTransform } from '../parser/transform';
34
34
  * * perspective
35
35
  */
36
36
  export declare class CSSPropertyTransform implements Partial<CSSProperty<CSSKeywordValue | ParsedTransform[], ParsedTransform[]>> {
37
- private tmpMat4;
38
37
  parser: typeof parseTransform;
39
38
  calculator(name: string, oldParsed: CSSKeywordValue | ParsedTransform[], parsed: CSSKeywordValue | ParsedTransform[], object: DisplayObject): ParsedTransform[];
40
39
  mixer: typeof mergeTransforms;
@@ -1 +1 @@
1
- {"version":3,"file":"CSSPropertyTransform.d.ts","sourceRoot":"","sources":["../src/css/properties/CSSPropertyTransform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,oBACX,YACE,OAAO,CACL,WAAW,CAAC,eAAe,GAAG,eAAe,EAAE,EAAE,eAAe,EAAE,CAAC,CACpE;IAEH,OAAO,CAAC,OAAO,CAAiB;IAEhC,MAAM,wBAAkB;IAExB,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,eAAe,GAAG,eAAe,EAAE,EAC9C,MAAM,EAAE,eAAe,GAAG,eAAe,EAAE,EAC3C,MAAM,EAAE,aAAa,GACpB,eAAe,EAAE;IAQpB,KAAK,yBAAmB;IAExB,aAAa,CAAC,MAAM,EAAE,aAAa;CAIpC"}
1
+ {"version":3,"file":"CSSPropertyTransform.d.ts","sourceRoot":"","sources":["../src/css/properties/CSSPropertyTransform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,oBACX,YACE,OAAO,CACL,WAAW,CAAC,eAAe,GAAG,eAAe,EAAE,EAAE,eAAe,EAAE,CAAC,CACpE;IAEH,MAAM,wBAAkB;IAExB,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,eAAe,GAAG,eAAe,EAAE,EAC9C,MAAM,EAAE,eAAe,GAAG,eAAe,EAAE,EAC3C,MAAM,EAAE,aAAa,GACpB,eAAe,EAAE;IAQpB,KAAK,yBAAmB;IAExB,aAAa,CAAC,MAAM,EAAE,aAAa;CAIpC"}
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import RBush from 'rbush';
2
2
  export { default as RBush } from 'rbush';
3
3
  import { memoize, isString, isNil, isObject, clamp, isNumber, normalizePath, path2Curve, equalizeSegments, getDrawDirection, reverseCurve, clonePath, getRotatedCurve, isBoolean, isUndefined, getPointAtLength, distanceSquareRoot, getTotalLength, min, max, isNumberEqual, mod } from '@antv/util';
4
- import { vec3, mat4, quat as quat$1, vec2, mat3, vec4 } from 'gl-matrix';
4
+ import { vec3, quat as quat$1, mat4, vec2, mat3, vec4 } from 'gl-matrix';
5
5
  import { color } from 'd3-color';
6
6
  import { Polyline as Polyline$1, Line as Line$1, Arc, Cubic, Quad } from '@antv/g-math';
7
7
  import EventEmitter from 'eventemitter3';
@@ -723,14 +723,9 @@ function _regeneratorRuntime() {
723
723
  };
724
724
  }
725
725
  function maybeInvokeDelegate(delegate, context) {
726
- var method = delegate.iterator[context.method];
727
- if (undefined === method) {
728
- if (context.delegate = null, "throw" === context.method) {
729
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
730
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
731
- }
732
- return ContinueSentinel;
733
- }
726
+ var methodName = context.method,
727
+ method = delegate.iterator[methodName];
728
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
734
729
  var record = tryCatch(method, delegate.iterator, context.arg);
735
730
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
736
731
  var info = record.arg;
@@ -930,7 +925,7 @@ function _defineProperties(target, props) {
930
925
  descriptor.enumerable = descriptor.enumerable || false;
931
926
  descriptor.configurable = true;
932
927
  if ("value" in descriptor) descriptor.writable = true;
933
- Object.defineProperty(target, descriptor.key, descriptor);
928
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
934
929
  }
935
930
  }
936
931
  function _createClass(Constructor, protoProps, staticProps) {
@@ -1016,6 +1011,20 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
1016
1011
  }
1017
1012
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1018
1013
  }
1014
+ function _toPrimitive(input, hint) {
1015
+ if (typeof input !== "object" || input === null) return input;
1016
+ var prim = input[Symbol.toPrimitive];
1017
+ if (prim !== undefined) {
1018
+ var res = prim.call(input, hint || "default");
1019
+ if (typeof res !== "object") return res;
1020
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1021
+ }
1022
+ return (hint === "string" ? String : Number)(input);
1023
+ }
1024
+ function _toPropertyKey(arg) {
1025
+ var key = _toPrimitive(arg, "string");
1026
+ return typeof key === "symbol" ? key : String(key);
1027
+ }
1019
1028
 
1020
1029
  // These units are iterated through, so be careful when adding or changing the
1021
1030
  // order.
@@ -4824,7 +4833,6 @@ var CSSPropertyTextTransform = /*#__PURE__*/function () {
4824
4833
  */
4825
4834
  var CSSPropertyTransform = /*#__PURE__*/function () {
4826
4835
  function CSSPropertyTransform() {
4827
- this.tmpMat4 = mat4.create();
4828
4836
  this.parser = parseTransform;
4829
4837
  this.mixer = mergeTransforms;
4830
4838
  }
@@ -8681,8 +8689,8 @@ function combine(out, a, b, scale1, scale2) {
8681
8689
  out[1] = a[1] * scale1 + b[1] * scale2;
8682
8690
  out[2] = a[2] * scale1 + b[2] * scale2;
8683
8691
  }
8692
+ var tmpMat4 = mat4.create();
8684
8693
  function parsedTransformToMat4(transform, object) {
8685
- var _this = this;
8686
8694
  if (transform && transform.length) {
8687
8695
  var defX = 0;
8688
8696
  var defY = 0;
@@ -8776,15 +8784,15 @@ function parsedTransformToMat4(transform, object) {
8776
8784
  dd = _d$map[3],
8777
8785
  tx = _d$map[4],
8778
8786
  ty = _d$map[5];
8779
- object.setLocalTransform(mat4.set(_this.tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx + defX, ty + defY, 0, 1));
8787
+ object.setLocalTransform(mat4.set(tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx + defX, ty + defY, 0, 1));
8780
8788
  } else if (t === 'matrix3d') {
8781
8789
  // @ts-ignore
8782
- mat4.set.apply(mat4, [_this.tmpMat4].concat(d.map(function (s) {
8790
+ mat4.set.apply(mat4, [tmpMat4].concat(d.map(function (s) {
8783
8791
  return s.value;
8784
8792
  })));
8785
- _this.tmpMat4[12] += defX;
8786
- _this.tmpMat4[13] += defY;
8787
- object.setLocalTransform(_this.tmpMat4);
8793
+ tmpMat4[12] += defX;
8794
+ tmpMat4[13] += defY;
8795
+ object.setLocalTransform(tmpMat4);
8788
8796
  }
8789
8797
  });
8790
8798
  }
@@ -10965,10 +10973,10 @@ var BUILT_IN_PROPERTIES = [{
10965
10973
  ind: true,
10966
10974
  inh: true,
10967
10975
  /**
10968
- * TODO: support interpolation
10976
+ * support interpolation
10969
10977
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility#interpolation
10970
10978
  */
10971
- // int: true,
10979
+ int: true,
10972
10980
  d: 'visible'
10973
10981
  }, {
10974
10982
  n: 'pointerEvents',
@@ -13567,6 +13575,8 @@ var EventService = /*#__PURE__*/function () {
13567
13575
  * - g `ctx.measureText`
13568
13576
  * - g-plugin-canvas-picker `ctx.isPointInPath`
13569
13577
  * - g-plugin-device-renderer `ctx.createLinearGradient` and generate texture
13578
+ *
13579
+ * @see https://blog.scottlogic.com/2020/03/19/offscreen-canvas.html
13570
13580
  */
13571
13581
  var OffscreenCanvasCreator = /*#__PURE__*/function () {
13572
13582
  function OffscreenCanvasCreator() {
@@ -13585,7 +13595,6 @@ var OffscreenCanvasCreator = /*#__PURE__*/function () {
13585
13595
  } else {
13586
13596
  try {
13587
13597
  // OffscreenCanvas2D measureText can be up to 40% faster.
13588
- // @ts-ignore
13589
13598
  this.canvas = new window.OffscreenCanvas(0, 0);
13590
13599
  this.context = this.canvas.getContext('2d');
13591
13600
  if (!this.context || !this.context.measureText) {
@@ -14960,9 +14969,10 @@ var TextService = /*#__PURE__*/function () {
14960
14969
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
14961
14970
  if (ellipsisWidth > 0 && ellipsisWidth <= maxWidth) {
14962
14971
  // Backspace from line's end.
14972
+ var currentLineLength = lines[currentIndex].length;
14963
14973
  var lastLineWidth = 0;
14964
- var lastLineIndex = 0;
14965
- for (var _i2 = 0; _i2 < lines[currentIndex].length; _i2++) {
14974
+ var lastLineIndex = currentLineLength;
14975
+ for (var _i2 = 0; _i2 < currentLineLength; _i2++) {
14966
14976
  var width = calcWidth(lines[currentIndex][_i2]);
14967
14977
  if (lastLineWidth + width + ellipsisWidth > maxWidth) {
14968
14978
  lastLineIndex = _i2;
@@ -15325,11 +15335,13 @@ var EventPlugin = /*#__PURE__*/function () {
15325
15335
  if (canvas.supportsTouchEvents && nativeEvent.pointerType === 'touch') return;
15326
15336
  // account for element in SVG
15327
15337
  var $element = _this2.context.contextService.getDomElement();
15328
- var outside = $element && nativeEvent.target && nativeEvent.target !== $element &&
15329
- // @ts-ignore
15330
- $element.contains &&
15331
- // @ts-ignore
15332
- !$element.contains(nativeEvent.target) ? 'outside' : '';
15338
+ var outside = 'outside';
15339
+ try {
15340
+ outside = $element && nativeEvent.target && nativeEvent.target !== $element && $element.contains && !$element.contains(nativeEvent.target) ? 'outside' : '';
15341
+ } catch (e) {
15342
+ // nativeEvent.target maybe not Node, such as Window
15343
+ // @see https://github.com/antvis/G/issues/1235
15344
+ }
15333
15345
  var normalizedEvents = _this2.normalizeToPointerEvent(nativeEvent, canvas);
15334
15346
  for (var _iterator3 = _createForOfIteratorHelperLoose(normalizedEvents), _step3; !(_step3 = _iterator3()).done;) {
15335
15347
  var normalizedEvent = _step3.value;
package/dist/index.js CHANGED
@@ -728,14 +728,9 @@ function _regeneratorRuntime() {
728
728
  };
729
729
  }
730
730
  function maybeInvokeDelegate(delegate, context) {
731
- var method = delegate.iterator[context.method];
732
- if (undefined === method) {
733
- if (context.delegate = null, "throw" === context.method) {
734
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
735
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
736
- }
737
- return ContinueSentinel;
738
- }
731
+ var methodName = context.method,
732
+ method = delegate.iterator[methodName];
733
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
739
734
  var record = tryCatch(method, delegate.iterator, context.arg);
740
735
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
741
736
  var info = record.arg;
@@ -935,7 +930,7 @@ function _defineProperties(target, props) {
935
930
  descriptor.enumerable = descriptor.enumerable || false;
936
931
  descriptor.configurable = true;
937
932
  if ("value" in descriptor) descriptor.writable = true;
938
- Object.defineProperty(target, descriptor.key, descriptor);
933
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
939
934
  }
940
935
  }
941
936
  function _createClass(Constructor, protoProps, staticProps) {
@@ -1021,6 +1016,20 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
1021
1016
  }
1022
1017
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1023
1018
  }
1019
+ function _toPrimitive(input, hint) {
1020
+ if (typeof input !== "object" || input === null) return input;
1021
+ var prim = input[Symbol.toPrimitive];
1022
+ if (prim !== undefined) {
1023
+ var res = prim.call(input, hint || "default");
1024
+ if (typeof res !== "object") return res;
1025
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1026
+ }
1027
+ return (hint === "string" ? String : Number)(input);
1028
+ }
1029
+ function _toPropertyKey(arg) {
1030
+ var key = _toPrimitive(arg, "string");
1031
+ return typeof key === "symbol" ? key : String(key);
1032
+ }
1024
1033
 
1025
1034
  // These units are iterated through, so be careful when adding or changing the
1026
1035
  (function (UnitType) {
@@ -4826,7 +4835,6 @@ var CSSPropertyTextTransform = /*#__PURE__*/function () {
4826
4835
  */
4827
4836
  var CSSPropertyTransform = /*#__PURE__*/function () {
4828
4837
  function CSSPropertyTransform() {
4829
- this.tmpMat4 = glMatrix.mat4.create();
4830
4838
  this.parser = parseTransform;
4831
4839
  this.mixer = mergeTransforms;
4832
4840
  }
@@ -8681,8 +8689,8 @@ function combine(out, a, b, scale1, scale2) {
8681
8689
  out[1] = a[1] * scale1 + b[1] * scale2;
8682
8690
  out[2] = a[2] * scale1 + b[2] * scale2;
8683
8691
  }
8692
+ var tmpMat4 = glMatrix.mat4.create();
8684
8693
  function parsedTransformToMat4(transform, object) {
8685
- var _this = this;
8686
8694
  if (transform && transform.length) {
8687
8695
  var defX = 0;
8688
8696
  var defY = 0;
@@ -8776,15 +8784,15 @@ function parsedTransformToMat4(transform, object) {
8776
8784
  dd = _d$map[3],
8777
8785
  tx = _d$map[4],
8778
8786
  ty = _d$map[5];
8779
- object.setLocalTransform(glMatrix.mat4.set(_this.tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx + defX, ty + defY, 0, 1));
8787
+ object.setLocalTransform(glMatrix.mat4.set(tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx + defX, ty + defY, 0, 1));
8780
8788
  } else if (t === 'matrix3d') {
8781
8789
  // @ts-ignore
8782
- glMatrix.mat4.set.apply(glMatrix.mat4, [_this.tmpMat4].concat(d.map(function (s) {
8790
+ glMatrix.mat4.set.apply(glMatrix.mat4, [tmpMat4].concat(d.map(function (s) {
8783
8791
  return s.value;
8784
8792
  })));
8785
- _this.tmpMat4[12] += defX;
8786
- _this.tmpMat4[13] += defY;
8787
- object.setLocalTransform(_this.tmpMat4);
8793
+ tmpMat4[12] += defX;
8794
+ tmpMat4[13] += defY;
8795
+ object.setLocalTransform(tmpMat4);
8788
8796
  }
8789
8797
  });
8790
8798
  }
@@ -10965,10 +10973,10 @@ var BUILT_IN_PROPERTIES = [{
10965
10973
  ind: true,
10966
10974
  inh: true,
10967
10975
  /**
10968
- * TODO: support interpolation
10976
+ * support interpolation
10969
10977
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility#interpolation
10970
10978
  */
10971
- // int: true,
10979
+ int: true,
10972
10980
  d: 'visible'
10973
10981
  }, {
10974
10982
  n: 'pointerEvents',
@@ -13561,6 +13569,8 @@ var EventService = /*#__PURE__*/function () {
13561
13569
  * - g `ctx.measureText`
13562
13570
  * - g-plugin-canvas-picker `ctx.isPointInPath`
13563
13571
  * - g-plugin-device-renderer `ctx.createLinearGradient` and generate texture
13572
+ *
13573
+ * @see https://blog.scottlogic.com/2020/03/19/offscreen-canvas.html
13564
13574
  */
13565
13575
  var OffscreenCanvasCreator = /*#__PURE__*/function () {
13566
13576
  function OffscreenCanvasCreator() {
@@ -13579,7 +13589,6 @@ var OffscreenCanvasCreator = /*#__PURE__*/function () {
13579
13589
  } else {
13580
13590
  try {
13581
13591
  // OffscreenCanvas2D measureText can be up to 40% faster.
13582
- // @ts-ignore
13583
13592
  this.canvas = new window.OffscreenCanvas(0, 0);
13584
13593
  this.context = this.canvas.getContext('2d');
13585
13594
  if (!this.context || !this.context.measureText) {
@@ -14953,9 +14962,10 @@ var TextService = /*#__PURE__*/function () {
14953
14962
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
14954
14963
  if (ellipsisWidth > 0 && ellipsisWidth <= maxWidth) {
14955
14964
  // Backspace from line's end.
14965
+ var currentLineLength = lines[currentIndex].length;
14956
14966
  var lastLineWidth = 0;
14957
- var lastLineIndex = 0;
14958
- for (var _i2 = 0; _i2 < lines[currentIndex].length; _i2++) {
14967
+ var lastLineIndex = currentLineLength;
14968
+ for (var _i2 = 0; _i2 < currentLineLength; _i2++) {
14959
14969
  var width = calcWidth(lines[currentIndex][_i2]);
14960
14970
  if (lastLineWidth + width + ellipsisWidth > maxWidth) {
14961
14971
  lastLineIndex = _i2;
@@ -15318,11 +15328,13 @@ var EventPlugin = /*#__PURE__*/function () {
15318
15328
  if (canvas.supportsTouchEvents && nativeEvent.pointerType === 'touch') return;
15319
15329
  // account for element in SVG
15320
15330
  var $element = _this2.context.contextService.getDomElement();
15321
- var outside = $element && nativeEvent.target && nativeEvent.target !== $element &&
15322
- // @ts-ignore
15323
- $element.contains &&
15324
- // @ts-ignore
15325
- !$element.contains(nativeEvent.target) ? 'outside' : '';
15331
+ var outside = 'outside';
15332
+ try {
15333
+ outside = $element && nativeEvent.target && nativeEvent.target !== $element && $element.contains && !$element.contains(nativeEvent.target) ? 'outside' : '';
15334
+ } catch (e) {
15335
+ // nativeEvent.target maybe not Node, such as Window
15336
+ // @see https://github.com/antvis/G/issues/1235
15337
+ }
15326
15338
  var normalizedEvents = _this2.normalizeToPointerEvent(nativeEvent, canvas);
15327
15339
  for (var _iterator3 = _createForOfIteratorHelperLoose(normalizedEvents), _step3; !(_step3 = _iterator3()).done;) {
15328
15340
  var normalizedEvent = _step3.value;
package/dist/index.umd.js CHANGED
@@ -6139,14 +6139,9 @@
6139
6139
  };
6140
6140
  }
6141
6141
  function maybeInvokeDelegate(delegate, context) {
6142
- var method = delegate.iterator[context.method];
6143
- if (undefined === method) {
6144
- if (context.delegate = null, "throw" === context.method) {
6145
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
6146
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
6147
- }
6148
- return ContinueSentinel;
6149
- }
6142
+ var methodName = context.method,
6143
+ method = delegate.iterator[methodName];
6144
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
6150
6145
  var record = tryCatch(method, delegate.iterator, context.arg);
6151
6146
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
6152
6147
  var info = record.arg;
@@ -6346,7 +6341,7 @@
6346
6341
  descriptor.enumerable = descriptor.enumerable || false;
6347
6342
  descriptor.configurable = true;
6348
6343
  if ("value" in descriptor) descriptor.writable = true;
6349
- Object.defineProperty(target, descriptor.key, descriptor);
6344
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
6350
6345
  }
6351
6346
  }
6352
6347
  function _createClass(Constructor, protoProps, staticProps) {
@@ -6432,6 +6427,20 @@
6432
6427
  }
6433
6428
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6434
6429
  }
6430
+ function _toPrimitive(input, hint) {
6431
+ if (typeof input !== "object" || input === null) return input;
6432
+ var prim = input[Symbol.toPrimitive];
6433
+ if (prim !== undefined) {
6434
+ var res = prim.call(input, hint || "default");
6435
+ if (typeof res !== "object") return res;
6436
+ throw new TypeError("@@toPrimitive must return a primitive value.");
6437
+ }
6438
+ return (hint === "string" ? String : Number)(input);
6439
+ }
6440
+ function _toPropertyKey(arg) {
6441
+ var key = _toPrimitive(arg, "string");
6442
+ return typeof key === "symbol" ? key : String(key);
6443
+ }
6435
6444
 
6436
6445
  // These units are iterated through, so be careful when adding or changing the
6437
6446
  (function (UnitType) {
@@ -11509,7 +11518,6 @@
11509
11518
  */
11510
11519
  var CSSPropertyTransform = /*#__PURE__*/function () {
11511
11520
  function CSSPropertyTransform() {
11512
- this.tmpMat4 = create$1();
11513
11521
  this.parser = parseTransform;
11514
11522
  this.mixer = mergeTransforms;
11515
11523
  }
@@ -15716,8 +15724,8 @@
15716
15724
  out[1] = a[1] * scale1 + b[1] * scale2;
15717
15725
  out[2] = a[2] * scale1 + b[2] * scale2;
15718
15726
  }
15727
+ var tmpMat4 = create$1();
15719
15728
  function parsedTransformToMat4(transform, object) {
15720
- var _this = this;
15721
15729
  if (transform && transform.length) {
15722
15730
  var defX = 0;
15723
15731
  var defY = 0;
@@ -15811,15 +15819,15 @@
15811
15819
  dd = _d$map[3],
15812
15820
  tx = _d$map[4],
15813
15821
  ty = _d$map[5];
15814
- object.setLocalTransform(set(_this.tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx + defX, ty + defY, 0, 1));
15822
+ object.setLocalTransform(set(tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx + defX, ty + defY, 0, 1));
15815
15823
  } else if (t === 'matrix3d') {
15816
15824
  // @ts-ignore
15817
- set.apply(mat4, [_this.tmpMat4].concat(d.map(function (s) {
15825
+ set.apply(mat4, [tmpMat4].concat(d.map(function (s) {
15818
15826
  return s.value;
15819
15827
  })));
15820
- _this.tmpMat4[12] += defX;
15821
- _this.tmpMat4[13] += defY;
15822
- object.setLocalTransform(_this.tmpMat4);
15828
+ tmpMat4[12] += defX;
15829
+ tmpMat4[13] += defY;
15830
+ object.setLocalTransform(tmpMat4);
15823
15831
  }
15824
15832
  });
15825
15833
  }
@@ -18000,10 +18008,10 @@
18000
18008
  ind: true,
18001
18009
  inh: true,
18002
18010
  /**
18003
- * TODO: support interpolation
18011
+ * support interpolation
18004
18012
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility#interpolation
18005
18013
  */
18006
- // int: true,
18014
+ int: true,
18007
18015
  d: 'visible'
18008
18016
  }, {
18009
18017
  n: 'pointerEvents',
@@ -20596,6 +20604,8 @@
20596
20604
  * - g `ctx.measureText`
20597
20605
  * - g-plugin-canvas-picker `ctx.isPointInPath`
20598
20606
  * - g-plugin-device-renderer `ctx.createLinearGradient` and generate texture
20607
+ *
20608
+ * @see https://blog.scottlogic.com/2020/03/19/offscreen-canvas.html
20599
20609
  */
20600
20610
  var OffscreenCanvasCreator = /*#__PURE__*/function () {
20601
20611
  function OffscreenCanvasCreator() {
@@ -20614,7 +20624,6 @@
20614
20624
  } else {
20615
20625
  try {
20616
20626
  // OffscreenCanvas2D measureText can be up to 40% faster.
20617
- // @ts-ignore
20618
20627
  this.canvas = new window.OffscreenCanvas(0, 0);
20619
20628
  this.context = this.canvas.getContext('2d');
20620
20629
  if (!this.context || !this.context.measureText) {
@@ -21988,9 +21997,10 @@
21988
21997
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
21989
21998
  if (ellipsisWidth > 0 && ellipsisWidth <= maxWidth) {
21990
21999
  // Backspace from line's end.
22000
+ var currentLineLength = lines[currentIndex].length;
21991
22001
  var lastLineWidth = 0;
21992
- var lastLineIndex = 0;
21993
- for (var _i2 = 0; _i2 < lines[currentIndex].length; _i2++) {
22002
+ var lastLineIndex = currentLineLength;
22003
+ for (var _i2 = 0; _i2 < currentLineLength; _i2++) {
21994
22004
  var width = calcWidth(lines[currentIndex][_i2]);
21995
22005
  if (lastLineWidth + width + ellipsisWidth > maxWidth) {
21996
22006
  lastLineIndex = _i2;
@@ -22355,11 +22365,13 @@
22355
22365
  if (canvas.supportsTouchEvents && nativeEvent.pointerType === 'touch') return;
22356
22366
  // account for element in SVG
22357
22367
  var $element = _this2.context.contextService.getDomElement();
22358
- var outside = $element && nativeEvent.target && nativeEvent.target !== $element &&
22359
- // @ts-ignore
22360
- $element.contains &&
22361
- // @ts-ignore
22362
- !$element.contains(nativeEvent.target) ? 'outside' : '';
22368
+ var outside = 'outside';
22369
+ try {
22370
+ outside = $element && nativeEvent.target && nativeEvent.target !== $element && $element.contains && !$element.contains(nativeEvent.target) ? 'outside' : '';
22371
+ } catch (e) {
22372
+ // nativeEvent.target maybe not Node, such as Window
22373
+ // @see https://github.com/antvis/G/issues/1235
22374
+ }
22363
22375
  var normalizedEvents = _this2.normalizeToPointerEvent(nativeEvent, canvas);
22364
22376
  for (var _iterator3 = _createForOfIteratorHelperLoose(normalizedEvents), _step3; !(_step3 = _iterator3()).done;) {
22365
22377
  var normalizedEvent = _step3.value;