@antv/g 5.1.8 → 5.2.0
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/StyleValueRegistry.d.ts.map +1 -1
- package/dist/css/cssom/CSSGradientValue.d.ts +10 -23
- package/dist/css/cssom/CSSGradientValue.d.ts.map +1 -1
- package/dist/css/parser/color.d.ts +12 -3
- package/dist/css/parser/color.d.ts.map +1 -1
- package/dist/css/parser/dimension.d.ts.map +1 -1
- package/dist/css/parser/gradient.d.ts +4 -0
- package/dist/css/parser/gradient.d.ts.map +1 -0
- package/dist/css/properties/CSSPropertyColor.d.ts +5 -4
- package/dist/css/properties/CSSPropertyColor.d.ts.map +1 -1
- package/dist/dom/KeyframeList.d.ts.map +1 -1
- package/dist/index.esm.js +670 -215
- package/dist/index.js +674 -213
- package/dist/index.umd.js +1401 -265
- package/dist/index.umd.min.js +2 -2
- package/dist/services/aabb/RectUpdater.d.ts +1 -1
- package/dist/services/aabb/RectUpdater.d.ts.map +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/gradient.d.ts +106 -0
- package/dist/utils/gradient.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/path.d.ts.map +1 -1
- package/package.json +8 -5
package/dist/index.umd.js
CHANGED
|
@@ -8350,6 +8350,379 @@
|
|
|
8350
8350
|
touchcancel: 'pointercancel'
|
|
8351
8351
|
};
|
|
8352
8352
|
|
|
8353
|
+
/**
|
|
8354
|
+
* borrow from gradient-parser, but we delete some browser compatible prefix such as `-webkit-`
|
|
8355
|
+
* @see https://github.com/rafaelcaricio/gradient-parser
|
|
8356
|
+
*/
|
|
8357
|
+
function colorStopToString(colorStop) {
|
|
8358
|
+
var type = colorStop.type,
|
|
8359
|
+
value = colorStop.value;
|
|
8360
|
+
|
|
8361
|
+
if (type === 'hex') {
|
|
8362
|
+
return "#" + value;
|
|
8363
|
+
} else if (type === 'literal') {
|
|
8364
|
+
return value;
|
|
8365
|
+
} else if (type === 'rgb') {
|
|
8366
|
+
return "rgb(" + value.join(',') + ")";
|
|
8367
|
+
} else {
|
|
8368
|
+
return "rgba(" + value.join(',') + ")";
|
|
8369
|
+
}
|
|
8370
|
+
}
|
|
8371
|
+
var parseGradient = function () {
|
|
8372
|
+
var tokens = {
|
|
8373
|
+
linearGradient: /^(linear\-gradient)/i,
|
|
8374
|
+
repeatingLinearGradient: /^(repeating\-linear\-gradient)/i,
|
|
8375
|
+
radialGradient: /^(radial\-gradient)/i,
|
|
8376
|
+
repeatingRadialGradient: /^(repeating\-radial\-gradient)/i,
|
|
8377
|
+
|
|
8378
|
+
/**
|
|
8379
|
+
* @see https://projects.verou.me/conic-gradient/
|
|
8380
|
+
*/
|
|
8381
|
+
conicGradient: /^(conic\-gradient)/i,
|
|
8382
|
+
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
|
|
8383
|
+
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
|
8384
|
+
positionKeywords: /^(left|center|right|top|bottom)/i,
|
|
8385
|
+
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
|
8386
|
+
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
|
8387
|
+
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
|
8388
|
+
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
8389
|
+
startCall: /^\(/,
|
|
8390
|
+
endCall: /^\)/,
|
|
8391
|
+
comma: /^,/,
|
|
8392
|
+
hexColor: /^\#([0-9a-fA-F]+)/,
|
|
8393
|
+
literalColor: /^([a-zA-Z]+)/,
|
|
8394
|
+
rgbColor: /^rgb/i,
|
|
8395
|
+
rgbaColor: /^rgba/i,
|
|
8396
|
+
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
|
|
8397
|
+
};
|
|
8398
|
+
var input = '';
|
|
8399
|
+
|
|
8400
|
+
function error(msg) {
|
|
8401
|
+
throw new Error(input + ': ' + msg);
|
|
8402
|
+
}
|
|
8403
|
+
|
|
8404
|
+
function getAST() {
|
|
8405
|
+
var ast = matchListDefinitions();
|
|
8406
|
+
|
|
8407
|
+
if (input.length > 0) {
|
|
8408
|
+
error('Invalid input not EOF');
|
|
8409
|
+
}
|
|
8410
|
+
|
|
8411
|
+
return ast;
|
|
8412
|
+
}
|
|
8413
|
+
|
|
8414
|
+
function matchListDefinitions() {
|
|
8415
|
+
return matchListing(matchDefinition);
|
|
8416
|
+
}
|
|
8417
|
+
|
|
8418
|
+
function matchDefinition() {
|
|
8419
|
+
return matchGradient('linear-gradient', tokens.linearGradient, matchLinearOrientation) || matchGradient('repeating-linear-gradient', tokens.repeatingLinearGradient, matchLinearOrientation) || matchGradient('radial-gradient', tokens.radialGradient, matchListRadialOrientations) || matchGradient('repeating-radial-gradient', tokens.repeatingRadialGradient, matchListRadialOrientations) || matchGradient('conic-gradient', tokens.conicGradient, matchListRadialOrientations);
|
|
8420
|
+
}
|
|
8421
|
+
|
|
8422
|
+
function matchGradient(gradientType, pattern, orientationMatcher) {
|
|
8423
|
+
return matchCall(pattern, function (captures) {
|
|
8424
|
+
var orientation = orientationMatcher();
|
|
8425
|
+
|
|
8426
|
+
if (orientation) {
|
|
8427
|
+
if (!scan(tokens.comma)) {
|
|
8428
|
+
error('Missing comma before color stops');
|
|
8429
|
+
}
|
|
8430
|
+
}
|
|
8431
|
+
|
|
8432
|
+
return {
|
|
8433
|
+
type: gradientType,
|
|
8434
|
+
orientation: orientation,
|
|
8435
|
+
colorStops: matchListing(matchColorStop)
|
|
8436
|
+
};
|
|
8437
|
+
});
|
|
8438
|
+
}
|
|
8439
|
+
|
|
8440
|
+
function matchCall(pattern, callback) {
|
|
8441
|
+
var captures = scan(pattern);
|
|
8442
|
+
|
|
8443
|
+
if (captures) {
|
|
8444
|
+
if (!scan(tokens.startCall)) {
|
|
8445
|
+
error('Missing (');
|
|
8446
|
+
}
|
|
8447
|
+
|
|
8448
|
+
var result = callback(captures);
|
|
8449
|
+
|
|
8450
|
+
if (!scan(tokens.endCall)) {
|
|
8451
|
+
error('Missing )');
|
|
8452
|
+
}
|
|
8453
|
+
|
|
8454
|
+
return result;
|
|
8455
|
+
}
|
|
8456
|
+
}
|
|
8457
|
+
|
|
8458
|
+
function matchLinearOrientation() {
|
|
8459
|
+
return matchSideOrCorner() || matchAngle();
|
|
8460
|
+
}
|
|
8461
|
+
|
|
8462
|
+
function matchSideOrCorner() {
|
|
8463
|
+
return match('directional', tokens.sideOrCorner, 1);
|
|
8464
|
+
}
|
|
8465
|
+
|
|
8466
|
+
function matchAngle() {
|
|
8467
|
+
return match('angular', tokens.angleValue, 1);
|
|
8468
|
+
}
|
|
8469
|
+
|
|
8470
|
+
function matchListRadialOrientations() {
|
|
8471
|
+
var radialOrientations,
|
|
8472
|
+
radialOrientation = matchRadialOrientation(),
|
|
8473
|
+
lookaheadCache;
|
|
8474
|
+
|
|
8475
|
+
if (radialOrientation) {
|
|
8476
|
+
radialOrientations = [];
|
|
8477
|
+
radialOrientations.push(radialOrientation);
|
|
8478
|
+
lookaheadCache = input;
|
|
8479
|
+
|
|
8480
|
+
if (scan(tokens.comma)) {
|
|
8481
|
+
radialOrientation = matchRadialOrientation();
|
|
8482
|
+
|
|
8483
|
+
if (radialOrientation) {
|
|
8484
|
+
radialOrientations.push(radialOrientation);
|
|
8485
|
+
} else {
|
|
8486
|
+
input = lookaheadCache;
|
|
8487
|
+
}
|
|
8488
|
+
}
|
|
8489
|
+
}
|
|
8490
|
+
|
|
8491
|
+
return radialOrientations;
|
|
8492
|
+
}
|
|
8493
|
+
|
|
8494
|
+
function matchRadialOrientation() {
|
|
8495
|
+
var radialType = matchCircle() || matchEllipse();
|
|
8496
|
+
|
|
8497
|
+
if (radialType) {
|
|
8498
|
+
// @ts-ignore
|
|
8499
|
+
radialType.at = matchAtPosition();
|
|
8500
|
+
} else {
|
|
8501
|
+
var extent = matchExtentKeyword();
|
|
8502
|
+
|
|
8503
|
+
if (extent) {
|
|
8504
|
+
radialType = extent;
|
|
8505
|
+
var positionAt = matchAtPosition();
|
|
8506
|
+
|
|
8507
|
+
if (positionAt) {
|
|
8508
|
+
// @ts-ignore
|
|
8509
|
+
radialType.at = positionAt;
|
|
8510
|
+
}
|
|
8511
|
+
} else {
|
|
8512
|
+
var defaultPosition = matchPositioning();
|
|
8513
|
+
|
|
8514
|
+
if (defaultPosition) {
|
|
8515
|
+
radialType = {
|
|
8516
|
+
type: 'default-radial',
|
|
8517
|
+
// @ts-ignore
|
|
8518
|
+
at: defaultPosition
|
|
8519
|
+
};
|
|
8520
|
+
}
|
|
8521
|
+
}
|
|
8522
|
+
}
|
|
8523
|
+
|
|
8524
|
+
return radialType;
|
|
8525
|
+
}
|
|
8526
|
+
|
|
8527
|
+
function matchCircle() {
|
|
8528
|
+
var circle = match('shape', /^(circle)/i, 0);
|
|
8529
|
+
|
|
8530
|
+
if (circle) {
|
|
8531
|
+
// @ts-ignore
|
|
8532
|
+
circle.style = matchLength() || matchExtentKeyword();
|
|
8533
|
+
}
|
|
8534
|
+
|
|
8535
|
+
return circle;
|
|
8536
|
+
}
|
|
8537
|
+
|
|
8538
|
+
function matchEllipse() {
|
|
8539
|
+
var ellipse = match('shape', /^(ellipse)/i, 0);
|
|
8540
|
+
|
|
8541
|
+
if (ellipse) {
|
|
8542
|
+
// @ts-ignore
|
|
8543
|
+
ellipse.style = matchDistance() || matchExtentKeyword();
|
|
8544
|
+
}
|
|
8545
|
+
|
|
8546
|
+
return ellipse;
|
|
8547
|
+
}
|
|
8548
|
+
|
|
8549
|
+
function matchExtentKeyword() {
|
|
8550
|
+
return match('extent-keyword', tokens.extentKeywords, 1);
|
|
8551
|
+
}
|
|
8552
|
+
|
|
8553
|
+
function matchAtPosition() {
|
|
8554
|
+
if (match('position', /^at/, 0)) {
|
|
8555
|
+
var positioning = matchPositioning();
|
|
8556
|
+
|
|
8557
|
+
if (!positioning) {
|
|
8558
|
+
error('Missing positioning value');
|
|
8559
|
+
}
|
|
8560
|
+
|
|
8561
|
+
return positioning;
|
|
8562
|
+
}
|
|
8563
|
+
}
|
|
8564
|
+
|
|
8565
|
+
function matchPositioning() {
|
|
8566
|
+
var location = matchCoordinates();
|
|
8567
|
+
|
|
8568
|
+
if (location.x || location.y) {
|
|
8569
|
+
return {
|
|
8570
|
+
type: 'position',
|
|
8571
|
+
value: location
|
|
8572
|
+
};
|
|
8573
|
+
}
|
|
8574
|
+
}
|
|
8575
|
+
|
|
8576
|
+
function matchCoordinates() {
|
|
8577
|
+
return {
|
|
8578
|
+
x: matchDistance(),
|
|
8579
|
+
y: matchDistance()
|
|
8580
|
+
};
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
function matchListing(matcher) {
|
|
8584
|
+
var captures = matcher();
|
|
8585
|
+
var result = [];
|
|
8586
|
+
|
|
8587
|
+
if (captures) {
|
|
8588
|
+
result.push(captures);
|
|
8589
|
+
|
|
8590
|
+
while (scan(tokens.comma)) {
|
|
8591
|
+
captures = matcher();
|
|
8592
|
+
|
|
8593
|
+
if (captures) {
|
|
8594
|
+
result.push(captures);
|
|
8595
|
+
} else {
|
|
8596
|
+
error('One extra comma');
|
|
8597
|
+
}
|
|
8598
|
+
}
|
|
8599
|
+
}
|
|
8600
|
+
|
|
8601
|
+
return result;
|
|
8602
|
+
}
|
|
8603
|
+
|
|
8604
|
+
function matchColorStop() {
|
|
8605
|
+
var color = matchColor();
|
|
8606
|
+
|
|
8607
|
+
if (!color) {
|
|
8608
|
+
error('Expected color definition');
|
|
8609
|
+
}
|
|
8610
|
+
|
|
8611
|
+
color.length = matchDistance();
|
|
8612
|
+
return color;
|
|
8613
|
+
}
|
|
8614
|
+
|
|
8615
|
+
function matchColor() {
|
|
8616
|
+
return matchHexColor() || matchRGBAColor() || matchRGBColor() || matchLiteralColor();
|
|
8617
|
+
}
|
|
8618
|
+
|
|
8619
|
+
function matchLiteralColor() {
|
|
8620
|
+
return match('literal', tokens.literalColor, 0);
|
|
8621
|
+
}
|
|
8622
|
+
|
|
8623
|
+
function matchHexColor() {
|
|
8624
|
+
return match('hex', tokens.hexColor, 1);
|
|
8625
|
+
}
|
|
8626
|
+
|
|
8627
|
+
function matchRGBColor() {
|
|
8628
|
+
return matchCall(tokens.rgbColor, function () {
|
|
8629
|
+
return {
|
|
8630
|
+
type: 'rgb',
|
|
8631
|
+
value: matchListing(matchNumber)
|
|
8632
|
+
};
|
|
8633
|
+
});
|
|
8634
|
+
}
|
|
8635
|
+
|
|
8636
|
+
function matchRGBAColor() {
|
|
8637
|
+
return matchCall(tokens.rgbaColor, function () {
|
|
8638
|
+
return {
|
|
8639
|
+
type: 'rgba',
|
|
8640
|
+
value: matchListing(matchNumber)
|
|
8641
|
+
};
|
|
8642
|
+
});
|
|
8643
|
+
}
|
|
8644
|
+
|
|
8645
|
+
function matchNumber() {
|
|
8646
|
+
return scan(tokens.number)[1];
|
|
8647
|
+
}
|
|
8648
|
+
|
|
8649
|
+
function matchDistance() {
|
|
8650
|
+
return match('%', tokens.percentageValue, 1) || matchPositionKeyword() || matchLength();
|
|
8651
|
+
}
|
|
8652
|
+
|
|
8653
|
+
function matchPositionKeyword() {
|
|
8654
|
+
return match('position-keyword', tokens.positionKeywords, 1);
|
|
8655
|
+
}
|
|
8656
|
+
|
|
8657
|
+
function matchLength() {
|
|
8658
|
+
return match('px', tokens.pixelValue, 1) || match('em', tokens.emValue, 1);
|
|
8659
|
+
}
|
|
8660
|
+
|
|
8661
|
+
function match(type, pattern, captureIndex) {
|
|
8662
|
+
var captures = scan(pattern);
|
|
8663
|
+
|
|
8664
|
+
if (captures) {
|
|
8665
|
+
return {
|
|
8666
|
+
type: type,
|
|
8667
|
+
value: captures[captureIndex]
|
|
8668
|
+
};
|
|
8669
|
+
}
|
|
8670
|
+
}
|
|
8671
|
+
|
|
8672
|
+
function scan(regexp) {
|
|
8673
|
+
var blankCaptures = /^[\n\r\t\s]+/.exec(input);
|
|
8674
|
+
|
|
8675
|
+
if (blankCaptures) {
|
|
8676
|
+
consume(blankCaptures[0].length);
|
|
8677
|
+
}
|
|
8678
|
+
|
|
8679
|
+
var captures = regexp.exec(input);
|
|
8680
|
+
|
|
8681
|
+
if (captures) {
|
|
8682
|
+
consume(captures[0].length);
|
|
8683
|
+
}
|
|
8684
|
+
|
|
8685
|
+
return captures;
|
|
8686
|
+
}
|
|
8687
|
+
|
|
8688
|
+
function consume(size) {
|
|
8689
|
+
input = input.substring(size);
|
|
8690
|
+
}
|
|
8691
|
+
|
|
8692
|
+
return function (code) {
|
|
8693
|
+
input = code;
|
|
8694
|
+
return getAST();
|
|
8695
|
+
};
|
|
8696
|
+
}();
|
|
8697
|
+
function computeLinearGradient(width, height, angle) {
|
|
8698
|
+
var rad = angle * Math.PI / 180;
|
|
8699
|
+
var rx = 0;
|
|
8700
|
+
var ry = 0;
|
|
8701
|
+
var rcx = rx + width / 2;
|
|
8702
|
+
var rcy = ry + height / 2; // get the length of gradient line
|
|
8703
|
+
// @see https://observablehq.com/@danburzo/css-gradient-line
|
|
8704
|
+
|
|
8705
|
+
var length = Math.abs(width * Math.cos(rad)) + Math.abs(height * Math.sin(rad));
|
|
8706
|
+
var x1 = rcx - Math.cos(rad) * length / 2;
|
|
8707
|
+
var y1 = rcy - Math.sin(rad) * length / 2;
|
|
8708
|
+
var x2 = rcx + Math.cos(rad) * length / 2;
|
|
8709
|
+
var y2 = rcy + Math.sin(rad) * length / 2;
|
|
8710
|
+
return {
|
|
8711
|
+
x1: x1,
|
|
8712
|
+
y1: y1,
|
|
8713
|
+
x2: x2,
|
|
8714
|
+
y2: y2
|
|
8715
|
+
};
|
|
8716
|
+
}
|
|
8717
|
+
function computeRadialGradient(width, height, cx, cy) {
|
|
8718
|
+
var r = Math.sqrt(width * width + height * height) / 2;
|
|
8719
|
+
return {
|
|
8720
|
+
x: cx * width,
|
|
8721
|
+
y: cy * height,
|
|
8722
|
+
r: r
|
|
8723
|
+
};
|
|
8724
|
+
}
|
|
8725
|
+
|
|
8353
8726
|
(function (PropertySyntax) {
|
|
8354
8727
|
/**
|
|
8355
8728
|
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#coordinate
|
|
@@ -9725,7 +10098,11 @@
|
|
|
9725
10098
|
trr = radius[1],
|
|
9726
10099
|
brr = radius[2],
|
|
9727
10100
|
blr = radius[3];
|
|
9728
|
-
|
|
10101
|
+
var signX = width > 0 ? 1 : -1;
|
|
10102
|
+
var signY = height > 0 ? 1 : -1; // sweep-flag @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths#arcs
|
|
10103
|
+
|
|
10104
|
+
var sweepFlag = signX + signY !== 0 ? 1 : 0;
|
|
10105
|
+
return [['M', signX * tlr + x, y], ['L', width - signX * trr + x, y], trr ? ['A', trr, trr, 0, 0, sweepFlag, width + x, signY * trr + y] : null, ['L', width + x, height - signY * brr + y], brr ? ['A', brr, brr, 0, 0, sweepFlag, width + x - signX * brr, height + y] : null, ['L', x + signX * blr, height + y], blr ? ['A', blr, blr, 0, 0, sweepFlag, x, height + y - signY * blr] : null, ['L', x, signY * tlr + y], tlr ? ['A', tlr, tlr, 0, 0, sweepFlag, signX * tlr + x, y] : null, ['Z']].filter(function (command) {
|
|
9729
10106
|
return command;
|
|
9730
10107
|
});
|
|
9731
10108
|
}
|
|
@@ -9795,7 +10172,7 @@
|
|
|
9795
10172
|
return r.value !== 0;
|
|
9796
10173
|
});
|
|
9797
10174
|
commands = rectToCommands(width.value, height.value, x.value, y.value, hasRadius && radius.map(function (r) {
|
|
9798
|
-
return clamp(r.value, 0, Math.min(width.value / 2, height.value / 2));
|
|
10175
|
+
return clamp(r.value, 0, Math.min(Math.abs(width.value) / 2, Math.abs(height.value) / 2));
|
|
9799
10176
|
}));
|
|
9800
10177
|
break;
|
|
9801
10178
|
|
|
@@ -14199,12 +14576,11 @@
|
|
|
14199
14576
|
return CSSRGB;
|
|
14200
14577
|
}(CSSColorValue);
|
|
14201
14578
|
|
|
14202
|
-
(function (
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
})(exports.GradientPatternType || (exports.GradientPatternType = {}));
|
|
14579
|
+
(function (GradientType) {
|
|
14580
|
+
GradientType[GradientType["Constant"] = 0] = "Constant";
|
|
14581
|
+
GradientType[GradientType["LinearGradient"] = 1] = "LinearGradient";
|
|
14582
|
+
GradientType[GradientType["RadialGradient"] = 2] = "RadialGradient";
|
|
14583
|
+
})(exports.GradientType || (exports.GradientType = {}));
|
|
14208
14584
|
|
|
14209
14585
|
var CSSGradientValue = /*#__PURE__*/function (_CSSStyleValue) {
|
|
14210
14586
|
_inheritsLoose(CSSGradientValue, _CSSStyleValue);
|
|
@@ -14227,21 +14603,7 @@
|
|
|
14227
14603
|
};
|
|
14228
14604
|
|
|
14229
14605
|
_proto.buildCSSText = function buildCSSText(n, p, result) {
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
if (this.type === exports.GradientPatternType.LinearGradient) {
|
|
14233
|
-
text = "linear-gradient(" + this.value.steps.map(function (step) {
|
|
14234
|
-
return step.join(',');
|
|
14235
|
-
}).join(',') + ")";
|
|
14236
|
-
} else if (this.type === exports.GradientPatternType.RadialGradient) {
|
|
14237
|
-
text = "radial-gradient(" + this.value.steps.map(function (step) {
|
|
14238
|
-
return step.join(',');
|
|
14239
|
-
}).join(',') + ")";
|
|
14240
|
-
} else if (this.type === exports.GradientPatternType.Pattern) {
|
|
14241
|
-
text = "url(" + this.value.src + ")";
|
|
14242
|
-
}
|
|
14243
|
-
|
|
14244
|
-
return result += text;
|
|
14606
|
+
return result;
|
|
14245
14607
|
};
|
|
14246
14608
|
|
|
14247
14609
|
_proto.getType = function getType() {
|
|
@@ -14576,91 +14938,929 @@
|
|
|
14576
14938
|
return new Hsl(h, s, l, o.opacity);
|
|
14577
14939
|
}
|
|
14578
14940
|
|
|
14579
|
-
function hsl(h, s, l, opacity) {
|
|
14580
|
-
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
14941
|
+
function hsl(h, s, l, opacity) {
|
|
14942
|
+
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
14943
|
+
}
|
|
14944
|
+
|
|
14945
|
+
function Hsl(h, s, l, opacity) {
|
|
14946
|
+
this.h = +h;
|
|
14947
|
+
this.s = +s;
|
|
14948
|
+
this.l = +l;
|
|
14949
|
+
this.opacity = +opacity;
|
|
14950
|
+
}
|
|
14951
|
+
|
|
14952
|
+
define(Hsl, hsl, extend$1(Color, {
|
|
14953
|
+
brighter: function(k) {
|
|
14954
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
14955
|
+
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
14956
|
+
},
|
|
14957
|
+
darker: function(k) {
|
|
14958
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
14959
|
+
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
14960
|
+
},
|
|
14961
|
+
rgb: function() {
|
|
14962
|
+
var h = this.h % 360 + (this.h < 0) * 360,
|
|
14963
|
+
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
|
14964
|
+
l = this.l,
|
|
14965
|
+
m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
|
14966
|
+
m1 = 2 * l - m2;
|
|
14967
|
+
return new Rgb(
|
|
14968
|
+
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
14969
|
+
hsl2rgb(h, m1, m2),
|
|
14970
|
+
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
14971
|
+
this.opacity
|
|
14972
|
+
);
|
|
14973
|
+
},
|
|
14974
|
+
displayable: function() {
|
|
14975
|
+
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
|
14976
|
+
&& (0 <= this.l && this.l <= 1)
|
|
14977
|
+
&& (0 <= this.opacity && this.opacity <= 1);
|
|
14978
|
+
},
|
|
14979
|
+
formatHsl: function() {
|
|
14980
|
+
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
|
14981
|
+
return (a === 1 ? "hsl(" : "hsla(")
|
|
14982
|
+
+ (this.h || 0) + ", "
|
|
14983
|
+
+ (this.s || 0) * 100 + "%, "
|
|
14984
|
+
+ (this.l || 0) * 100 + "%"
|
|
14985
|
+
+ (a === 1 ? ")" : ", " + a + ")");
|
|
14986
|
+
}
|
|
14987
|
+
}));
|
|
14988
|
+
|
|
14989
|
+
/* From FvD 13.37, CSS Color Module Level 3 */
|
|
14990
|
+
function hsl2rgb(h, m1, m2) {
|
|
14991
|
+
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
|
14992
|
+
: h < 180 ? m2
|
|
14993
|
+
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
|
14994
|
+
: m1) * 255;
|
|
14995
|
+
}
|
|
14996
|
+
|
|
14997
|
+
/**
|
|
14998
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
14999
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
15000
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
15001
|
+
* Released under MIT license <https://lodash.com/license>
|
|
15002
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
15003
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
15004
|
+
*/
|
|
15005
|
+
|
|
15006
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
|
15007
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
15008
|
+
|
|
15009
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
15010
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
15011
|
+
|
|
15012
|
+
/** `Object#toString` result references. */
|
|
15013
|
+
var funcTag = '[object Function]',
|
|
15014
|
+
genTag = '[object GeneratorFunction]';
|
|
15015
|
+
|
|
15016
|
+
/**
|
|
15017
|
+
* Used to match `RegExp`
|
|
15018
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
15019
|
+
*/
|
|
15020
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
15021
|
+
|
|
15022
|
+
/** Used to detect host constructors (Safari). */
|
|
15023
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
15024
|
+
|
|
15025
|
+
/** Detect free variable `global` from Node.js. */
|
|
15026
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
15027
|
+
|
|
15028
|
+
/** Detect free variable `self`. */
|
|
15029
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
15030
|
+
|
|
15031
|
+
/** Used as a reference to the global object. */
|
|
15032
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
15033
|
+
|
|
15034
|
+
/**
|
|
15035
|
+
* Gets the value at `key` of `object`.
|
|
15036
|
+
*
|
|
15037
|
+
* @private
|
|
15038
|
+
* @param {Object} [object] The object to query.
|
|
15039
|
+
* @param {string} key The key of the property to get.
|
|
15040
|
+
* @returns {*} Returns the property value.
|
|
15041
|
+
*/
|
|
15042
|
+
function getValue(object, key) {
|
|
15043
|
+
return object == null ? undefined : object[key];
|
|
15044
|
+
}
|
|
15045
|
+
|
|
15046
|
+
/**
|
|
15047
|
+
* Checks if `value` is a host object in IE < 9.
|
|
15048
|
+
*
|
|
15049
|
+
* @private
|
|
15050
|
+
* @param {*} value The value to check.
|
|
15051
|
+
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
15052
|
+
*/
|
|
15053
|
+
function isHostObject(value) {
|
|
15054
|
+
// Many host objects are `Object` objects that can coerce to strings
|
|
15055
|
+
// despite having improperly defined `toString` methods.
|
|
15056
|
+
var result = false;
|
|
15057
|
+
if (value != null && typeof value.toString != 'function') {
|
|
15058
|
+
try {
|
|
15059
|
+
result = !!(value + '');
|
|
15060
|
+
} catch (e) {}
|
|
15061
|
+
}
|
|
15062
|
+
return result;
|
|
15063
|
+
}
|
|
15064
|
+
|
|
15065
|
+
/** Used for built-in method references. */
|
|
15066
|
+
var arrayProto = Array.prototype,
|
|
15067
|
+
funcProto = Function.prototype,
|
|
15068
|
+
objectProto = Object.prototype;
|
|
15069
|
+
|
|
15070
|
+
/** Used to detect overreaching core-js shims. */
|
|
15071
|
+
var coreJsData = root['__core-js_shared__'];
|
|
15072
|
+
|
|
15073
|
+
/** Used to detect methods masquerading as native. */
|
|
15074
|
+
var maskSrcKey = (function() {
|
|
15075
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
15076
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
15077
|
+
}());
|
|
15078
|
+
|
|
15079
|
+
/** Used to resolve the decompiled source of functions. */
|
|
15080
|
+
var funcToString = funcProto.toString;
|
|
15081
|
+
|
|
15082
|
+
/** Used to check objects for own properties. */
|
|
15083
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
15084
|
+
|
|
15085
|
+
/**
|
|
15086
|
+
* Used to resolve the
|
|
15087
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
15088
|
+
* of values.
|
|
15089
|
+
*/
|
|
15090
|
+
var objectToString = objectProto.toString;
|
|
15091
|
+
|
|
15092
|
+
/** Used to detect if a method is native. */
|
|
15093
|
+
var reIsNative = RegExp('^' +
|
|
15094
|
+
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
|
15095
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
15096
|
+
);
|
|
15097
|
+
|
|
15098
|
+
/** Built-in value references. */
|
|
15099
|
+
var splice = arrayProto.splice;
|
|
15100
|
+
|
|
15101
|
+
/* Built-in method references that are verified to be native. */
|
|
15102
|
+
var Map$1 = getNative(root, 'Map'),
|
|
15103
|
+
nativeCreate = getNative(Object, 'create');
|
|
15104
|
+
|
|
15105
|
+
/**
|
|
15106
|
+
* Creates a hash object.
|
|
15107
|
+
*
|
|
15108
|
+
* @private
|
|
15109
|
+
* @constructor
|
|
15110
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
15111
|
+
*/
|
|
15112
|
+
function Hash(entries) {
|
|
15113
|
+
var index = -1,
|
|
15114
|
+
length = entries ? entries.length : 0;
|
|
15115
|
+
|
|
15116
|
+
this.clear();
|
|
15117
|
+
while (++index < length) {
|
|
15118
|
+
var entry = entries[index];
|
|
15119
|
+
this.set(entry[0], entry[1]);
|
|
15120
|
+
}
|
|
15121
|
+
}
|
|
15122
|
+
|
|
15123
|
+
/**
|
|
15124
|
+
* Removes all key-value entries from the hash.
|
|
15125
|
+
*
|
|
15126
|
+
* @private
|
|
15127
|
+
* @name clear
|
|
15128
|
+
* @memberOf Hash
|
|
15129
|
+
*/
|
|
15130
|
+
function hashClear() {
|
|
15131
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
15132
|
+
}
|
|
15133
|
+
|
|
15134
|
+
/**
|
|
15135
|
+
* Removes `key` and its value from the hash.
|
|
15136
|
+
*
|
|
15137
|
+
* @private
|
|
15138
|
+
* @name delete
|
|
15139
|
+
* @memberOf Hash
|
|
15140
|
+
* @param {Object} hash The hash to modify.
|
|
15141
|
+
* @param {string} key The key of the value to remove.
|
|
15142
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
15143
|
+
*/
|
|
15144
|
+
function hashDelete(key) {
|
|
15145
|
+
return this.has(key) && delete this.__data__[key];
|
|
15146
|
+
}
|
|
15147
|
+
|
|
15148
|
+
/**
|
|
15149
|
+
* Gets the hash value for `key`.
|
|
15150
|
+
*
|
|
15151
|
+
* @private
|
|
15152
|
+
* @name get
|
|
15153
|
+
* @memberOf Hash
|
|
15154
|
+
* @param {string} key The key of the value to get.
|
|
15155
|
+
* @returns {*} Returns the entry value.
|
|
15156
|
+
*/
|
|
15157
|
+
function hashGet(key) {
|
|
15158
|
+
var data = this.__data__;
|
|
15159
|
+
if (nativeCreate) {
|
|
15160
|
+
var result = data[key];
|
|
15161
|
+
return result === HASH_UNDEFINED ? undefined : result;
|
|
15162
|
+
}
|
|
15163
|
+
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
15164
|
+
}
|
|
15165
|
+
|
|
15166
|
+
/**
|
|
15167
|
+
* Checks if a hash value for `key` exists.
|
|
15168
|
+
*
|
|
15169
|
+
* @private
|
|
15170
|
+
* @name has
|
|
15171
|
+
* @memberOf Hash
|
|
15172
|
+
* @param {string} key The key of the entry to check.
|
|
15173
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
15174
|
+
*/
|
|
15175
|
+
function hashHas(key) {
|
|
15176
|
+
var data = this.__data__;
|
|
15177
|
+
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
|
15178
|
+
}
|
|
15179
|
+
|
|
15180
|
+
/**
|
|
15181
|
+
* Sets the hash `key` to `value`.
|
|
15182
|
+
*
|
|
15183
|
+
* @private
|
|
15184
|
+
* @name set
|
|
15185
|
+
* @memberOf Hash
|
|
15186
|
+
* @param {string} key The key of the value to set.
|
|
15187
|
+
* @param {*} value The value to set.
|
|
15188
|
+
* @returns {Object} Returns the hash instance.
|
|
15189
|
+
*/
|
|
15190
|
+
function hashSet(key, value) {
|
|
15191
|
+
var data = this.__data__;
|
|
15192
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
15193
|
+
return this;
|
|
15194
|
+
}
|
|
15195
|
+
|
|
15196
|
+
// Add methods to `Hash`.
|
|
15197
|
+
Hash.prototype.clear = hashClear;
|
|
15198
|
+
Hash.prototype['delete'] = hashDelete;
|
|
15199
|
+
Hash.prototype.get = hashGet;
|
|
15200
|
+
Hash.prototype.has = hashHas;
|
|
15201
|
+
Hash.prototype.set = hashSet;
|
|
15202
|
+
|
|
15203
|
+
/**
|
|
15204
|
+
* Creates an list cache object.
|
|
15205
|
+
*
|
|
15206
|
+
* @private
|
|
15207
|
+
* @constructor
|
|
15208
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
15209
|
+
*/
|
|
15210
|
+
function ListCache(entries) {
|
|
15211
|
+
var index = -1,
|
|
15212
|
+
length = entries ? entries.length : 0;
|
|
15213
|
+
|
|
15214
|
+
this.clear();
|
|
15215
|
+
while (++index < length) {
|
|
15216
|
+
var entry = entries[index];
|
|
15217
|
+
this.set(entry[0], entry[1]);
|
|
15218
|
+
}
|
|
15219
|
+
}
|
|
15220
|
+
|
|
15221
|
+
/**
|
|
15222
|
+
* Removes all key-value entries from the list cache.
|
|
15223
|
+
*
|
|
15224
|
+
* @private
|
|
15225
|
+
* @name clear
|
|
15226
|
+
* @memberOf ListCache
|
|
15227
|
+
*/
|
|
15228
|
+
function listCacheClear() {
|
|
15229
|
+
this.__data__ = [];
|
|
15230
|
+
}
|
|
15231
|
+
|
|
15232
|
+
/**
|
|
15233
|
+
* Removes `key` and its value from the list cache.
|
|
15234
|
+
*
|
|
15235
|
+
* @private
|
|
15236
|
+
* @name delete
|
|
15237
|
+
* @memberOf ListCache
|
|
15238
|
+
* @param {string} key The key of the value to remove.
|
|
15239
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
15240
|
+
*/
|
|
15241
|
+
function listCacheDelete(key) {
|
|
15242
|
+
var data = this.__data__,
|
|
15243
|
+
index = assocIndexOf(data, key);
|
|
15244
|
+
|
|
15245
|
+
if (index < 0) {
|
|
15246
|
+
return false;
|
|
15247
|
+
}
|
|
15248
|
+
var lastIndex = data.length - 1;
|
|
15249
|
+
if (index == lastIndex) {
|
|
15250
|
+
data.pop();
|
|
15251
|
+
} else {
|
|
15252
|
+
splice.call(data, index, 1);
|
|
15253
|
+
}
|
|
15254
|
+
return true;
|
|
15255
|
+
}
|
|
15256
|
+
|
|
15257
|
+
/**
|
|
15258
|
+
* Gets the list cache value for `key`.
|
|
15259
|
+
*
|
|
15260
|
+
* @private
|
|
15261
|
+
* @name get
|
|
15262
|
+
* @memberOf ListCache
|
|
15263
|
+
* @param {string} key The key of the value to get.
|
|
15264
|
+
* @returns {*} Returns the entry value.
|
|
15265
|
+
*/
|
|
15266
|
+
function listCacheGet(key) {
|
|
15267
|
+
var data = this.__data__,
|
|
15268
|
+
index = assocIndexOf(data, key);
|
|
15269
|
+
|
|
15270
|
+
return index < 0 ? undefined : data[index][1];
|
|
15271
|
+
}
|
|
15272
|
+
|
|
15273
|
+
/**
|
|
15274
|
+
* Checks if a list cache value for `key` exists.
|
|
15275
|
+
*
|
|
15276
|
+
* @private
|
|
15277
|
+
* @name has
|
|
15278
|
+
* @memberOf ListCache
|
|
15279
|
+
* @param {string} key The key of the entry to check.
|
|
15280
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
15281
|
+
*/
|
|
15282
|
+
function listCacheHas(key) {
|
|
15283
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
15284
|
+
}
|
|
15285
|
+
|
|
15286
|
+
/**
|
|
15287
|
+
* Sets the list cache `key` to `value`.
|
|
15288
|
+
*
|
|
15289
|
+
* @private
|
|
15290
|
+
* @name set
|
|
15291
|
+
* @memberOf ListCache
|
|
15292
|
+
* @param {string} key The key of the value to set.
|
|
15293
|
+
* @param {*} value The value to set.
|
|
15294
|
+
* @returns {Object} Returns the list cache instance.
|
|
15295
|
+
*/
|
|
15296
|
+
function listCacheSet(key, value) {
|
|
15297
|
+
var data = this.__data__,
|
|
15298
|
+
index = assocIndexOf(data, key);
|
|
15299
|
+
|
|
15300
|
+
if (index < 0) {
|
|
15301
|
+
data.push([key, value]);
|
|
15302
|
+
} else {
|
|
15303
|
+
data[index][1] = value;
|
|
15304
|
+
}
|
|
15305
|
+
return this;
|
|
15306
|
+
}
|
|
15307
|
+
|
|
15308
|
+
// Add methods to `ListCache`.
|
|
15309
|
+
ListCache.prototype.clear = listCacheClear;
|
|
15310
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
15311
|
+
ListCache.prototype.get = listCacheGet;
|
|
15312
|
+
ListCache.prototype.has = listCacheHas;
|
|
15313
|
+
ListCache.prototype.set = listCacheSet;
|
|
15314
|
+
|
|
15315
|
+
/**
|
|
15316
|
+
* Creates a map cache object to store key-value pairs.
|
|
15317
|
+
*
|
|
15318
|
+
* @private
|
|
15319
|
+
* @constructor
|
|
15320
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
15321
|
+
*/
|
|
15322
|
+
function MapCache(entries) {
|
|
15323
|
+
var index = -1,
|
|
15324
|
+
length = entries ? entries.length : 0;
|
|
15325
|
+
|
|
15326
|
+
this.clear();
|
|
15327
|
+
while (++index < length) {
|
|
15328
|
+
var entry = entries[index];
|
|
15329
|
+
this.set(entry[0], entry[1]);
|
|
15330
|
+
}
|
|
15331
|
+
}
|
|
15332
|
+
|
|
15333
|
+
/**
|
|
15334
|
+
* Removes all key-value entries from the map.
|
|
15335
|
+
*
|
|
15336
|
+
* @private
|
|
15337
|
+
* @name clear
|
|
15338
|
+
* @memberOf MapCache
|
|
15339
|
+
*/
|
|
15340
|
+
function mapCacheClear() {
|
|
15341
|
+
this.__data__ = {
|
|
15342
|
+
'hash': new Hash,
|
|
15343
|
+
'map': new (Map$1 || ListCache),
|
|
15344
|
+
'string': new Hash
|
|
15345
|
+
};
|
|
15346
|
+
}
|
|
15347
|
+
|
|
15348
|
+
/**
|
|
15349
|
+
* Removes `key` and its value from the map.
|
|
15350
|
+
*
|
|
15351
|
+
* @private
|
|
15352
|
+
* @name delete
|
|
15353
|
+
* @memberOf MapCache
|
|
15354
|
+
* @param {string} key The key of the value to remove.
|
|
15355
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
15356
|
+
*/
|
|
15357
|
+
function mapCacheDelete(key) {
|
|
15358
|
+
return getMapData(this, key)['delete'](key);
|
|
15359
|
+
}
|
|
15360
|
+
|
|
15361
|
+
/**
|
|
15362
|
+
* Gets the map value for `key`.
|
|
15363
|
+
*
|
|
15364
|
+
* @private
|
|
15365
|
+
* @name get
|
|
15366
|
+
* @memberOf MapCache
|
|
15367
|
+
* @param {string} key The key of the value to get.
|
|
15368
|
+
* @returns {*} Returns the entry value.
|
|
15369
|
+
*/
|
|
15370
|
+
function mapCacheGet(key) {
|
|
15371
|
+
return getMapData(this, key).get(key);
|
|
15372
|
+
}
|
|
15373
|
+
|
|
15374
|
+
/**
|
|
15375
|
+
* Checks if a map value for `key` exists.
|
|
15376
|
+
*
|
|
15377
|
+
* @private
|
|
15378
|
+
* @name has
|
|
15379
|
+
* @memberOf MapCache
|
|
15380
|
+
* @param {string} key The key of the entry to check.
|
|
15381
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
15382
|
+
*/
|
|
15383
|
+
function mapCacheHas(key) {
|
|
15384
|
+
return getMapData(this, key).has(key);
|
|
15385
|
+
}
|
|
15386
|
+
|
|
15387
|
+
/**
|
|
15388
|
+
* Sets the map `key` to `value`.
|
|
15389
|
+
*
|
|
15390
|
+
* @private
|
|
15391
|
+
* @name set
|
|
15392
|
+
* @memberOf MapCache
|
|
15393
|
+
* @param {string} key The key of the value to set.
|
|
15394
|
+
* @param {*} value The value to set.
|
|
15395
|
+
* @returns {Object} Returns the map cache instance.
|
|
15396
|
+
*/
|
|
15397
|
+
function mapCacheSet(key, value) {
|
|
15398
|
+
getMapData(this, key).set(key, value);
|
|
15399
|
+
return this;
|
|
15400
|
+
}
|
|
15401
|
+
|
|
15402
|
+
// Add methods to `MapCache`.
|
|
15403
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
15404
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
15405
|
+
MapCache.prototype.get = mapCacheGet;
|
|
15406
|
+
MapCache.prototype.has = mapCacheHas;
|
|
15407
|
+
MapCache.prototype.set = mapCacheSet;
|
|
15408
|
+
|
|
15409
|
+
/**
|
|
15410
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
15411
|
+
*
|
|
15412
|
+
* @private
|
|
15413
|
+
* @param {Array} array The array to inspect.
|
|
15414
|
+
* @param {*} key The key to search for.
|
|
15415
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
15416
|
+
*/
|
|
15417
|
+
function assocIndexOf(array, key) {
|
|
15418
|
+
var length = array.length;
|
|
15419
|
+
while (length--) {
|
|
15420
|
+
if (eq(array[length][0], key)) {
|
|
15421
|
+
return length;
|
|
15422
|
+
}
|
|
15423
|
+
}
|
|
15424
|
+
return -1;
|
|
15425
|
+
}
|
|
15426
|
+
|
|
15427
|
+
/**
|
|
15428
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
15429
|
+
*
|
|
15430
|
+
* @private
|
|
15431
|
+
* @param {*} value The value to check.
|
|
15432
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
15433
|
+
* else `false`.
|
|
15434
|
+
*/
|
|
15435
|
+
function baseIsNative(value) {
|
|
15436
|
+
if (!isObject$1(value) || isMasked(value)) {
|
|
15437
|
+
return false;
|
|
15438
|
+
}
|
|
15439
|
+
var pattern = (isFunction$1(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
|
15440
|
+
return pattern.test(toSource(value));
|
|
15441
|
+
}
|
|
15442
|
+
|
|
15443
|
+
/**
|
|
15444
|
+
* Gets the data for `map`.
|
|
15445
|
+
*
|
|
15446
|
+
* @private
|
|
15447
|
+
* @param {Object} map The map to query.
|
|
15448
|
+
* @param {string} key The reference key.
|
|
15449
|
+
* @returns {*} Returns the map data.
|
|
15450
|
+
*/
|
|
15451
|
+
function getMapData(map, key) {
|
|
15452
|
+
var data = map.__data__;
|
|
15453
|
+
return isKeyable(key)
|
|
15454
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
15455
|
+
: data.map;
|
|
15456
|
+
}
|
|
15457
|
+
|
|
15458
|
+
/**
|
|
15459
|
+
* Gets the native function at `key` of `object`.
|
|
15460
|
+
*
|
|
15461
|
+
* @private
|
|
15462
|
+
* @param {Object} object The object to query.
|
|
15463
|
+
* @param {string} key The key of the method to get.
|
|
15464
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
15465
|
+
*/
|
|
15466
|
+
function getNative(object, key) {
|
|
15467
|
+
var value = getValue(object, key);
|
|
15468
|
+
return baseIsNative(value) ? value : undefined;
|
|
15469
|
+
}
|
|
15470
|
+
|
|
15471
|
+
/**
|
|
15472
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
15473
|
+
*
|
|
15474
|
+
* @private
|
|
15475
|
+
* @param {*} value The value to check.
|
|
15476
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
15477
|
+
*/
|
|
15478
|
+
function isKeyable(value) {
|
|
15479
|
+
var type = typeof value;
|
|
15480
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
15481
|
+
? (value !== '__proto__')
|
|
15482
|
+
: (value === null);
|
|
15483
|
+
}
|
|
15484
|
+
|
|
15485
|
+
/**
|
|
15486
|
+
* Checks if `func` has its source masked.
|
|
15487
|
+
*
|
|
15488
|
+
* @private
|
|
15489
|
+
* @param {Function} func The function to check.
|
|
15490
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
15491
|
+
*/
|
|
15492
|
+
function isMasked(func) {
|
|
15493
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
15494
|
+
}
|
|
15495
|
+
|
|
15496
|
+
/**
|
|
15497
|
+
* Converts `func` to its source code.
|
|
15498
|
+
*
|
|
15499
|
+
* @private
|
|
15500
|
+
* @param {Function} func The function to process.
|
|
15501
|
+
* @returns {string} Returns the source code.
|
|
15502
|
+
*/
|
|
15503
|
+
function toSource(func) {
|
|
15504
|
+
if (func != null) {
|
|
15505
|
+
try {
|
|
15506
|
+
return funcToString.call(func);
|
|
15507
|
+
} catch (e) {}
|
|
15508
|
+
try {
|
|
15509
|
+
return (func + '');
|
|
15510
|
+
} catch (e) {}
|
|
15511
|
+
}
|
|
15512
|
+
return '';
|
|
15513
|
+
}
|
|
15514
|
+
|
|
15515
|
+
/**
|
|
15516
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
15517
|
+
* provided, it determines the cache key for storing the result based on the
|
|
15518
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
15519
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
15520
|
+
* is invoked with the `this` binding of the memoized function.
|
|
15521
|
+
*
|
|
15522
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
15523
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
15524
|
+
* constructor with one whose instances implement the
|
|
15525
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
15526
|
+
* method interface of `delete`, `get`, `has`, and `set`.
|
|
15527
|
+
*
|
|
15528
|
+
* @static
|
|
15529
|
+
* @memberOf _
|
|
15530
|
+
* @since 0.1.0
|
|
15531
|
+
* @category Function
|
|
15532
|
+
* @param {Function} func The function to have its output memoized.
|
|
15533
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
15534
|
+
* @returns {Function} Returns the new memoized function.
|
|
15535
|
+
* @example
|
|
15536
|
+
*
|
|
15537
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
15538
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
15539
|
+
*
|
|
15540
|
+
* var values = _.memoize(_.values);
|
|
15541
|
+
* values(object);
|
|
15542
|
+
* // => [1, 2]
|
|
15543
|
+
*
|
|
15544
|
+
* values(other);
|
|
15545
|
+
* // => [3, 4]
|
|
15546
|
+
*
|
|
15547
|
+
* object.a = 2;
|
|
15548
|
+
* values(object);
|
|
15549
|
+
* // => [1, 2]
|
|
15550
|
+
*
|
|
15551
|
+
* // Modify the result cache.
|
|
15552
|
+
* values.cache.set(object, ['a', 'b']);
|
|
15553
|
+
* values(object);
|
|
15554
|
+
* // => ['a', 'b']
|
|
15555
|
+
*
|
|
15556
|
+
* // Replace `_.memoize.Cache`.
|
|
15557
|
+
* _.memoize.Cache = WeakMap;
|
|
15558
|
+
*/
|
|
15559
|
+
function memoize(func, resolver) {
|
|
15560
|
+
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
|
15561
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
15562
|
+
}
|
|
15563
|
+
var memoized = function() {
|
|
15564
|
+
var args = arguments,
|
|
15565
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
15566
|
+
cache = memoized.cache;
|
|
15567
|
+
|
|
15568
|
+
if (cache.has(key)) {
|
|
15569
|
+
return cache.get(key);
|
|
15570
|
+
}
|
|
15571
|
+
var result = func.apply(this, args);
|
|
15572
|
+
memoized.cache = cache.set(key, result);
|
|
15573
|
+
return result;
|
|
15574
|
+
};
|
|
15575
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
15576
|
+
return memoized;
|
|
15577
|
+
}
|
|
15578
|
+
|
|
15579
|
+
// Assign cache to `_.memoize`.
|
|
15580
|
+
memoize.Cache = MapCache;
|
|
15581
|
+
|
|
15582
|
+
/**
|
|
15583
|
+
* Performs a
|
|
15584
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
15585
|
+
* comparison between two values to determine if they are equivalent.
|
|
15586
|
+
*
|
|
15587
|
+
* @static
|
|
15588
|
+
* @memberOf _
|
|
15589
|
+
* @since 4.0.0
|
|
15590
|
+
* @category Lang
|
|
15591
|
+
* @param {*} value The value to compare.
|
|
15592
|
+
* @param {*} other The other value to compare.
|
|
15593
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
15594
|
+
* @example
|
|
15595
|
+
*
|
|
15596
|
+
* var object = { 'a': 1 };
|
|
15597
|
+
* var other = { 'a': 1 };
|
|
15598
|
+
*
|
|
15599
|
+
* _.eq(object, object);
|
|
15600
|
+
* // => true
|
|
15601
|
+
*
|
|
15602
|
+
* _.eq(object, other);
|
|
15603
|
+
* // => false
|
|
15604
|
+
*
|
|
15605
|
+
* _.eq('a', 'a');
|
|
15606
|
+
* // => true
|
|
15607
|
+
*
|
|
15608
|
+
* _.eq('a', Object('a'));
|
|
15609
|
+
* // => false
|
|
15610
|
+
*
|
|
15611
|
+
* _.eq(NaN, NaN);
|
|
15612
|
+
* // => true
|
|
15613
|
+
*/
|
|
15614
|
+
function eq(value, other) {
|
|
15615
|
+
return value === other || (value !== value && other !== other);
|
|
15616
|
+
}
|
|
15617
|
+
|
|
15618
|
+
/**
|
|
15619
|
+
* Checks if `value` is classified as a `Function` object.
|
|
15620
|
+
*
|
|
15621
|
+
* @static
|
|
15622
|
+
* @memberOf _
|
|
15623
|
+
* @since 0.1.0
|
|
15624
|
+
* @category Lang
|
|
15625
|
+
* @param {*} value The value to check.
|
|
15626
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
15627
|
+
* @example
|
|
15628
|
+
*
|
|
15629
|
+
* _.isFunction(_);
|
|
15630
|
+
* // => true
|
|
15631
|
+
*
|
|
15632
|
+
* _.isFunction(/abc/);
|
|
15633
|
+
* // => false
|
|
15634
|
+
*/
|
|
15635
|
+
function isFunction$1(value) {
|
|
15636
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
15637
|
+
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
|
15638
|
+
var tag = isObject$1(value) ? objectToString.call(value) : '';
|
|
15639
|
+
return tag == funcTag || tag == genTag;
|
|
14581
15640
|
}
|
|
14582
15641
|
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
15642
|
+
/**
|
|
15643
|
+
* Checks if `value` is the
|
|
15644
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
15645
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
15646
|
+
*
|
|
15647
|
+
* @static
|
|
15648
|
+
* @memberOf _
|
|
15649
|
+
* @since 0.1.0
|
|
15650
|
+
* @category Lang
|
|
15651
|
+
* @param {*} value The value to check.
|
|
15652
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
15653
|
+
* @example
|
|
15654
|
+
*
|
|
15655
|
+
* _.isObject({});
|
|
15656
|
+
* // => true
|
|
15657
|
+
*
|
|
15658
|
+
* _.isObject([1, 2, 3]);
|
|
15659
|
+
* // => true
|
|
15660
|
+
*
|
|
15661
|
+
* _.isObject(_.noop);
|
|
15662
|
+
* // => true
|
|
15663
|
+
*
|
|
15664
|
+
* _.isObject(null);
|
|
15665
|
+
* // => false
|
|
15666
|
+
*/
|
|
15667
|
+
function isObject$1(value) {
|
|
15668
|
+
var type = typeof value;
|
|
15669
|
+
return !!value && (type == 'object' || type == 'function');
|
|
14588
15670
|
}
|
|
14589
15671
|
|
|
14590
|
-
|
|
14591
|
-
brighter: function(k) {
|
|
14592
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
14593
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
14594
|
-
},
|
|
14595
|
-
darker: function(k) {
|
|
14596
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
14597
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
14598
|
-
},
|
|
14599
|
-
rgb: function() {
|
|
14600
|
-
var h = this.h % 360 + (this.h < 0) * 360,
|
|
14601
|
-
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
|
14602
|
-
l = this.l,
|
|
14603
|
-
m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
|
14604
|
-
m1 = 2 * l - m2;
|
|
14605
|
-
return new Rgb(
|
|
14606
|
-
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
14607
|
-
hsl2rgb(h, m1, m2),
|
|
14608
|
-
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
14609
|
-
this.opacity
|
|
14610
|
-
);
|
|
14611
|
-
},
|
|
14612
|
-
displayable: function() {
|
|
14613
|
-
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
|
14614
|
-
&& (0 <= this.l && this.l <= 1)
|
|
14615
|
-
&& (0 <= this.opacity && this.opacity <= 1);
|
|
14616
|
-
},
|
|
14617
|
-
formatHsl: function() {
|
|
14618
|
-
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
|
14619
|
-
return (a === 1 ? "hsl(" : "hsla(")
|
|
14620
|
-
+ (this.h || 0) + ", "
|
|
14621
|
-
+ (this.s || 0) * 100 + "%, "
|
|
14622
|
-
+ (this.l || 0) * 100 + "%"
|
|
14623
|
-
+ (a === 1 ? ")" : ", " + a + ")");
|
|
14624
|
-
}
|
|
14625
|
-
}));
|
|
14626
|
-
|
|
14627
|
-
/* From FvD 13.37, CSS Color Module Level 3 */
|
|
14628
|
-
function hsl2rgb(h, m1, m2) {
|
|
14629
|
-
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
|
14630
|
-
: h < 180 ? m2
|
|
14631
|
-
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
|
14632
|
-
: m1) * 255;
|
|
14633
|
-
}
|
|
15672
|
+
var lodash_memoize = memoize;
|
|
14634
15673
|
|
|
14635
15674
|
var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
|
|
14636
15675
|
var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
|
|
14637
15676
|
var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
|
|
14638
15677
|
var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi;
|
|
14639
|
-
/**
|
|
14640
|
-
* @see https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/parser/CSSParser.cpp#L97
|
|
14641
|
-
*/
|
|
14642
15678
|
|
|
14643
|
-
function
|
|
14644
|
-
|
|
14645
|
-
|
|
15679
|
+
function spaceColorStops(colorStops) {
|
|
15680
|
+
var _colorStops$length;
|
|
15681
|
+
|
|
15682
|
+
var length = colorStops.length;
|
|
15683
|
+
colorStops[length - 1].length = (_colorStops$length = colorStops[length - 1].length) !== null && _colorStops$length !== void 0 ? _colorStops$length : {
|
|
15684
|
+
type: '%',
|
|
15685
|
+
value: '100'
|
|
15686
|
+
};
|
|
15687
|
+
|
|
15688
|
+
if (length > 1) {
|
|
15689
|
+
var _colorStops$0$length;
|
|
15690
|
+
|
|
15691
|
+
colorStops[0].length = (_colorStops$0$length = colorStops[0].length) !== null && _colorStops$0$length !== void 0 ? _colorStops$0$length : {
|
|
15692
|
+
type: '%',
|
|
15693
|
+
value: '0'
|
|
15694
|
+
};
|
|
14646
15695
|
}
|
|
14647
15696
|
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
15697
|
+
var previousIndex = 0;
|
|
15698
|
+
var previousOffset = Number(colorStops[0].length.value);
|
|
15699
|
+
|
|
15700
|
+
for (var i = 1; i < length; i++) {
|
|
15701
|
+
var _colorStops$i$length;
|
|
15702
|
+
|
|
15703
|
+
var offset = (_colorStops$i$length = colorStops[i].length) === null || _colorStops$i$length === void 0 ? void 0 : _colorStops$i$length.value;
|
|
15704
|
+
|
|
15705
|
+
if (!isNil(offset) && !isNil(previousOffset)) {
|
|
15706
|
+
for (var j = 1; j < i - previousIndex; j++) {
|
|
15707
|
+
colorStops[previousIndex + j].length = {
|
|
15708
|
+
type: '%',
|
|
15709
|
+
value: "" + (previousOffset + (Number(offset) - previousOffset) * j / (i - previousIndex))
|
|
15710
|
+
};
|
|
15711
|
+
}
|
|
15712
|
+
|
|
15713
|
+
previousIndex = i;
|
|
15714
|
+
previousOffset = Number(offset);
|
|
15715
|
+
}
|
|
15716
|
+
}
|
|
15717
|
+
} // The position of the gradient line's starting point.
|
|
15718
|
+
// different from CSS side(to top) @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#values
|
|
15719
|
+
|
|
15720
|
+
|
|
15721
|
+
var SideOrCornerToDegMap = {
|
|
15722
|
+
left: 270 - 90,
|
|
15723
|
+
top: 0 - 90,
|
|
15724
|
+
bottom: 180 - 90,
|
|
15725
|
+
right: 90 - 90,
|
|
15726
|
+
'left top': 315 - 90,
|
|
15727
|
+
'top left': 315 - 90,
|
|
15728
|
+
'left bottom': 225 - 90,
|
|
15729
|
+
'bottom left': 225 - 90,
|
|
15730
|
+
'right top': 45 - 90,
|
|
15731
|
+
'top right': 45 - 90,
|
|
15732
|
+
'right bottom': 135 - 90,
|
|
15733
|
+
'bottom right': 135 - 90
|
|
15734
|
+
};
|
|
15735
|
+
var angleToDeg = lodash_memoize(function (orientation) {
|
|
15736
|
+
var angle;
|
|
15737
|
+
|
|
15738
|
+
if (orientation.type === 'angular') {
|
|
15739
|
+
angle = Number(orientation.value);
|
|
15740
|
+
} else {
|
|
15741
|
+
angle = SideOrCornerToDegMap[orientation.value] || 0;
|
|
15742
|
+
}
|
|
15743
|
+
|
|
15744
|
+
return angle;
|
|
15745
|
+
});
|
|
15746
|
+
var positonToPercentage = lodash_memoize(function (position) {
|
|
15747
|
+
var cx = 0.5;
|
|
15748
|
+
var cy = 0.5;
|
|
15749
|
+
|
|
15750
|
+
if ((position === null || position === void 0 ? void 0 : position.type) === 'position') {
|
|
15751
|
+
var _position$value = position.value,
|
|
15752
|
+
x = _position$value.x,
|
|
15753
|
+
y = _position$value.y;
|
|
15754
|
+
|
|
15755
|
+
if ((x === null || x === void 0 ? void 0 : x.type) === 'position-keyword') {
|
|
15756
|
+
if (x.value === 'left') {
|
|
15757
|
+
cx = 0;
|
|
15758
|
+
} else if (x.value === 'center') {
|
|
15759
|
+
cx = 0.5;
|
|
15760
|
+
} else if (x.value === 'right') {
|
|
15761
|
+
cx = 1;
|
|
15762
|
+
} else if (x.value === 'top') {
|
|
15763
|
+
cy = 0;
|
|
15764
|
+
} else if (x.value === 'bottom') {
|
|
15765
|
+
cy = 1;
|
|
15766
|
+
}
|
|
15767
|
+
}
|
|
15768
|
+
|
|
15769
|
+
if ((y === null || y === void 0 ? void 0 : y.type) === 'position-keyword') {
|
|
15770
|
+
if (y.value === 'left') {
|
|
15771
|
+
cx = 0;
|
|
15772
|
+
} else if (y.value === 'center') {
|
|
15773
|
+
cy = 0.5;
|
|
15774
|
+
} else if (y.value === 'right') {
|
|
15775
|
+
cx = 1;
|
|
15776
|
+
} else if (y.value === 'top') {
|
|
15777
|
+
cy = 0;
|
|
15778
|
+
} else if (y.value === 'bottom') {
|
|
15779
|
+
cy = 1;
|
|
15780
|
+
}
|
|
15781
|
+
}
|
|
15782
|
+
|
|
15783
|
+
if ((x === null || x === void 0 ? void 0 : x.type) === '%') {
|
|
15784
|
+
cx = Number(x.value) / 100;
|
|
15785
|
+
}
|
|
15786
|
+
|
|
15787
|
+
if ((y === null || y === void 0 ? void 0 : y.type) === '%') {
|
|
15788
|
+
cy = Number(x.value) / 100;
|
|
15789
|
+
}
|
|
14654
15790
|
}
|
|
14655
15791
|
|
|
15792
|
+
return {
|
|
15793
|
+
cx: cx,
|
|
15794
|
+
cy: cy
|
|
15795
|
+
};
|
|
15796
|
+
});
|
|
15797
|
+
var parseGradient$1 = lodash_memoize(function (colorStr) {
|
|
15798
|
+
if (colorStr.indexOf('linear') > -1 || colorStr.indexOf('radial') > -1) {
|
|
15799
|
+
var ast = parseGradient(colorStr);
|
|
15800
|
+
return ast.map(function (_ref) {
|
|
15801
|
+
var type = _ref.type,
|
|
15802
|
+
orientation = _ref.orientation,
|
|
15803
|
+
colorStops = _ref.colorStops;
|
|
15804
|
+
spaceColorStops(colorStops);
|
|
15805
|
+
var steps = colorStops.map(function (colorStop) {
|
|
15806
|
+
// TODO: only support % for now, should calc percentage of axis length when using px/em
|
|
15807
|
+
return [Number(colorStop.length.value) / 100, colorStopToString(colorStop)];
|
|
15808
|
+
});
|
|
15809
|
+
|
|
15810
|
+
if (type === 'linear-gradient') {
|
|
15811
|
+
return new CSSGradientValue(exports.GradientType.LinearGradient, {
|
|
15812
|
+
angle: orientation ? angleToDeg(orientation) : 0,
|
|
15813
|
+
steps: steps,
|
|
15814
|
+
hash: colorStr
|
|
15815
|
+
});
|
|
15816
|
+
} else if (type === 'radial-gradient') {
|
|
15817
|
+
if (!orientation) {
|
|
15818
|
+
orientation = [{
|
|
15819
|
+
type: 'shape',
|
|
15820
|
+
value: 'circle'
|
|
15821
|
+
}];
|
|
15822
|
+
}
|
|
15823
|
+
|
|
15824
|
+
if (orientation[0].type === 'shape' && orientation[0].value === 'circle') {
|
|
15825
|
+
var _positonToPercentage = positonToPercentage(orientation[0].at),
|
|
15826
|
+
cx = _positonToPercentage.cx,
|
|
15827
|
+
cy = _positonToPercentage.cy;
|
|
15828
|
+
|
|
15829
|
+
return new CSSGradientValue(exports.GradientType.RadialGradient, {
|
|
15830
|
+
cx: cx,
|
|
15831
|
+
cy: cy,
|
|
15832
|
+
steps: steps,
|
|
15833
|
+
hash: colorStr
|
|
15834
|
+
});
|
|
15835
|
+
} // } else if (type === 'repeating-linear-gradient') {
|
|
15836
|
+
// } else if (type === 'repeating-radial-gradient') {
|
|
15837
|
+
|
|
15838
|
+
}
|
|
15839
|
+
});
|
|
15840
|
+
} // legacy format, should be deprecated later
|
|
15841
|
+
|
|
15842
|
+
|
|
14656
15843
|
var type = colorStr[0];
|
|
14657
15844
|
|
|
14658
15845
|
if (colorStr[1] === '(' || colorStr[2] === '(') {
|
|
14659
15846
|
if (type === 'l') {
|
|
14660
|
-
var
|
|
14661
|
-
|
|
14662
|
-
if (
|
|
14663
|
-
|
|
15847
|
+
var arr = regexLG.exec(colorStr);
|
|
15848
|
+
|
|
15849
|
+
if (arr) {
|
|
15850
|
+
var _arr$2$match;
|
|
15851
|
+
|
|
15852
|
+
var steps = ((_arr$2$match = arr[2].match(regexColorStop)) === null || _arr$2$match === void 0 ? void 0 : _arr$2$match.map(function (stop) {
|
|
15853
|
+
return stop.split(':');
|
|
15854
|
+
})) || [];
|
|
15855
|
+
return [new CSSGradientValue(exports.GradientType.LinearGradient, {
|
|
15856
|
+
angle: parseFloat(arr[1]),
|
|
15857
|
+
steps: steps.map(function (_ref2) {
|
|
15858
|
+
var offset = _ref2[0],
|
|
15859
|
+
color = _ref2[1];
|
|
15860
|
+
return [Number(offset), color];
|
|
15861
|
+
}),
|
|
15862
|
+
hash: colorStr
|
|
15863
|
+
})];
|
|
14664
15864
|
}
|
|
14665
15865
|
} else if (type === 'r') {
|
|
14666
15866
|
var parsedRadialGradient = parseRadialGradient(colorStr);
|
|
@@ -14669,57 +15869,37 @@
|
|
|
14669
15869
|
if (isString(parsedRadialGradient)) {
|
|
14670
15870
|
colorStr = parsedRadialGradient;
|
|
14671
15871
|
} else {
|
|
14672
|
-
return new CSSGradientValue(exports.
|
|
15872
|
+
return [new CSSGradientValue(exports.GradientType.RadialGradient, parsedRadialGradient)];
|
|
14673
15873
|
}
|
|
14674
15874
|
}
|
|
14675
15875
|
} else if (type === 'p') {
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
if (pattern) {
|
|
14679
|
-
return new CSSGradientValue(exports.GradientPatternType.Pattern, pattern);
|
|
14680
|
-
}
|
|
15876
|
+
return parsePattern(colorStr);
|
|
14681
15877
|
}
|
|
14682
|
-
} // constants
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
var color$1 = color(colorStr);
|
|
14686
|
-
var rgba = [0, 0, 0, 0];
|
|
14687
|
-
|
|
14688
|
-
if (color$1 !== null) {
|
|
14689
|
-
rgba[0] = color$1.r || 0;
|
|
14690
|
-
rgba[1] = color$1.g || 0;
|
|
14691
|
-
rgba[2] = color$1.b || 0;
|
|
14692
|
-
rgba[3] = color$1.opacity;
|
|
14693
15878
|
}
|
|
15879
|
+
});
|
|
14694
15880
|
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
// value: rgba,
|
|
14698
|
-
// formatted:
|
|
14699
|
-
// // rgba(255,255,255,0) -> [NaN, NaN, NaN, 0]
|
|
14700
|
-
// // @see https://github.com/d3/d3-color/issues/52
|
|
14701
|
-
// (color && `rgba(${color.r || 0},${color.g || 0},${color.b || 0},${color.opacity})`) ||
|
|
14702
|
-
// 'rgba(0,0,0,0)',
|
|
14703
|
-
// };
|
|
14704
|
-
}
|
|
14705
|
-
function mergeColors(left, right) {
|
|
14706
|
-
// only support constant value, exclude gradient & pattern
|
|
14707
|
-
if (!(left instanceof CSSRGB) || !(right instanceof CSSRGB)) {
|
|
14708
|
-
return;
|
|
14709
|
-
}
|
|
15881
|
+
function parseRadialGradient(gradientStr) {
|
|
15882
|
+
var arr = regexRG.exec(gradientStr);
|
|
14710
15883
|
|
|
14711
|
-
|
|
14712
|
-
var
|
|
15884
|
+
if (arr) {
|
|
15885
|
+
var _arr$4$match;
|
|
14713
15886
|
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
|
-
|
|
14718
|
-
|
|
15887
|
+
var steps = ((_arr$4$match = arr[4].match(regexColorStop)) === null || _arr$4$match === void 0 ? void 0 : _arr$4$match.map(function (stop) {
|
|
15888
|
+
return stop.split(':');
|
|
15889
|
+
})) || [];
|
|
15890
|
+
return {
|
|
15891
|
+
cx: 0.5,
|
|
15892
|
+
cy: 0.5,
|
|
15893
|
+
steps: steps.map(function (_ref3) {
|
|
15894
|
+
var offset = _ref3[0],
|
|
15895
|
+
color = _ref3[1];
|
|
15896
|
+
return [Number(offset), color];
|
|
15897
|
+
}),
|
|
15898
|
+
hash: gradientStr
|
|
15899
|
+
};
|
|
15900
|
+
}
|
|
14719
15901
|
|
|
14720
|
-
|
|
14721
|
-
return "rgba(" + rgba.join(',') + ")";
|
|
14722
|
-
}];
|
|
15902
|
+
return null;
|
|
14723
15903
|
}
|
|
14724
15904
|
|
|
14725
15905
|
function parsePattern(patternStr) {
|
|
@@ -14751,118 +15931,87 @@
|
|
|
14751
15931
|
}
|
|
14752
15932
|
|
|
14753
15933
|
return {
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
15934
|
+
image: src,
|
|
15935
|
+
// @ts-ignore
|
|
15936
|
+
repetition: repetition
|
|
14757
15937
|
};
|
|
14758
15938
|
}
|
|
14759
15939
|
|
|
14760
15940
|
return null;
|
|
14761
15941
|
}
|
|
14762
15942
|
|
|
14763
|
-
function
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
15943
|
+
function isPattern(object) {
|
|
15944
|
+
return isObject(object) && !!object.image;
|
|
15945
|
+
}
|
|
15946
|
+
/**
|
|
15947
|
+
* @see https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/parser/CSSParser.cpp#L97
|
|
15948
|
+
*/
|
|
14768
15949
|
|
|
14769
|
-
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
var minX = 0,
|
|
14776
|
-
minY = 0;
|
|
14777
|
-
var start;
|
|
14778
|
-
var end;
|
|
14779
|
-
|
|
14780
|
-
if (angle >= 0 && angle < 1 / 2 * Math.PI) {
|
|
14781
|
-
start = {
|
|
14782
|
-
x: minX,
|
|
14783
|
-
y: minY
|
|
14784
|
-
};
|
|
14785
|
-
end = {
|
|
14786
|
-
x: maxX,
|
|
14787
|
-
y: maxY
|
|
14788
|
-
};
|
|
14789
|
-
} else if (1 / 2 * Math.PI <= angle && angle < Math.PI) {
|
|
14790
|
-
start = {
|
|
14791
|
-
x: maxX,
|
|
14792
|
-
y: minY
|
|
14793
|
-
};
|
|
14794
|
-
end = {
|
|
14795
|
-
x: minX,
|
|
14796
|
-
y: maxY
|
|
14797
|
-
};
|
|
14798
|
-
} else if (Math.PI <= angle && angle < 3 / 2 * Math.PI) {
|
|
14799
|
-
start = {
|
|
14800
|
-
x: maxX,
|
|
14801
|
-
y: maxY
|
|
14802
|
-
};
|
|
14803
|
-
end = {
|
|
14804
|
-
x: minX,
|
|
14805
|
-
y: minY
|
|
14806
|
-
};
|
|
14807
|
-
} else {
|
|
14808
|
-
start = {
|
|
14809
|
-
x: minX,
|
|
14810
|
-
y: maxY
|
|
14811
|
-
};
|
|
14812
|
-
end = {
|
|
14813
|
-
x: maxX,
|
|
14814
|
-
y: minY
|
|
14815
|
-
};
|
|
14816
|
-
}
|
|
15950
|
+
var parseColor = lodash_memoize(function (colorStr) {
|
|
15951
|
+
if (isPattern(colorStr)) {
|
|
15952
|
+
return _extends({
|
|
15953
|
+
repetition: 'repeat'
|
|
15954
|
+
}, colorStr);
|
|
15955
|
+
}
|
|
14817
15956
|
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
var x = (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.x;
|
|
14821
|
-
var y = tanTheta * (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.y;
|
|
14822
|
-
return {
|
|
14823
|
-
x0: start.x,
|
|
14824
|
-
y0: start.y,
|
|
14825
|
-
x1: x,
|
|
14826
|
-
y1: y,
|
|
14827
|
-
steps: steps,
|
|
14828
|
-
hash: gradientStr
|
|
14829
|
-
};
|
|
15957
|
+
if (isNil(colorStr)) {
|
|
15958
|
+
colorStr = '';
|
|
14830
15959
|
}
|
|
14831
15960
|
|
|
14832
|
-
|
|
14833
|
-
|
|
15961
|
+
if (colorStr === 'transparent') {
|
|
15962
|
+
// transparent black
|
|
15963
|
+
return new CSSRGB(0, 0, 0, 0);
|
|
15964
|
+
} else if (colorStr === 'currentColor') {
|
|
15965
|
+
// @see https://github.com/adobe-webplatform/Snap.svg/issues/526
|
|
15966
|
+
colorStr = 'black';
|
|
15967
|
+
} // support CSS gradient syntax
|
|
14834
15968
|
|
|
14835
|
-
function parseRadialGradient(gradientStr) {
|
|
14836
|
-
var arr = regexRG.exec(gradientStr);
|
|
14837
15969
|
|
|
14838
|
-
|
|
14839
|
-
var _arr$4$match;
|
|
15970
|
+
var g = parseGradient$1(colorStr);
|
|
14840
15971
|
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
var steps = ((_arr$4$match = arr[4].match(regexColorStop)) === null || _arr$4$match === void 0 ? void 0 : _arr$4$match.map(function (stop) {
|
|
14845
|
-
return stop.split(':');
|
|
14846
|
-
})) || []; // 环半径为0时,默认无渐变,取渐变序列的最后一个颜色
|
|
15972
|
+
if (g) {
|
|
15973
|
+
return g;
|
|
15974
|
+
} // constants
|
|
14847
15975
|
|
|
14848
|
-
if (fr === 0) {
|
|
14849
|
-
var colors = arr[4].match(regexColorStop);
|
|
14850
|
-
return colors[colors.length - 1].split(':')[1];
|
|
14851
|
-
}
|
|
14852
15976
|
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
hash: gradientStr
|
|
14862
|
-
};
|
|
15977
|
+
var color$1 = color(colorStr);
|
|
15978
|
+
var rgba = [0, 0, 0, 0];
|
|
15979
|
+
|
|
15980
|
+
if (color$1 !== null) {
|
|
15981
|
+
rgba[0] = color$1.r || 0;
|
|
15982
|
+
rgba[1] = color$1.g || 0;
|
|
15983
|
+
rgba[2] = color$1.b || 0;
|
|
15984
|
+
rgba[3] = color$1.opacity;
|
|
14863
15985
|
}
|
|
14864
15986
|
|
|
14865
|
-
return
|
|
15987
|
+
return _construct(CSSRGB, rgba); // return {
|
|
15988
|
+
// type: PARSED_COLOR_TYPE.Constant,
|
|
15989
|
+
// value: rgba,
|
|
15990
|
+
// formatted:
|
|
15991
|
+
// // rgba(255,255,255,0) -> [NaN, NaN, NaN, 0]
|
|
15992
|
+
// // @see https://github.com/d3/d3-color/issues/52
|
|
15993
|
+
// (color && `rgba(${color.r || 0},${color.g || 0},${color.b || 0},${color.opacity})`) ||
|
|
15994
|
+
// 'rgba(0,0,0,0)',
|
|
15995
|
+
// };
|
|
15996
|
+
});
|
|
15997
|
+
function mergeColors(left, right) {
|
|
15998
|
+
// only support constant value, exclude gradient & pattern
|
|
15999
|
+
if (!(left instanceof CSSRGB) || !(right instanceof CSSRGB)) {
|
|
16000
|
+
return;
|
|
16001
|
+
}
|
|
16002
|
+
|
|
16003
|
+
return [[Number(left.r), Number(left.g), Number(left.b), Number(left.alpha)], [Number(right.r), Number(right.g), Number(right.b), Number(right.alpha)], function (color) {
|
|
16004
|
+
var rgba = color.slice();
|
|
16005
|
+
|
|
16006
|
+
if (rgba[3]) {
|
|
16007
|
+
for (var i = 0; i < 3; i++) {
|
|
16008
|
+
rgba[i] = Math.round(clamp(rgba[i], 0, 255));
|
|
16009
|
+
}
|
|
16010
|
+
}
|
|
16011
|
+
|
|
16012
|
+
rgba[3] = clamp(rgba[3], 0, 1);
|
|
16013
|
+
return "rgba(" + rgba.join(',') + ")";
|
|
16014
|
+
}];
|
|
14866
16015
|
}
|
|
14867
16016
|
|
|
14868
16017
|
/**
|
|
@@ -15578,8 +16727,7 @@
|
|
|
15578
16727
|
if (valueWithUnit.unit === exports.UnitType.kPixels) {
|
|
15579
16728
|
return Number(valueWithUnit.value);
|
|
15580
16729
|
} else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
|
|
15581
|
-
|
|
15582
|
-
var bounds = target.getGeometryBounds();
|
|
16730
|
+
var bounds = target.nodeName === exports.Shape.GROUP ? target.getLocalBounds() : target.getGeometryBounds();
|
|
15583
16731
|
var size = 0;
|
|
15584
16732
|
|
|
15585
16733
|
if (!AABB.isEmpty(bounds)) {
|
|
@@ -21911,6 +23059,7 @@
|
|
|
21911
23059
|
scale: [1, 10],
|
|
21912
23060
|
}
|
|
21913
23061
|
*/
|
|
23062
|
+
|
|
21914
23063
|
function convertToArrayForm(effectInput) {
|
|
21915
23064
|
var normalizedEffectInput = [];
|
|
21916
23065
|
|
|
@@ -22023,7 +23172,7 @@
|
|
|
22023
23172
|
for (var i = 0; i < keyframes.length; i++) {
|
|
22024
23173
|
var offset = keyframes[i].offset;
|
|
22025
23174
|
|
|
22026
|
-
if (offset
|
|
23175
|
+
if (!isNil(offset)) {
|
|
22027
23176
|
if (offset < previousOffset) {
|
|
22028
23177
|
throw new TypeError('Keyframes are not loosely sorted by offset. Sort or specify offsets.');
|
|
22029
23178
|
}
|
|
@@ -22054,15 +23203,15 @@
|
|
|
22054
23203
|
var previousOffset = Number(keyframes[0].computedOffset);
|
|
22055
23204
|
|
|
22056
23205
|
for (var _i = 1; _i < length; _i++) {
|
|
22057
|
-
var _offset =
|
|
23206
|
+
var _offset = keyframes[_i].computedOffset;
|
|
22058
23207
|
|
|
22059
|
-
if (_offset
|
|
23208
|
+
if (!isNil(_offset) && !isNil(previousOffset)) {
|
|
22060
23209
|
for (var j = 1; j < _i - previousIndex; j++) {
|
|
22061
|
-
keyframes[previousIndex + j].computedOffset = previousOffset + (_offset - previousOffset) * j / (_i - previousIndex);
|
|
23210
|
+
keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
|
|
22062
23211
|
}
|
|
22063
23212
|
|
|
22064
23213
|
previousIndex = _i;
|
|
22065
|
-
previousOffset = _offset;
|
|
23214
|
+
previousOffset = Number(_offset);
|
|
22066
23215
|
}
|
|
22067
23216
|
}
|
|
22068
23217
|
}
|
|
@@ -27518,28 +28667,6 @@
|
|
|
27518
28667
|
}
|
|
27519
28668
|
})], exports.CSSPropertyZIndex);
|
|
27520
28669
|
|
|
27521
|
-
// [PropertySyntax.COORDINATE]: CSSPropertyLocalPosition,
|
|
27522
|
-
// [PropertySyntax.ANGLE]: CSSPropertyAngle,
|
|
27523
|
-
// [PropertySyntax.COLOR]: CSSPropertyColor,
|
|
27524
|
-
// [PropertySyntax.PAINT]: CSSPropertyColor,
|
|
27525
|
-
// [PropertySyntax.OPACITY_VALUE]: CSSPropertyOpacity,
|
|
27526
|
-
// [PropertySyntax.LENGTH_PERCENTAGE]: CSSPropertyLengthOrPercentage,
|
|
27527
|
-
// [PropertySyntax.LENGTH_PERCENTAGE_12]: CSSPropertyLengthOrPercentage12,
|
|
27528
|
-
// [PropertySyntax.LENGTH_PERCENTAGE_14]: CSSPropertyLengthOrPercentage14,
|
|
27529
|
-
// [PropertySyntax.SHADOW_BLUR]: CSSPropertyShadowBlur,
|
|
27530
|
-
// [PropertySyntax.LIST_OF_POINTS]: CSSPropertyPoints,
|
|
27531
|
-
// [PropertySyntax.PATH]: CSSPropertyPath,
|
|
27532
|
-
// [PropertySyntax.FILTER]: CSSPropertyFilter,
|
|
27533
|
-
// [PropertySyntax.Z_INDEX]: CSSPropertyZIndex,
|
|
27534
|
-
// [PropertySyntax.OFFSET_PATH]: CSSPropertyOffsetPath,
|
|
27535
|
-
// [PropertySyntax.OFFSET_DISTANCE]: CSSPropertyOffsetDistance,
|
|
27536
|
-
// [PropertySyntax.CLIP_PATH]: CSSPropertyClipPath,
|
|
27537
|
-
// [PropertySyntax.TRANSFORM]: CSSPropertyTransform,
|
|
27538
|
-
// [PropertySyntax.TRANSFORM_ORIGIN]: CSSPropertyTransformOrigin,
|
|
27539
|
-
// [PropertySyntax.TEXT]: CSSPropertyText,
|
|
27540
|
-
// [PropertySyntax.TEXT_TRANSFORM]: CSSPropertyTextTransform,
|
|
27541
|
-
// };
|
|
27542
|
-
|
|
27543
28670
|
/**
|
|
27544
28671
|
* Blink used them in code generation(css_properties.json5)
|
|
27545
28672
|
*/
|
|
@@ -28305,10 +29432,14 @@
|
|
|
28305
29432
|
_geometryUpdater$upda4 = _geometryUpdater$upda.offsetY,
|
|
28306
29433
|
offsetY = _geometryUpdater$upda4 === void 0 ? 0 : _geometryUpdater$upda4,
|
|
28307
29434
|
_geometryUpdater$upda5 = _geometryUpdater$upda.offsetZ,
|
|
28308
|
-
offsetZ = _geometryUpdater$upda5 === void 0 ? 0 : _geometryUpdater$upda5; //
|
|
29435
|
+
offsetZ = _geometryUpdater$upda5 === void 0 ? 0 : _geometryUpdater$upda5; // account for negative width / height of Rect
|
|
29436
|
+
// @see https://github.com/antvis/g/issues/957
|
|
29437
|
+
|
|
28309
29438
|
|
|
29439
|
+
var flipY = width < 0;
|
|
29440
|
+
var flipX = height < 0; // init with content box
|
|
28310
29441
|
|
|
28311
|
-
var halfExtents = fromValues$1(width / 2, height / 2, depth / 2); // anchor is center by default, don't account for lineWidth here
|
|
29442
|
+
var halfExtents = fromValues$1(Math.abs(width) / 2, Math.abs(height) / 2, depth / 2); // anchor is center by default, don't account for lineWidth here
|
|
28312
29443
|
|
|
28313
29444
|
var lineWidth = parsedStyle.lineWidth,
|
|
28314
29445
|
increasedLineWidthForHitTesting = parsedStyle.increasedLineWidthForHitTesting,
|
|
@@ -28322,7 +29453,7 @@
|
|
|
28322
29453
|
delete parsedStyle.anchor;
|
|
28323
29454
|
}
|
|
28324
29455
|
|
|
28325
|
-
var center = fromValues$1((1 - (anchor && anchor[0].value || 0) * 2) *
|
|
29456
|
+
var center = fromValues$1((1 - (anchor && anchor[0].value || 0) * 2) * width / 2 + offsetX, (1 - (anchor && anchor[1].value || 0) * 2) * height / 2 + offsetY, (1 - (anchor && ((_anchor$ = anchor[2]) === null || _anchor$ === void 0 ? void 0 : _anchor$.value) || 0) * 2) * halfExtents[2] + offsetZ); // update geometry's AABB
|
|
28326
29457
|
|
|
28327
29458
|
geometry.contentBounds.update(center, halfExtents);
|
|
28328
29459
|
var halfLineWidth = (((lineWidth === null || lineWidth === void 0 ? void 0 : lineWidth.value) || 0) + ((increasedLineWidthForHitTesting === null || increasedLineWidthForHitTesting === void 0 ? void 0 : increasedLineWidthForHitTesting.value) || 0)) / 2; // append border
|
|
@@ -28384,10 +29515,10 @@
|
|
|
28384
29515
|
});
|
|
28385
29516
|
anchor = parsedStyle.anchor; // set transform origin
|
|
28386
29517
|
|
|
28387
|
-
var usedOriginXValue = convertPercentUnit(transformOrigin[0], 0, object);
|
|
28388
|
-
var usedOriginYValue = convertPercentUnit(transformOrigin[1], 1, object);
|
|
28389
|
-
usedOriginXValue
|
|
28390
|
-
usedOriginYValue
|
|
29518
|
+
var usedOriginXValue = (flipY ? -1 : 1) * convertPercentUnit(transformOrigin[0], 0, object);
|
|
29519
|
+
var usedOriginYValue = (flipX ? -1 : 1) * convertPercentUnit(transformOrigin[1], 1, object);
|
|
29520
|
+
usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0].value || 0) * geometry.contentBounds.halfExtents[0] * 2;
|
|
29521
|
+
usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1].value || 0) * geometry.contentBounds.halfExtents[1] * 2;
|
|
28391
29522
|
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
28392
29523
|
object.dispatchEvent(new CustomEvent(exports.ElementEvent.GEOMETRY_BOUNDS_CHANGED));
|
|
28393
29524
|
dirtifyToRoot(object);
|
|
@@ -28640,7 +29771,7 @@
|
|
|
28640
29771
|
return AbstractRenderer;
|
|
28641
29772
|
}();
|
|
28642
29773
|
|
|
28643
|
-
let uId=1;const root="object"==typeof self&&self.self==self?self:"object"==typeof global&&global.global==global?global:{},nowOffset=Date.now();let reservedCBs={},lastTime=Date.now();const polyfillRaf=e=>{if("function"!=typeof e)throw new TypeError(e+" is not a function");const o=Date.now(),t=o-lastTime,n=t>16?0:16-t,r=uId++;return reservedCBs[r]=e,Object.keys(reservedCBs).length>1||setTimeout((()=>{lastTime=o;const e=reservedCBs;reservedCBs={},Object.keys(e).forEach((o=>e[o](root.performance&&"function"==typeof root.performance.now?root.performance.now():Date.now()-nowOffset)));}),n),r},polyfillCaf=e=>{delete reservedCBs[e];},vendorPrefixes=["","webkit","moz","ms","o"],getRequestAnimationFrame=e=>"string"!=typeof e?polyfillRaf:""===e?root.requestAnimationFrame:root[e+"RequestAnimationFrame"],getCancelAnimationFrame=e=>"string"!=typeof e?polyfillCaf:""===e?root.cancelAnimationFrame:root[e+"CancelAnimationFrame"]||root[e+"CancelRequestAnimationFrame"],find=(e,o)=>{let t=0;for(;void 0!==e[t];){if(o(e[t]))return e[t];t+=1;}},vp=find(vendorPrefixes,(e=>!!getRequestAnimationFrame(e))),raf=getRequestAnimationFrame(vp),caf=getCancelAnimationFrame(vp);root.requestAnimationFrame=raf,root.cancelAnimationFrame=caf,"undefined"!=typeof module&&module.exports&&(module.exports={requestAnimationFrame:raf,cancelAnimationFrame:caf});
|
|
29774
|
+
let uId=1;const root$1="object"==typeof self&&self.self==self?self:"object"==typeof global&&global.global==global?global:{},nowOffset=Date.now();let reservedCBs={},lastTime=Date.now();const polyfillRaf=e=>{if("function"!=typeof e)throw new TypeError(e+" is not a function");const o=Date.now(),t=o-lastTime,n=t>16?0:16-t,r=uId++;return reservedCBs[r]=e,Object.keys(reservedCBs).length>1||setTimeout((()=>{lastTime=o;const e=reservedCBs;reservedCBs={},Object.keys(e).forEach((o=>e[o](root$1.performance&&"function"==typeof root$1.performance.now?root$1.performance.now():Date.now()-nowOffset)));}),n),r},polyfillCaf=e=>{delete reservedCBs[e];},vendorPrefixes=["","webkit","moz","ms","o"],getRequestAnimationFrame=e=>"string"!=typeof e?polyfillRaf:""===e?root$1.requestAnimationFrame:root$1[e+"RequestAnimationFrame"],getCancelAnimationFrame=e=>"string"!=typeof e?polyfillCaf:""===e?root$1.cancelAnimationFrame:root$1[e+"CancelAnimationFrame"]||root$1[e+"CancelRequestAnimationFrame"],find=(e,o)=>{let t=0;for(;void 0!==e[t];){if(o(e[t]))return e[t];t+=1;}},vp=find(vendorPrefixes,(e=>!!getRequestAnimationFrame(e))),raf=getRequestAnimationFrame(vp),caf=getCancelAnimationFrame(vp);root$1.requestAnimationFrame=raf,root$1.cancelAnimationFrame=caf,"undefined"!=typeof module&&module.exports&&(module.exports={requestAnimationFrame:raf,cancelAnimationFrame:caf});
|
|
28644
29775
|
|
|
28645
29776
|
var _class$1;
|
|
28646
29777
|
|
|
@@ -29948,7 +31079,7 @@
|
|
|
29948
31079
|
}
|
|
29949
31080
|
});
|
|
29950
31081
|
} else {
|
|
29951
|
-
console.
|
|
31082
|
+
console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.", 'appended child: ', parent);
|
|
29952
31083
|
}
|
|
29953
31084
|
};
|
|
29954
31085
|
|
|
@@ -30143,7 +31274,10 @@
|
|
|
30143
31274
|
exports.clampedMergeNumbers = clampedMergeNumbers;
|
|
30144
31275
|
exports.cleanExistedCanvas = cleanExistedCanvas;
|
|
30145
31276
|
exports.clonePath = clonePath;
|
|
31277
|
+
exports.colorStopToString = colorStopToString;
|
|
30146
31278
|
exports.compareAnimations = compareAnimations;
|
|
31279
|
+
exports.computeLinearGradient = computeLinearGradient;
|
|
31280
|
+
exports.computeRadialGradient = computeRadialGradient;
|
|
30147
31281
|
exports.contrib = contrib;
|
|
30148
31282
|
exports.convertAngleUnit = convertAngleUnit;
|
|
30149
31283
|
exports.convertEffectInput = convertEffectInput;
|
|
@@ -30182,6 +31316,7 @@
|
|
|
30182
31316
|
exports.isNil = isNil;
|
|
30183
31317
|
exports.isNumber = isNumber;
|
|
30184
31318
|
exports.isObject = isObject;
|
|
31319
|
+
exports.isPattern = isPattern;
|
|
30185
31320
|
exports.isString = isString;
|
|
30186
31321
|
exports.isSyringeModule = isSyringeModule;
|
|
30187
31322
|
exports.isUndefined = isUndefined;
|
|
@@ -30207,6 +31342,7 @@
|
|
|
30207
31342
|
exports.parseDimension = parseDimension;
|
|
30208
31343
|
exports.parseDimensionArray = parseDimensionArray;
|
|
30209
31344
|
exports.parseFilter = parseFilter;
|
|
31345
|
+
exports.parseGradient = parseGradient;
|
|
30210
31346
|
exports.parseLength = parseLength;
|
|
30211
31347
|
exports.parseLengthOrPercentage = parseLengthOrPercentage;
|
|
30212
31348
|
exports.parseNumber = parseNumber;
|