@antv/g 5.0.23-alpha.4 → 5.0.23-alpha.8

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.
@@ -207,4 +207,6 @@ export declare class CSSMathProduct extends CSSMathVariadic {
207
207
  sumValue(): CSSNumericSumValue;
208
208
  buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
209
209
  }
210
+ export declare const Opx: CSSUnitValue;
211
+ export declare const Odeg: CSSUnitValue;
210
212
  export {};
@@ -1656,4 +1656,6 @@ function (_super) {
1656
1656
  return CSSMathProduct;
1657
1657
  }(CSSMathVariadic);
1658
1658
 
1659
- export { CSSMathProduct };
1659
+ export { CSSMathProduct };
1660
+ export var Opx = new CSSUnitValue(0, 'px');
1661
+ export var Odeg = new CSSUnitValue(0, 'deg');
@@ -1,4 +1,4 @@
1
- import { CSSUnitValue } from '../cssom';
1
+ import { CSSUnitValue } from '../cssom/CSSNumericValue';
2
2
  /**
3
3
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
4
4
  * eg. 'center' 'top left' '50px 50px'
@@ -1,5 +1,5 @@
1
1
  import { isString } from '../../utils';
2
- import { CSSUnitValue } from '../cssom';
2
+ import { CSSUnitValue } from '../cssom/CSSNumericValue';
3
3
  import { parseLengthOrPercentage } from './dimension';
4
4
  /**
5
5
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
@@ -1,11 +1,9 @@
1
1
  import type { DisplayObject } from '../../display-objects/DisplayObject';
2
- import { CSSUnitValue } from '../cssom';
2
+ import { CSSUnitValue } from '../cssom/CSSNumericValue';
3
3
  export interface ParsedTransform {
4
4
  t: string;
5
5
  d: CSSUnitValue[];
6
6
  }
7
- export declare const Opx: CSSUnitValue;
8
- export declare const Odeg: CSSUnitValue;
9
7
  /**
10
8
  * none
11
9
  * scale(1) scale(1, 2)
@@ -1,8 +1,8 @@
1
- import { parseNumber, mergeNumbers, parseAngle, parseLength, parseLengthOrPercentage, mergeDimensions } from './';
2
- import { UnitType, CSSUnitValue } from '../cssom';
1
+ import { UnitType } from '../cssom/types';
2
+ import { CSSUnitValue, Opx, Odeg } from '../cssom/CSSNumericValue';
3
+ import { mergeDimensions, parseAngle, parseLength, parseLengthOrPercentage } from './dimension';
4
+ import { mergeNumbers, parseNumber } from './numeric';
3
5
  var _ = null;
4
- export var Opx = new CSSUnitValue(0, 'px');
5
- export var Odeg = new CSSUnitValue(0, 'deg');
6
6
 
7
7
  function cast(pattern) {
8
8
  return function (contents) {
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { singleton } from 'mana-syringe';
3
- import { CSSKeywordValue } from '../cssom';
4
- import { Opx, Odeg, parseTransform, mergeTransforms } from '../parser';
3
+ import { CSSKeywordValue, Opx, Odeg } from '../cssom';
4
+ import { parseTransform, mergeTransforms } from '../parser';
5
5
  /**
6
6
  * @see /zh/docs/api/animation#支持变换的属性
7
7
  *
@@ -207,4 +207,6 @@ export declare class CSSMathProduct extends CSSMathVariadic {
207
207
  sumValue(): CSSNumericSumValue;
208
208
  buildCSSText(nested: Nested, paren_less: ParenLess, result: string): string;
209
209
  }
210
+ export declare const Opx: CSSUnitValue;
211
+ export declare const Odeg: CSSUnitValue;
210
212
  export {};
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.CSSUnitValue = exports.CSSNumericValueType = exports.CSSNumericValue = exports.CSSMathVariadic = exports.CSSMathValue = exports.CSSMathSum = exports.CSSMathProduct = exports.CSSMathNegate = exports.CSSMathMin = exports.CSSMathMax = exports.CSSMathInvert = exports.BaseType = void 0;
6
+ exports.Opx = exports.Odeg = exports.CSSUnitValue = exports.CSSNumericValueType = exports.CSSNumericValue = exports.CSSMathVariadic = exports.CSSMathValue = exports.CSSMathSum = exports.CSSMathProduct = exports.CSSMathNegate = exports.CSSMathMin = exports.CSSMathMax = exports.CSSMathInvert = exports.BaseType = void 0;
7
7
  exports.baseTypeToString = baseTypeToString;
8
8
  exports.typeCheck = typeCheck;
9
9
  exports.unitTypeToBaseType = unitTypeToBaseType;
@@ -1678,4 +1678,8 @@ function (_super) {
1678
1678
  return CSSMathProduct;
1679
1679
  }(CSSMathVariadic);
1680
1680
 
1681
- exports.CSSMathProduct = CSSMathProduct;
1681
+ exports.CSSMathProduct = CSSMathProduct;
1682
+ var Opx = new CSSUnitValue(0, 'px');
1683
+ exports.Opx = Opx;
1684
+ var Odeg = new CSSUnitValue(0, 'deg');
1685
+ exports.Odeg = Odeg;
@@ -1,4 +1,4 @@
1
- import { CSSUnitValue } from '../cssom';
1
+ import { CSSUnitValue } from '../cssom/CSSNumericValue';
2
2
  /**
3
3
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
4
4
  * eg. 'center' 'top left' '50px 50px'
@@ -7,7 +7,7 @@ exports.parseTransformOrigin = parseTransformOrigin;
7
7
 
8
8
  var _utils = require("../../utils");
9
9
 
10
- var _cssom = require("../cssom");
10
+ var _CSSNumericValue = require("../cssom/CSSNumericValue");
11
11
 
12
12
  var _dimension = require("./dimension");
13
13
 
@@ -37,7 +37,7 @@ function parseTransformOrigin(value) {
37
37
 
38
38
  return [(0, _dimension.parseLengthOrPercentage)(convertKeyword2Percent(values[0])), (0, _dimension.parseLengthOrPercentage)(convertKeyword2Percent(values[1]))];
39
39
  } else {
40
- return [new _cssom.CSSUnitValue(value[0] || 0, 'px'), new _cssom.CSSUnitValue(value[1] || 0, 'px')];
40
+ return [new _CSSNumericValue.CSSUnitValue(value[0] || 0, 'px'), new _CSSNumericValue.CSSUnitValue(value[1] || 0, 'px')];
41
41
  }
42
42
  }
43
43
 
@@ -1,11 +1,9 @@
1
1
  import type { DisplayObject } from '../../display-objects/DisplayObject';
2
- import { CSSUnitValue } from '../cssom';
2
+ import { CSSUnitValue } from '../cssom/CSSNumericValue';
3
3
  export interface ParsedTransform {
4
4
  t: string;
5
5
  d: CSSUnitValue[];
6
6
  }
7
- export declare const Opx: CSSUnitValue;
8
- export declare const Odeg: CSSUnitValue;
9
7
  /**
10
8
  * none
11
9
  * scale(1) scale(1, 2)
@@ -3,19 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Opx = exports.Odeg = void 0;
7
6
  exports.mergeTransforms = mergeTransforms;
8
7
  exports.parseTransform = parseTransform;
9
8
 
10
- var _2 = require("./");
9
+ var _types = require("../cssom/types");
11
10
 
12
- var _cssom = require("../cssom");
11
+ var _CSSNumericValue = require("../cssom/CSSNumericValue");
12
+
13
+ var _dimension = require("./dimension");
14
+
15
+ var _numeric = require("./numeric");
13
16
 
14
17
  var _ = null;
15
- var Opx = new _cssom.CSSUnitValue(0, 'px');
16
- exports.Opx = Opx;
17
- var Odeg = new _cssom.CSSUnitValue(0, 'deg');
18
- exports.Odeg = Odeg;
19
18
 
20
19
  function cast(pattern) {
21
20
  return function (contents) {
@@ -41,18 +40,18 @@ var transformFunctions = {
41
40
  rotatez: ['A'],
42
41
  rotate3d: ['NNNA'],
43
42
  // perspective: ['L'],
44
- scale: ['Nn', cast([_, _, new _cssom.CSSUnitValue(1)]), id],
45
- scalex: ['N', cast([_, new _cssom.CSSUnitValue(1), new _cssom.CSSUnitValue(1)]), cast([_, new _cssom.CSSUnitValue(1)])],
46
- scaley: ['N', cast([new _cssom.CSSUnitValue(1), _, new _cssom.CSSUnitValue(1)]), cast([new _cssom.CSSUnitValue(1), _])],
47
- scalez: ['N', cast([new _cssom.CSSUnitValue(1), new _cssom.CSSUnitValue(1), _])],
43
+ scale: ['Nn', cast([_, _, new _CSSNumericValue.CSSUnitValue(1)]), id],
44
+ scalex: ['N', cast([_, new _CSSNumericValue.CSSUnitValue(1), new _CSSNumericValue.CSSUnitValue(1)]), cast([_, new _CSSNumericValue.CSSUnitValue(1)])],
45
+ scaley: ['N', cast([new _CSSNumericValue.CSSUnitValue(1), _, new _CSSNumericValue.CSSUnitValue(1)]), cast([new _CSSNumericValue.CSSUnitValue(1), _])],
46
+ scalez: ['N', cast([new _CSSNumericValue.CSSUnitValue(1), new _CSSNumericValue.CSSUnitValue(1), _])],
48
47
  scale3d: ['NNN', id],
49
48
  // skew: ['Aa', null, id],
50
49
  // skewx: ['A', null, cast([_, Odeg])],
51
50
  // skewy: ['A', null, cast([Odeg, _])],
52
- translate: ['Tt', cast([_, _, Opx]), id],
53
- translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
54
- translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
55
- translatez: ['L', cast([Opx, Opx, _])],
51
+ translate: ['Tt', cast([_, _, _CSSNumericValue.Opx]), id],
52
+ translatex: ['T', cast([_, _CSSNumericValue.Opx, _CSSNumericValue.Opx]), cast([_, _CSSNumericValue.Opx])],
53
+ translatey: ['T', cast([_CSSNumericValue.Opx, _, _CSSNumericValue.Opx]), cast([_CSSNumericValue.Opx, _])],
54
+ translatez: ['L', cast([_CSSNumericValue.Opx, _CSSNumericValue.Opx, _])],
56
55
  translate3d: ['TTL', id]
57
56
  };
58
57
  /**
@@ -107,19 +106,19 @@ function parseTransform(string) {
107
106
  if (!arg) {
108
107
  // @ts-ignore
109
108
  parsedArg = {
110
- a: Odeg,
109
+ a: _CSSNumericValue.Odeg,
111
110
  n: parsedArgs[0],
112
- t: Opx
111
+ t: _CSSNumericValue.Opx
113
112
  }[type];
114
113
  } else {
115
114
  // @ts-ignore
116
115
  parsedArg = {
117
116
  A: function A(s) {
118
- return s.trim() === '0' ? Odeg : (0, _2.parseAngle)(s);
117
+ return s.trim() === '0' ? _CSSNumericValue.Odeg : (0, _dimension.parseAngle)(s);
119
118
  },
120
- N: _2.parseNumber,
121
- T: _2.parseLengthOrPercentage,
122
- L: _2.parseLength
119
+ N: _numeric.parseNumber,
120
+ T: _dimension.parseLengthOrPercentage,
121
+ L: _dimension.parseLength
123
122
  }[type.toUpperCase()](arg);
124
123
  }
125
124
 
@@ -203,10 +202,10 @@ function mergeTransforms(left, right, target) {
203
202
  t: type,
204
203
  d: args.map(function (arg) {
205
204
  if (typeof arg === 'number') {
206
- return new _cssom.CSSUnitValue(defaultValue);
205
+ return new _CSSNumericValue.CSSUnitValue(defaultValue);
207
206
  }
208
207
 
209
- return new _cssom.CSSUnitValue(defaultValue, arg.unit); // {
208
+ return new _CSSNumericValue.CSSUnitValue(defaultValue, arg.unit); // {
210
209
  // unit: arg.unit,
211
210
  // value: defaultValue,
212
211
  // };
@@ -270,7 +269,7 @@ function mergeTransforms(left, right, target) {
270
269
  var stringConversions = [];
271
270
 
272
271
  for (var j = 0; j < leftArgs.length; j++) {
273
- var merge = leftArgs[j].unit === _cssom.UnitType.kNumber ? _2.mergeNumbers : _2.mergeDimensions; // @ts-ignore
272
+ var merge = leftArgs[j].unit === _types.UnitType.kNumber ? _numeric.mergeNumbers : _dimension.mergeDimensions; // @ts-ignore
274
273
 
275
274
  var merged = merge(leftArgs[j], rightArgs[j], target, false, j);
276
275
  leftArgsCopy[j] = merged[0];
@@ -111,40 +111,40 @@ function () {
111
111
  }) || [1, 1, 1];
112
112
  object.scaleLocal(newScale[0] / oldScale[0], newScale[1] / oldScale[1], newScale[2] / oldScale[2]);
113
113
  } else if (t === 'translate') {
114
- var newTranslation = value && value.d || [_parser.Opx, _parser.Opx];
115
- var oldTranslation = old && old.d || [_parser.Opx, _parser.Opx];
114
+ var newTranslation = value && value.d || [_cssom.Opx, _cssom.Opx];
115
+ var oldTranslation = old && old.d || [_cssom.Opx, _cssom.Opx];
116
116
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, 0);
117
117
  } else if (t === 'translatex') {
118
- var newTranslation = value && value.d || [_parser.Opx];
119
- var oldTranslation = old && old.d || [_parser.Opx];
118
+ var newTranslation = value && value.d || [_cssom.Opx];
119
+ var oldTranslation = old && old.d || [_cssom.Opx];
120
120
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, 0, 0);
121
121
  } else if (t === 'translatey') {
122
- var newTranslation = value && value.d || [_parser.Opx];
123
- var oldTranslation = old && old.d || [_parser.Opx];
122
+ var newTranslation = value && value.d || [_cssom.Opx];
123
+ var oldTranslation = old && old.d || [_cssom.Opx];
124
124
  object.translateLocal(0, newTranslation[0].value - oldTranslation[0].value, 0);
125
125
  } else if (t === 'translatez') {
126
- var newTranslation = value && value.d || [_parser.Opx];
127
- var oldTranslation = old && old.d || [_parser.Opx];
126
+ var newTranslation = value && value.d || [_cssom.Opx];
127
+ var oldTranslation = old && old.d || [_cssom.Opx];
128
128
  object.translateLocal(0, 0, newTranslation[0].value - oldTranslation[0].value);
129
129
  } else if (t === 'translate3d') {
130
- var newTranslation = value && value.d || [_parser.Opx, _parser.Opx, _parser.Opx];
131
- var oldTranslation = old && old.d || [_parser.Opx, _parser.Opx, _parser.Opx];
130
+ var newTranslation = value && value.d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
131
+ var oldTranslation = old && old.d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
132
132
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, newTranslation[2].value - oldTranslation[2].value);
133
133
  } else if (t === 'rotate') {
134
- var newAngles = value && value.d || [_parser.Odeg];
135
- var oldAngles = old && old.d || [_parser.Odeg];
134
+ var newAngles = value && value.d || [_cssom.Odeg];
135
+ var oldAngles = old && old.d || [_cssom.Odeg];
136
136
  object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
137
137
  } else if (t === 'rotatex') {
138
- var newAngles = value && value.d || [_parser.Odeg];
139
- var oldAngles = old && old.d || [_parser.Odeg];
138
+ var newAngles = value && value.d || [_cssom.Odeg];
139
+ var oldAngles = old && old.d || [_cssom.Odeg];
140
140
  object.rotateLocal(newAngles[0].value - oldAngles[0].value, 0, 0);
141
141
  } else if (t === 'rotatey') {
142
- var newAngles = value && value.d || [_parser.Odeg];
143
- var oldAngles = old && old.d || [_parser.Odeg];
142
+ var newAngles = value && value.d || [_cssom.Odeg];
143
+ var oldAngles = old && old.d || [_cssom.Odeg];
144
144
  object.rotateLocal(0, newAngles[0].value - oldAngles[0].value, 0);
145
145
  } else if (t === 'rotatez') {
146
- var newAngles = value && value.d || [_parser.Odeg];
147
- var oldAngles = old && old.d || [_parser.Odeg];
146
+ var newAngles = value && value.d || [_cssom.Odeg];
147
+ var oldAngles = old && old.d || [_cssom.Odeg];
148
148
  object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
149
149
  } else if (t === 'rotate3d') {// 暂不支持绕指定轴旋转
150
150
  // const newAngles = value && value.d || [Odeg, Odeg, Odeg];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.23-alpha.4",
3
+ "version": "5.0.23-alpha.8",
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.4",
41
+ "@antv/g-math": "^1.0.20-alpha.8",
42
42
  "@antv/util": "^3.0.0",
43
43
  "@types/offscreencanvas": "^2019.6.4",
44
44
  "d3-color": "^1.4.0",
@@ -52,5 +52,5 @@
52
52
  "scripts": {
53
53
  "umd": "webpack"
54
54
  },
55
- "gitHead": "07a45d1dcaeda55f64acd5486b1c19d132fac8bc"
55
+ "gitHead": "8c28e04155e41a948c323161a35aeda63c2294a4"
56
56
  }