@antv/g-lite 1.0.37 → 1.0.38
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.
- package/dist/css/CSSProperty.d.ts +1 -0
- package/dist/css/CSSProperty.d.ts.map +1 -1
- package/dist/css/StyleValueRegistry.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyAngle.d.ts +1 -0
- package/dist/css/properties/CSSPropertyAngle.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyColor.d.ts +4 -0
- package/dist/css/properties/CSSPropertyColor.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyFilter.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -0
- package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyNumber.d.ts +1 -0
- package/dist/css/properties/CSSPropertyNumber.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyOffsetDistance.d.ts +1 -0
- package/dist/css/properties/CSSPropertyOffsetDistance.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyOpacity.d.ts +1 -0
- package/dist/css/properties/CSSPropertyOpacity.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyPath.d.ts +1 -0
- package/dist/css/properties/CSSPropertyPath.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyTransform.d.ts +1 -0
- package/dist/css/properties/CSSPropertyTransform.d.ts.map +1 -1
- package/dist/display-objects/Circle.d.ts.map +1 -1
- package/dist/display-objects/CustomElement.d.ts.map +1 -1
- package/dist/display-objects/DisplayObject.d.ts +8 -0
- package/dist/display-objects/DisplayObject.d.ts.map +1 -1
- package/dist/display-objects/Ellipse.d.ts.map +1 -1
- package/dist/display-objects/Group.d.ts.map +1 -1
- package/dist/display-objects/HTML.d.ts.map +1 -1
- package/dist/display-objects/Path.d.ts.map +1 -1
- package/dist/display-objects/Polygon.d.ts.map +1 -1
- package/dist/display-objects/Polyline.d.ts.map +1 -1
- package/dist/display-objects/Text.d.ts +1 -1
- package/dist/display-objects/Text.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +81 -31
- package/dist/index.js +81 -31
- package/dist/index.umd.js +81 -31
- package/dist/index.umd.min.js +1 -1
- package/dist/utils/canvas.d.ts.map +1 -1
- package/dist/utils/string.d.ts +1 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1231,6 +1231,11 @@ var camelCase = memoize(function (str) {
|
|
|
1231
1231
|
return g[1].toUpperCase();
|
|
1232
1232
|
});
|
|
1233
1233
|
});
|
|
1234
|
+
var kebabize = function kebabize(str) {
|
|
1235
|
+
return str.split('').map(function (letter, idx) {
|
|
1236
|
+
return letter.toUpperCase() === letter ? "" + (idx !== 0 ? '-' : '') + letter.toLowerCase() : letter;
|
|
1237
|
+
}).join('');
|
|
1238
|
+
};
|
|
1234
1239
|
|
|
1235
1240
|
function DCHECK(bool) {
|
|
1236
1241
|
if (!bool) {
|
|
@@ -5921,6 +5926,7 @@ function convertKeyword2Percent(keyword) {
|
|
|
5921
5926
|
var CSSPropertyAngle = /*#__PURE__*/function () {
|
|
5922
5927
|
function CSSPropertyAngle() {
|
|
5923
5928
|
this.parser = parseAngle;
|
|
5929
|
+
this.parserWithCSSDisabled = null;
|
|
5924
5930
|
this.mixer = mergeNumbers;
|
|
5925
5931
|
}
|
|
5926
5932
|
var _proto = CSSPropertyAngle.prototype;
|
|
@@ -5958,6 +5964,7 @@ var CSSPropertyClipPath = /*#__PURE__*/function () {
|
|
|
5958
5964
|
var CSSPropertyColor = /*#__PURE__*/function () {
|
|
5959
5965
|
function CSSPropertyColor() {
|
|
5960
5966
|
this.parser = parseColor;
|
|
5967
|
+
this.parserWithCSSDisabled = parseColor;
|
|
5961
5968
|
this.mixer = mergeColors;
|
|
5962
5969
|
}
|
|
5963
5970
|
var _proto = CSSPropertyColor.prototype;
|
|
@@ -5996,6 +6003,7 @@ function getFontSize(object) {
|
|
|
5996
6003
|
var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
|
|
5997
6004
|
function CSSPropertyLengthOrPercentage() {
|
|
5998
6005
|
this.parser = parseLengthOrPercentage;
|
|
6006
|
+
this.parserWithCSSDisabled = null;
|
|
5999
6007
|
this.mixer = mergeNumbers;
|
|
6000
6008
|
}
|
|
6001
6009
|
var _proto = CSSPropertyLengthOrPercentage.prototype;
|
|
@@ -6219,6 +6227,7 @@ var CSSPropertyNumber = /*#__PURE__*/function () {
|
|
|
6219
6227
|
function CSSPropertyNumber() {
|
|
6220
6228
|
this.mixer = mergeNumbers;
|
|
6221
6229
|
this.parser = parseNumber;
|
|
6230
|
+
this.parserWithCSSDisabled = null;
|
|
6222
6231
|
}
|
|
6223
6232
|
var _proto = CSSPropertyNumber.prototype;
|
|
6224
6233
|
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
@@ -6230,6 +6239,7 @@ var CSSPropertyNumber = /*#__PURE__*/function () {
|
|
|
6230
6239
|
var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
|
|
6231
6240
|
function CSSPropertyOffsetDistance() {
|
|
6232
6241
|
this.parser = parseNumber;
|
|
6242
|
+
this.parserWithCSSDisabled = null;
|
|
6233
6243
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
6234
6244
|
}
|
|
6235
6245
|
var _proto = CSSPropertyOffsetDistance.prototype;
|
|
@@ -6263,6 +6273,7 @@ var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
|
|
|
6263
6273
|
var CSSPropertyOpacity = /*#__PURE__*/function () {
|
|
6264
6274
|
function CSSPropertyOpacity() {
|
|
6265
6275
|
this.parser = parseNumber;
|
|
6276
|
+
this.parserWithCSSDisabled = null;
|
|
6266
6277
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
6267
6278
|
}
|
|
6268
6279
|
var _proto = CSSPropertyOpacity.prototype;
|
|
@@ -6275,6 +6286,7 @@ var CSSPropertyOpacity = /*#__PURE__*/function () {
|
|
|
6275
6286
|
var CSSPropertyPath = /*#__PURE__*/function () {
|
|
6276
6287
|
function CSSPropertyPath() {
|
|
6277
6288
|
this.parser = parsePath;
|
|
6289
|
+
this.parserWithCSSDisabled = parsePath;
|
|
6278
6290
|
this.mixer = mergePaths;
|
|
6279
6291
|
}
|
|
6280
6292
|
var _proto = CSSPropertyPath.prototype;
|
|
@@ -6421,6 +6433,7 @@ var CSSPropertyTextTransform = /*#__PURE__*/function () {
|
|
|
6421
6433
|
var CSSPropertyTransform = /*#__PURE__*/function () {
|
|
6422
6434
|
function CSSPropertyTransform() {
|
|
6423
6435
|
this.parser = parseTransform;
|
|
6436
|
+
this.parserWithCSSDisabled = parseTransform;
|
|
6424
6437
|
this.mixer = mergeTransforms;
|
|
6425
6438
|
}
|
|
6426
6439
|
var _proto = CSSPropertyTransform.prototype;
|
|
@@ -8335,7 +8348,8 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
8335
8348
|
transform: [],
|
|
8336
8349
|
zIndex: 0,
|
|
8337
8350
|
filter: [],
|
|
8338
|
-
shadowType: 'outer'
|
|
8351
|
+
shadowType: 'outer',
|
|
8352
|
+
miterLimit: 10
|
|
8339
8353
|
};
|
|
8340
8354
|
var DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = _extends({}, DEFAULT_PARSED_STYLE_PROPS, {
|
|
8341
8355
|
opacity: 1,
|
|
@@ -8353,6 +8367,7 @@ var DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = _extends({}, DEFAULT_PARSED_STYLE_
|
|
|
8353
8367
|
|
|
8354
8368
|
var INHERITABLE_BASE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting'];
|
|
8355
8369
|
var INHERITABLE_STYLE_PROPS = [].concat(INHERITABLE_BASE_STYLE_PROPS, ['fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform']);
|
|
8370
|
+
var DATASET_PREFIX = 'data-';
|
|
8356
8371
|
/**
|
|
8357
8372
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
8358
8373
|
*
|
|
@@ -8381,6 +8396,14 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
8381
8396
|
* push to active animations after calling `animate()`
|
|
8382
8397
|
*/
|
|
8383
8398
|
|
|
8399
|
+
/**
|
|
8400
|
+
* Use data-* attribute.
|
|
8401
|
+
* @see https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
|
|
8402
|
+
* @example
|
|
8403
|
+
* group.dataset.prop1 = 1;
|
|
8404
|
+
* group.getAttribute('data-prop1'); // 1
|
|
8405
|
+
*/
|
|
8406
|
+
|
|
8384
8407
|
function DisplayObject(config) {
|
|
8385
8408
|
var _this$config$capture;
|
|
8386
8409
|
var _this;
|
|
@@ -8391,6 +8414,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
8391
8414
|
_this.isCustomElement = false;
|
|
8392
8415
|
_this.isMutationObserved = false;
|
|
8393
8416
|
_this.activeAnimations = [];
|
|
8417
|
+
_this.dataset = void 0;
|
|
8394
8418
|
_this.getClip = function () {
|
|
8395
8419
|
return this.style.clipPath || null;
|
|
8396
8420
|
};
|
|
@@ -8425,6 +8449,19 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
8425
8449
|
}
|
|
8426
8450
|
// start to process attributes
|
|
8427
8451
|
_this.initAttributes(_this.config.style);
|
|
8452
|
+
_this.dataset = new Proxy({}, {
|
|
8453
|
+
get: function get(target, name) {
|
|
8454
|
+
var formattedName = "" + DATASET_PREFIX + kebabize(name);
|
|
8455
|
+
if (target[formattedName] !== undefined) {
|
|
8456
|
+
return target[formattedName];
|
|
8457
|
+
}
|
|
8458
|
+
return _this.getAttribute(formattedName);
|
|
8459
|
+
},
|
|
8460
|
+
set: function set(_, prop, value) {
|
|
8461
|
+
_this.setAttribute("" + DATASET_PREFIX + kebabize(prop), value);
|
|
8462
|
+
return true;
|
|
8463
|
+
}
|
|
8464
|
+
});
|
|
8428
8465
|
_this.style = new Proxy(
|
|
8429
8466
|
// @ts-ignore
|
|
8430
8467
|
{
|
|
@@ -9082,11 +9119,11 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9082
9119
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
9083
9120
|
return _DisplayObject.call(this, _extends({
|
|
9084
9121
|
type: Shape.CIRCLE,
|
|
9085
|
-
style: _extends({
|
|
9122
|
+
style: runtime.enableCSSParsing ? _extends({
|
|
9086
9123
|
cx: '',
|
|
9087
9124
|
cy: '',
|
|
9088
9125
|
r: ''
|
|
9089
|
-
}, style),
|
|
9126
|
+
}, style) : _extends({}, style),
|
|
9090
9127
|
initialParsedStyle: {
|
|
9091
9128
|
anchor: [0.5, 0.5],
|
|
9092
9129
|
transformOrigin: runtime.enableCSSParsing ? null : [getOrCreateUnitValue(50, '%'), getOrCreateUnitValue(50, '%')]
|
|
@@ -9113,12 +9150,12 @@ var CustomElement = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9113
9150
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
9114
9151
|
style = _ref.style,
|
|
9115
9152
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
9116
|
-
_this = _DisplayObject.call(this, _extends({
|
|
9153
|
+
_this = _DisplayObject.call(this, runtime.enableCSSParsing ? _extends({
|
|
9117
9154
|
style: _extends({
|
|
9118
9155
|
x: '',
|
|
9119
9156
|
y: ''
|
|
9120
9157
|
}, style)
|
|
9121
|
-
}, rest)) || this;
|
|
9158
|
+
}, rest) : _extends({}, style)) || this;
|
|
9122
9159
|
_this.isCustomElement = true;
|
|
9123
9160
|
return _this;
|
|
9124
9161
|
}
|
|
@@ -9169,12 +9206,12 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9169
9206
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
9170
9207
|
return _DisplayObject.call(this, _extends({
|
|
9171
9208
|
type: Shape.ELLIPSE,
|
|
9172
|
-
style: _extends({
|
|
9209
|
+
style: runtime.enableCSSParsing ? _extends({
|
|
9173
9210
|
cx: '',
|
|
9174
9211
|
cy: '',
|
|
9175
9212
|
rx: '',
|
|
9176
9213
|
ry: ''
|
|
9177
|
-
}, style),
|
|
9214
|
+
}, style) : _extends({}, style),
|
|
9178
9215
|
initialParsedStyle: {
|
|
9179
9216
|
anchor: [0.5, 0.5],
|
|
9180
9217
|
transformOrigin: runtime.enableCSSParsing ? null : [getOrCreateUnitValue(50, '%'), getOrCreateUnitValue(50, '%')]
|
|
@@ -9203,12 +9240,12 @@ var Group = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9203
9240
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
9204
9241
|
return _DisplayObject.call(this, _extends({
|
|
9205
9242
|
type: Shape.GROUP,
|
|
9206
|
-
style: _extends({
|
|
9243
|
+
style: runtime.enableCSSParsing ? _extends({
|
|
9207
9244
|
x: '',
|
|
9208
9245
|
y: '',
|
|
9209
9246
|
width: '',
|
|
9210
9247
|
height: ''
|
|
9211
|
-
}, style)
|
|
9248
|
+
}, style) : _extends({}, style)
|
|
9212
9249
|
}, rest)) || this;
|
|
9213
9250
|
}
|
|
9214
9251
|
return Group;
|
|
@@ -9228,13 +9265,13 @@ var HTML = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9228
9265
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
9229
9266
|
_this = _DisplayObject.call(this, _extends({
|
|
9230
9267
|
type: Shape.HTML,
|
|
9231
|
-
style: _extends({
|
|
9268
|
+
style: runtime.enableCSSParsing ? _extends({
|
|
9232
9269
|
x: '',
|
|
9233
9270
|
y: '',
|
|
9234
9271
|
width: 'auto',
|
|
9235
9272
|
height: 'auto',
|
|
9236
9273
|
innerHTML: ''
|
|
9237
|
-
}, style)
|
|
9274
|
+
}, style) : _extends({}, style)
|
|
9238
9275
|
}, rest)) || this;
|
|
9239
9276
|
_this.cullable.enable = false;
|
|
9240
9277
|
return _this;
|
|
@@ -9493,6 +9530,7 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9493
9530
|
miterLimit: ''
|
|
9494
9531
|
}, style),
|
|
9495
9532
|
initialParsedStyle: runtime.enableCSSParsing ? null : {
|
|
9533
|
+
miterLimit: 4,
|
|
9496
9534
|
path: _extends({}, EMPTY_PARSED_PATH)
|
|
9497
9535
|
}
|
|
9498
9536
|
}, rest)) || this;
|
|
@@ -9719,7 +9757,10 @@ var Polygon = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9719
9757
|
points: '',
|
|
9720
9758
|
miterLimit: '',
|
|
9721
9759
|
isClosed: true
|
|
9722
|
-
}, style)
|
|
9760
|
+
}, style),
|
|
9761
|
+
initialParsedStyle: runtime.enableCSSParsing ? null : {
|
|
9762
|
+
miterLimit: 4
|
|
9763
|
+
}
|
|
9723
9764
|
}, rest)) || this;
|
|
9724
9765
|
_this.markerStartAngle = 0;
|
|
9725
9766
|
_this.markerEndAngle = 0;
|
|
@@ -9865,7 +9906,10 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
|
|
|
9865
9906
|
points: '',
|
|
9866
9907
|
miterLimit: '',
|
|
9867
9908
|
isClosed: false
|
|
9868
|
-
}, style)
|
|
9909
|
+
}, style),
|
|
9910
|
+
initialParsedStyle: runtime.enableCSSParsing ? null : {
|
|
9911
|
+
miterLimit: 4
|
|
9912
|
+
}
|
|
9869
9913
|
}, rest)) || this;
|
|
9870
9914
|
}
|
|
9871
9915
|
var _proto = Polyline.prototype;
|
|
@@ -9982,9 +10026,12 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9982
10026
|
leading: 0,
|
|
9983
10027
|
dx: '',
|
|
9984
10028
|
dy: ''
|
|
9985
|
-
}, style) : _extends({
|
|
10029
|
+
}, style) : _extends({
|
|
10030
|
+
fill: 'black'
|
|
10031
|
+
}, style),
|
|
9986
10032
|
initialParsedStyle: runtime.enableCSSParsing ? {} : {
|
|
9987
|
-
|
|
10033
|
+
x: 0,
|
|
10034
|
+
y: 0,
|
|
9988
10035
|
fontSize: 16,
|
|
9989
10036
|
fontFamily: 'sans-serif',
|
|
9990
10037
|
fontStyle: 'normal',
|
|
@@ -9994,7 +10041,6 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9994
10041
|
letterSpacing: 0,
|
|
9995
10042
|
textBaseline: 'alphabetic',
|
|
9996
10043
|
textAlign: 'start',
|
|
9997
|
-
miterLimit: 10,
|
|
9998
10044
|
wordWrap: false,
|
|
9999
10045
|
wordWrapWidth: 0,
|
|
10000
10046
|
leading: 0,
|
|
@@ -10638,14 +10684,14 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10638
10684
|
}
|
|
10639
10685
|
// Rect
|
|
10640
10686
|
// @ts-ignore
|
|
10641
|
-
if (attributes.radius) {
|
|
10687
|
+
if (!isNil(attributes.radius)) {
|
|
10642
10688
|
// @ts-ignore
|
|
10643
10689
|
object.parsedStyle.radius = parseDimensionArrayFormat(
|
|
10644
10690
|
// @ts-ignore
|
|
10645
10691
|
attributes.radius, 4);
|
|
10646
10692
|
}
|
|
10647
10693
|
// Polyline
|
|
10648
|
-
if (attributes.lineDash) {
|
|
10694
|
+
if (!isNil(attributes.lineDash)) {
|
|
10649
10695
|
object.parsedStyle.lineDash = parseDimensionArrayFormat(attributes.lineDash, 2);
|
|
10650
10696
|
}
|
|
10651
10697
|
// @ts-ignore
|
|
@@ -10716,31 +10762,35 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10716
10762
|
attributes.markerMid, null, null);
|
|
10717
10763
|
}
|
|
10718
10764
|
if (
|
|
10765
|
+
// Circle & Ellipse
|
|
10766
|
+
(object.nodeName === Shape.CIRCLE || object.nodeName === Shape.ELLIPSE) && (
|
|
10719
10767
|
// @ts-ignore
|
|
10720
|
-
attributes.cx ||
|
|
10768
|
+
!isNil(attributes.cx) ||
|
|
10721
10769
|
// @ts-ignore
|
|
10722
|
-
attributes.cy ||
|
|
10770
|
+
!isNil(attributes.cy)) || (object.nodeName === Shape.RECT || object.nodeName === Shape.IMAGE || object.nodeName === Shape.GROUP || object.nodeName === Shape.HTML || object.nodeName === Shape.TEXT || object.nodeName === Shape.MESH) && (
|
|
10723
10771
|
// @ts-ignore
|
|
10724
|
-
attributes.x ||
|
|
10772
|
+
!isNil(attributes.x) ||
|
|
10725
10773
|
// @ts-ignore
|
|
10726
|
-
attributes.y ||
|
|
10774
|
+
!isNil(attributes.y) ||
|
|
10727
10775
|
// @ts-ignore
|
|
10728
|
-
attributes.z ||
|
|
10776
|
+
!isNil(attributes.z)) ||
|
|
10777
|
+
// Line
|
|
10778
|
+
object.nodeName === Shape.LINE && (
|
|
10729
10779
|
// @ts-ignore
|
|
10730
|
-
attributes.x1 ||
|
|
10780
|
+
!isNil(attributes.x1) ||
|
|
10731
10781
|
// @ts-ignore
|
|
10732
|
-
attributes.y1 ||
|
|
10782
|
+
!isNil(attributes.y1) ||
|
|
10733
10783
|
// @ts-ignore
|
|
10734
|
-
attributes.z1 ||
|
|
10784
|
+
!isNil(attributes.z1) ||
|
|
10735
10785
|
// @ts-ignore
|
|
10736
|
-
attributes.x2 ||
|
|
10786
|
+
!isNil(attributes.x2) ||
|
|
10737
10787
|
// @ts-ignore
|
|
10738
|
-
attributes.y2 ||
|
|
10788
|
+
!isNil(attributes.y2) ||
|
|
10739
10789
|
// @ts-ignore
|
|
10740
|
-
attributes.z2) {
|
|
10790
|
+
!isNil(attributes.z2))) {
|
|
10741
10791
|
runtime.CSSPropertySyntaxFactory['<coordinate>'].postProcessor(object, _attributeNames);
|
|
10742
10792
|
}
|
|
10743
|
-
if (attributes.zIndex) {
|
|
10793
|
+
if (!isNil(attributes.zIndex)) {
|
|
10744
10794
|
runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, _attributeNames);
|
|
10745
10795
|
}
|
|
10746
10796
|
// @ts-ignore
|
|
@@ -10751,7 +10801,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10751
10801
|
if (attributes.points) {
|
|
10752
10802
|
runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object, _attributeNames);
|
|
10753
10803
|
}
|
|
10754
|
-
if (attributes.offsetDistance) {
|
|
10804
|
+
if (!isNil(attributes.offsetDistance)) {
|
|
10755
10805
|
runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, _attributeNames);
|
|
10756
10806
|
}
|
|
10757
10807
|
if (attributes.transform) {
|
package/dist/index.js
CHANGED
|
@@ -1235,6 +1235,11 @@ var camelCase = memoize(function (str) {
|
|
|
1235
1235
|
return g[1].toUpperCase();
|
|
1236
1236
|
});
|
|
1237
1237
|
});
|
|
1238
|
+
var kebabize = function kebabize(str) {
|
|
1239
|
+
return str.split('').map(function (letter, idx) {
|
|
1240
|
+
return letter.toUpperCase() === letter ? "" + (idx !== 0 ? '-' : '') + letter.toLowerCase() : letter;
|
|
1241
|
+
}).join('');
|
|
1242
|
+
};
|
|
1238
1243
|
|
|
1239
1244
|
function DCHECK(bool) {
|
|
1240
1245
|
if (!bool) {
|
|
@@ -5923,6 +5928,7 @@ function convertKeyword2Percent(keyword) {
|
|
|
5923
5928
|
var CSSPropertyAngle = /*#__PURE__*/function () {
|
|
5924
5929
|
function CSSPropertyAngle() {
|
|
5925
5930
|
this.parser = parseAngle;
|
|
5931
|
+
this.parserWithCSSDisabled = null;
|
|
5926
5932
|
this.mixer = mergeNumbers;
|
|
5927
5933
|
}
|
|
5928
5934
|
var _proto = CSSPropertyAngle.prototype;
|
|
@@ -5960,6 +5966,7 @@ var CSSPropertyClipPath = /*#__PURE__*/function () {
|
|
|
5960
5966
|
var CSSPropertyColor = /*#__PURE__*/function () {
|
|
5961
5967
|
function CSSPropertyColor() {
|
|
5962
5968
|
this.parser = parseColor;
|
|
5969
|
+
this.parserWithCSSDisabled = parseColor;
|
|
5963
5970
|
this.mixer = mergeColors;
|
|
5964
5971
|
}
|
|
5965
5972
|
var _proto = CSSPropertyColor.prototype;
|
|
@@ -5998,6 +6005,7 @@ function getFontSize(object) {
|
|
|
5998
6005
|
var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
|
|
5999
6006
|
function CSSPropertyLengthOrPercentage() {
|
|
6000
6007
|
this.parser = parseLengthOrPercentage;
|
|
6008
|
+
this.parserWithCSSDisabled = null;
|
|
6001
6009
|
this.mixer = mergeNumbers;
|
|
6002
6010
|
}
|
|
6003
6011
|
var _proto = CSSPropertyLengthOrPercentage.prototype;
|
|
@@ -6221,6 +6229,7 @@ var CSSPropertyNumber = /*#__PURE__*/function () {
|
|
|
6221
6229
|
function CSSPropertyNumber() {
|
|
6222
6230
|
this.mixer = mergeNumbers;
|
|
6223
6231
|
this.parser = parseNumber;
|
|
6232
|
+
this.parserWithCSSDisabled = null;
|
|
6224
6233
|
}
|
|
6225
6234
|
var _proto = CSSPropertyNumber.prototype;
|
|
6226
6235
|
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
@@ -6232,6 +6241,7 @@ var CSSPropertyNumber = /*#__PURE__*/function () {
|
|
|
6232
6241
|
var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
|
|
6233
6242
|
function CSSPropertyOffsetDistance() {
|
|
6234
6243
|
this.parser = parseNumber;
|
|
6244
|
+
this.parserWithCSSDisabled = null;
|
|
6235
6245
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
6236
6246
|
}
|
|
6237
6247
|
var _proto = CSSPropertyOffsetDistance.prototype;
|
|
@@ -6265,6 +6275,7 @@ var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
|
|
|
6265
6275
|
var CSSPropertyOpacity = /*#__PURE__*/function () {
|
|
6266
6276
|
function CSSPropertyOpacity() {
|
|
6267
6277
|
this.parser = parseNumber;
|
|
6278
|
+
this.parserWithCSSDisabled = null;
|
|
6268
6279
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
6269
6280
|
}
|
|
6270
6281
|
var _proto = CSSPropertyOpacity.prototype;
|
|
@@ -6277,6 +6288,7 @@ var CSSPropertyOpacity = /*#__PURE__*/function () {
|
|
|
6277
6288
|
var CSSPropertyPath = /*#__PURE__*/function () {
|
|
6278
6289
|
function CSSPropertyPath() {
|
|
6279
6290
|
this.parser = parsePath;
|
|
6291
|
+
this.parserWithCSSDisabled = parsePath;
|
|
6280
6292
|
this.mixer = mergePaths;
|
|
6281
6293
|
}
|
|
6282
6294
|
var _proto = CSSPropertyPath.prototype;
|
|
@@ -6423,6 +6435,7 @@ var CSSPropertyTextTransform = /*#__PURE__*/function () {
|
|
|
6423
6435
|
var CSSPropertyTransform = /*#__PURE__*/function () {
|
|
6424
6436
|
function CSSPropertyTransform() {
|
|
6425
6437
|
this.parser = parseTransform;
|
|
6438
|
+
this.parserWithCSSDisabled = parseTransform;
|
|
6426
6439
|
this.mixer = mergeTransforms;
|
|
6427
6440
|
}
|
|
6428
6441
|
var _proto = CSSPropertyTransform.prototype;
|
|
@@ -8335,7 +8348,8 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
8335
8348
|
transform: [],
|
|
8336
8349
|
zIndex: 0,
|
|
8337
8350
|
filter: [],
|
|
8338
|
-
shadowType: 'outer'
|
|
8351
|
+
shadowType: 'outer',
|
|
8352
|
+
miterLimit: 10
|
|
8339
8353
|
};
|
|
8340
8354
|
var DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = _extends({}, DEFAULT_PARSED_STYLE_PROPS, {
|
|
8341
8355
|
opacity: 1,
|
|
@@ -8353,6 +8367,7 @@ var DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = _extends({}, DEFAULT_PARSED_STYLE_
|
|
|
8353
8367
|
|
|
8354
8368
|
var INHERITABLE_BASE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting'];
|
|
8355
8369
|
var INHERITABLE_STYLE_PROPS = [].concat(INHERITABLE_BASE_STYLE_PROPS, ['fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform']);
|
|
8370
|
+
var DATASET_PREFIX = 'data-';
|
|
8356
8371
|
/**
|
|
8357
8372
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
8358
8373
|
*
|
|
@@ -8381,6 +8396,14 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
8381
8396
|
* push to active animations after calling `animate()`
|
|
8382
8397
|
*/
|
|
8383
8398
|
|
|
8399
|
+
/**
|
|
8400
|
+
* Use data-* attribute.
|
|
8401
|
+
* @see https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
|
|
8402
|
+
* @example
|
|
8403
|
+
* group.dataset.prop1 = 1;
|
|
8404
|
+
* group.getAttribute('data-prop1'); // 1
|
|
8405
|
+
*/
|
|
8406
|
+
|
|
8384
8407
|
function DisplayObject(config) {
|
|
8385
8408
|
var _this$config$capture;
|
|
8386
8409
|
var _this;
|
|
@@ -8391,6 +8414,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
8391
8414
|
_this.isCustomElement = false;
|
|
8392
8415
|
_this.isMutationObserved = false;
|
|
8393
8416
|
_this.activeAnimations = [];
|
|
8417
|
+
_this.dataset = void 0;
|
|
8394
8418
|
_this.getClip = function () {
|
|
8395
8419
|
return this.style.clipPath || null;
|
|
8396
8420
|
};
|
|
@@ -8425,6 +8449,19 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
8425
8449
|
}
|
|
8426
8450
|
// start to process attributes
|
|
8427
8451
|
_this.initAttributes(_this.config.style);
|
|
8452
|
+
_this.dataset = new Proxy({}, {
|
|
8453
|
+
get: function get(target, name) {
|
|
8454
|
+
var formattedName = "" + DATASET_PREFIX + kebabize(name);
|
|
8455
|
+
if (target[formattedName] !== undefined) {
|
|
8456
|
+
return target[formattedName];
|
|
8457
|
+
}
|
|
8458
|
+
return _this.getAttribute(formattedName);
|
|
8459
|
+
},
|
|
8460
|
+
set: function set(_, prop, value) {
|
|
8461
|
+
_this.setAttribute("" + DATASET_PREFIX + kebabize(prop), value);
|
|
8462
|
+
return true;
|
|
8463
|
+
}
|
|
8464
|
+
});
|
|
8428
8465
|
_this.style = new Proxy(
|
|
8429
8466
|
// @ts-ignore
|
|
8430
8467
|
{
|
|
@@ -9082,11 +9119,11 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9082
9119
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
9083
9120
|
return _DisplayObject.call(this, _extends({
|
|
9084
9121
|
type: exports.Shape.CIRCLE,
|
|
9085
|
-
style: _extends({
|
|
9122
|
+
style: runtime.enableCSSParsing ? _extends({
|
|
9086
9123
|
cx: '',
|
|
9087
9124
|
cy: '',
|
|
9088
9125
|
r: ''
|
|
9089
|
-
}, style),
|
|
9126
|
+
}, style) : _extends({}, style),
|
|
9090
9127
|
initialParsedStyle: {
|
|
9091
9128
|
anchor: [0.5, 0.5],
|
|
9092
9129
|
transformOrigin: runtime.enableCSSParsing ? null : [getOrCreateUnitValue(50, '%'), getOrCreateUnitValue(50, '%')]
|
|
@@ -9113,12 +9150,12 @@ var CustomElement = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9113
9150
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
9114
9151
|
style = _ref.style,
|
|
9115
9152
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
9116
|
-
_this = _DisplayObject.call(this, _extends({
|
|
9153
|
+
_this = _DisplayObject.call(this, runtime.enableCSSParsing ? _extends({
|
|
9117
9154
|
style: _extends({
|
|
9118
9155
|
x: '',
|
|
9119
9156
|
y: ''
|
|
9120
9157
|
}, style)
|
|
9121
|
-
}, rest)) || this;
|
|
9158
|
+
}, rest) : _extends({}, style)) || this;
|
|
9122
9159
|
_this.isCustomElement = true;
|
|
9123
9160
|
return _this;
|
|
9124
9161
|
}
|
|
@@ -9169,12 +9206,12 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9169
9206
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
9170
9207
|
return _DisplayObject.call(this, _extends({
|
|
9171
9208
|
type: exports.Shape.ELLIPSE,
|
|
9172
|
-
style: _extends({
|
|
9209
|
+
style: runtime.enableCSSParsing ? _extends({
|
|
9173
9210
|
cx: '',
|
|
9174
9211
|
cy: '',
|
|
9175
9212
|
rx: '',
|
|
9176
9213
|
ry: ''
|
|
9177
|
-
}, style),
|
|
9214
|
+
}, style) : _extends({}, style),
|
|
9178
9215
|
initialParsedStyle: {
|
|
9179
9216
|
anchor: [0.5, 0.5],
|
|
9180
9217
|
transformOrigin: runtime.enableCSSParsing ? null : [getOrCreateUnitValue(50, '%'), getOrCreateUnitValue(50, '%')]
|
|
@@ -9203,12 +9240,12 @@ var Group = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9203
9240
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
9204
9241
|
return _DisplayObject.call(this, _extends({
|
|
9205
9242
|
type: exports.Shape.GROUP,
|
|
9206
|
-
style: _extends({
|
|
9243
|
+
style: runtime.enableCSSParsing ? _extends({
|
|
9207
9244
|
x: '',
|
|
9208
9245
|
y: '',
|
|
9209
9246
|
width: '',
|
|
9210
9247
|
height: ''
|
|
9211
|
-
}, style)
|
|
9248
|
+
}, style) : _extends({}, style)
|
|
9212
9249
|
}, rest)) || this;
|
|
9213
9250
|
}
|
|
9214
9251
|
return Group;
|
|
@@ -9228,13 +9265,13 @@ var HTML = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9228
9265
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
9229
9266
|
_this = _DisplayObject.call(this, _extends({
|
|
9230
9267
|
type: exports.Shape.HTML,
|
|
9231
|
-
style: _extends({
|
|
9268
|
+
style: runtime.enableCSSParsing ? _extends({
|
|
9232
9269
|
x: '',
|
|
9233
9270
|
y: '',
|
|
9234
9271
|
width: 'auto',
|
|
9235
9272
|
height: 'auto',
|
|
9236
9273
|
innerHTML: ''
|
|
9237
|
-
}, style)
|
|
9274
|
+
}, style) : _extends({}, style)
|
|
9238
9275
|
}, rest)) || this;
|
|
9239
9276
|
_this.cullable.enable = false;
|
|
9240
9277
|
return _this;
|
|
@@ -9493,6 +9530,7 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9493
9530
|
miterLimit: ''
|
|
9494
9531
|
}, style),
|
|
9495
9532
|
initialParsedStyle: runtime.enableCSSParsing ? null : {
|
|
9533
|
+
miterLimit: 4,
|
|
9496
9534
|
path: _extends({}, EMPTY_PARSED_PATH)
|
|
9497
9535
|
}
|
|
9498
9536
|
}, rest)) || this;
|
|
@@ -9719,7 +9757,10 @@ var Polygon = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9719
9757
|
points: '',
|
|
9720
9758
|
miterLimit: '',
|
|
9721
9759
|
isClosed: true
|
|
9722
|
-
}, style)
|
|
9760
|
+
}, style),
|
|
9761
|
+
initialParsedStyle: runtime.enableCSSParsing ? null : {
|
|
9762
|
+
miterLimit: 4
|
|
9763
|
+
}
|
|
9723
9764
|
}, rest)) || this;
|
|
9724
9765
|
_this.markerStartAngle = 0;
|
|
9725
9766
|
_this.markerEndAngle = 0;
|
|
@@ -9865,7 +9906,10 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
|
|
|
9865
9906
|
points: '',
|
|
9866
9907
|
miterLimit: '',
|
|
9867
9908
|
isClosed: false
|
|
9868
|
-
}, style)
|
|
9909
|
+
}, style),
|
|
9910
|
+
initialParsedStyle: runtime.enableCSSParsing ? null : {
|
|
9911
|
+
miterLimit: 4
|
|
9912
|
+
}
|
|
9869
9913
|
}, rest)) || this;
|
|
9870
9914
|
}
|
|
9871
9915
|
var _proto = Polyline.prototype;
|
|
@@ -9982,9 +10026,12 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9982
10026
|
leading: 0,
|
|
9983
10027
|
dx: '',
|
|
9984
10028
|
dy: ''
|
|
9985
|
-
}, style) : _extends({
|
|
10029
|
+
}, style) : _extends({
|
|
10030
|
+
fill: 'black'
|
|
10031
|
+
}, style),
|
|
9986
10032
|
initialParsedStyle: runtime.enableCSSParsing ? {} : {
|
|
9987
|
-
|
|
10033
|
+
x: 0,
|
|
10034
|
+
y: 0,
|
|
9988
10035
|
fontSize: 16,
|
|
9989
10036
|
fontFamily: 'sans-serif',
|
|
9990
10037
|
fontStyle: 'normal',
|
|
@@ -9994,7 +10041,6 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9994
10041
|
letterSpacing: 0,
|
|
9995
10042
|
textBaseline: 'alphabetic',
|
|
9996
10043
|
textAlign: 'start',
|
|
9997
|
-
miterLimit: 10,
|
|
9998
10044
|
wordWrap: false,
|
|
9999
10045
|
wordWrapWidth: 0,
|
|
10000
10046
|
leading: 0,
|
|
@@ -10638,14 +10684,14 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10638
10684
|
}
|
|
10639
10685
|
// Rect
|
|
10640
10686
|
// @ts-ignore
|
|
10641
|
-
if (attributes.radius) {
|
|
10687
|
+
if (!util.isNil(attributes.radius)) {
|
|
10642
10688
|
// @ts-ignore
|
|
10643
10689
|
object.parsedStyle.radius = parseDimensionArrayFormat(
|
|
10644
10690
|
// @ts-ignore
|
|
10645
10691
|
attributes.radius, 4);
|
|
10646
10692
|
}
|
|
10647
10693
|
// Polyline
|
|
10648
|
-
if (attributes.lineDash) {
|
|
10694
|
+
if (!util.isNil(attributes.lineDash)) {
|
|
10649
10695
|
object.parsedStyle.lineDash = parseDimensionArrayFormat(attributes.lineDash, 2);
|
|
10650
10696
|
}
|
|
10651
10697
|
// @ts-ignore
|
|
@@ -10716,31 +10762,35 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10716
10762
|
attributes.markerMid, null, null);
|
|
10717
10763
|
}
|
|
10718
10764
|
if (
|
|
10765
|
+
// Circle & Ellipse
|
|
10766
|
+
(object.nodeName === exports.Shape.CIRCLE || object.nodeName === exports.Shape.ELLIPSE) && (
|
|
10719
10767
|
// @ts-ignore
|
|
10720
|
-
attributes.cx ||
|
|
10768
|
+
!util.isNil(attributes.cx) ||
|
|
10721
10769
|
// @ts-ignore
|
|
10722
|
-
attributes.cy ||
|
|
10770
|
+
!util.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) && (
|
|
10723
10771
|
// @ts-ignore
|
|
10724
|
-
attributes.x ||
|
|
10772
|
+
!util.isNil(attributes.x) ||
|
|
10725
10773
|
// @ts-ignore
|
|
10726
|
-
attributes.y ||
|
|
10774
|
+
!util.isNil(attributes.y) ||
|
|
10727
10775
|
// @ts-ignore
|
|
10728
|
-
attributes.z ||
|
|
10776
|
+
!util.isNil(attributes.z)) ||
|
|
10777
|
+
// Line
|
|
10778
|
+
object.nodeName === exports.Shape.LINE && (
|
|
10729
10779
|
// @ts-ignore
|
|
10730
|
-
attributes.x1 ||
|
|
10780
|
+
!util.isNil(attributes.x1) ||
|
|
10731
10781
|
// @ts-ignore
|
|
10732
|
-
attributes.y1 ||
|
|
10782
|
+
!util.isNil(attributes.y1) ||
|
|
10733
10783
|
// @ts-ignore
|
|
10734
|
-
attributes.z1 ||
|
|
10784
|
+
!util.isNil(attributes.z1) ||
|
|
10735
10785
|
// @ts-ignore
|
|
10736
|
-
attributes.x2 ||
|
|
10786
|
+
!util.isNil(attributes.x2) ||
|
|
10737
10787
|
// @ts-ignore
|
|
10738
|
-
attributes.y2 ||
|
|
10788
|
+
!util.isNil(attributes.y2) ||
|
|
10739
10789
|
// @ts-ignore
|
|
10740
|
-
attributes.z2) {
|
|
10790
|
+
!util.isNil(attributes.z2))) {
|
|
10741
10791
|
runtime.CSSPropertySyntaxFactory['<coordinate>'].postProcessor(object, _attributeNames);
|
|
10742
10792
|
}
|
|
10743
|
-
if (attributes.zIndex) {
|
|
10793
|
+
if (!util.isNil(attributes.zIndex)) {
|
|
10744
10794
|
runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, _attributeNames);
|
|
10745
10795
|
}
|
|
10746
10796
|
// @ts-ignore
|
|
@@ -10751,7 +10801,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10751
10801
|
if (attributes.points) {
|
|
10752
10802
|
runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object, _attributeNames);
|
|
10753
10803
|
}
|
|
10754
|
-
if (attributes.offsetDistance) {
|
|
10804
|
+
if (!util.isNil(attributes.offsetDistance)) {
|
|
10755
10805
|
runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, _attributeNames);
|
|
10756
10806
|
}
|
|
10757
10807
|
if (attributes.transform) {
|