krono-flow 0.0.2 → 0.0.3
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/index.js +73 -38
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +73 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6955,7 +6955,7 @@
|
|
|
6955
6955
|
}
|
|
6956
6956
|
var newStops = stops.slice(0);
|
|
6957
6957
|
// panel新增可能出现顺序不对
|
|
6958
|
-
newStops.sort(function (a, b) { return a.offset - b.offset; });
|
|
6958
|
+
newStops.sort(function (a, b) { return a.offset.v - b.offset.v; });
|
|
6959
6959
|
if (t === GRADIENT.LINEAR) {
|
|
6960
6960
|
var start = void 0, end = void 0;
|
|
6961
6961
|
if (deg <= 90) {
|
|
@@ -7114,7 +7114,7 @@
|
|
|
7114
7114
|
if (i) {
|
|
7115
7115
|
s_2 += ', ';
|
|
7116
7116
|
}
|
|
7117
|
-
var color = item.color.map(function (c, i) {
|
|
7117
|
+
var color = item.color.v.map(function (c, i) {
|
|
7118
7118
|
if (i === 3) {
|
|
7119
7119
|
return toPrecision(c);
|
|
7120
7120
|
}
|
|
@@ -7122,7 +7122,7 @@
|
|
|
7122
7122
|
return Math.min(255, Math.floor(c * ratio_1));
|
|
7123
7123
|
}
|
|
7124
7124
|
});
|
|
7125
|
-
s_2 += color2rgbaStr(color) + ' ' + toPrecision(item.offset * 100) + '%';
|
|
7125
|
+
s_2 += color2rgbaStr(color) + ' ' + toPrecision(item.offset.v * 100) + '%';
|
|
7126
7126
|
});
|
|
7127
7127
|
return s_2 + ')';
|
|
7128
7128
|
}
|
|
@@ -7135,38 +7135,50 @@
|
|
|
7135
7135
|
// 当首尾offset不为[0,1]时,标准尾首间会断渐变需要手动补齐
|
|
7136
7136
|
var first = newStops[0];
|
|
7137
7137
|
var last = newStops[newStops.length - 1];
|
|
7138
|
-
if (standard && (first.offset > 0 || last.offset < 1)) {
|
|
7139
|
-
var fa = (_a = first.color[3]) !== null && _a !== void 0 ? _a : 1;
|
|
7140
|
-
var la = (_b = last.color[3]) !== null && _b !== void 0 ? _b : 1;
|
|
7138
|
+
if (standard && (first.offset.v > 0 || last.offset.v < 1)) {
|
|
7139
|
+
var fa = (_a = first.color.v[3]) !== null && _a !== void 0 ? _a : 1;
|
|
7140
|
+
var la = (_b = last.color.v[3]) !== null && _b !== void 0 ? _b : 1;
|
|
7141
7141
|
var dc = [
|
|
7142
|
-
first.color[0] - last.color[0],
|
|
7143
|
-
first.color[1] - last.color[1],
|
|
7144
|
-
first.color[2] - last.color[2],
|
|
7142
|
+
first.color.v[0] - last.color.v[0],
|
|
7143
|
+
first.color.v[1] - last.color.v[1],
|
|
7144
|
+
first.color.v[2] - last.color.v[2],
|
|
7145
7145
|
fa - la,
|
|
7146
7146
|
];
|
|
7147
|
-
var dl = 1 - last.offset + first.offset;
|
|
7148
|
-
if (first.offset > 0) {
|
|
7149
|
-
var p = first.offset / dl;
|
|
7147
|
+
var dl = 1 - last.offset.v + first.offset.v;
|
|
7148
|
+
if (first.offset.v > 0) {
|
|
7149
|
+
var p = first.offset.v / dl;
|
|
7150
7150
|
newStops.unshift({
|
|
7151
|
-
color:
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7151
|
+
color: {
|
|
7152
|
+
v: [
|
|
7153
|
+
Math.min(255, Math.max(0, Math.round(first.color.v[0] - dc[0] * p))),
|
|
7154
|
+
Math.min(255, Math.max(0, Math.round(first.color.v[1] - dc[1] * p))),
|
|
7155
|
+
Math.min(255, Math.max(0, Math.round(first.color.v[2] - dc[2] * p))),
|
|
7156
|
+
Math.min(1, Math.max(0, (_c = first.color.v[3]) !== null && _c !== void 0 ? _c : 1 - dc[3] * p)),
|
|
7157
|
+
],
|
|
7158
|
+
u: StyleUnit.RGBA,
|
|
7159
|
+
},
|
|
7160
|
+
offset: {
|
|
7161
|
+
v: 0,
|
|
7162
|
+
u: StyleUnit.PERCENT,
|
|
7163
|
+
},
|
|
7158
7164
|
});
|
|
7159
7165
|
}
|
|
7160
|
-
if (last.offset < 1) {
|
|
7161
|
-
var p = (1 - last.offset) / dl;
|
|
7166
|
+
if (last.offset.v < 1) {
|
|
7167
|
+
var p = (1 - last.offset.v) / dl;
|
|
7162
7168
|
newStops.push({
|
|
7163
|
-
color:
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7169
|
+
color: {
|
|
7170
|
+
v: [
|
|
7171
|
+
Math.min(255, Math.max(0, Math.round(last.color.v[0] + dc[0] * p))),
|
|
7172
|
+
Math.min(255, Math.max(0, Math.round(last.color.v[1] + dc[1] * p))),
|
|
7173
|
+
Math.min(255, Math.max(0, Math.round(last.color.v[2] + dc[2] * p))),
|
|
7174
|
+
Math.min(1, Math.max(0, (_d = last.color.v[3]) !== null && _d !== void 0 ? _d : 1 + dc[3] * p)),
|
|
7175
|
+
],
|
|
7176
|
+
u: StyleUnit.RGBA,
|
|
7177
|
+
},
|
|
7178
|
+
offset: {
|
|
7179
|
+
v: 100,
|
|
7180
|
+
u: StyleUnit.PERCENT,
|
|
7181
|
+
},
|
|
7170
7182
|
});
|
|
7171
7183
|
}
|
|
7172
7184
|
}
|
|
@@ -7174,8 +7186,8 @@
|
|
|
7174
7186
|
if (i) {
|
|
7175
7187
|
s_3 += ', ';
|
|
7176
7188
|
}
|
|
7177
|
-
item.color[3] = toPrecision(item.color[3]);
|
|
7178
|
-
s_3 += color2rgbaStr(item.color) + ' ' + toPrecision(item.offset * 100) + '%';
|
|
7189
|
+
item.color.v[3] = toPrecision(item.color.v[3]);
|
|
7190
|
+
s_3 += color2rgbaStr(item.color.v) + ' ' + toPrecision(item.offset.v * 100) + '%';
|
|
7179
7191
|
});
|
|
7180
7192
|
return s_3 + ')';
|
|
7181
7193
|
}
|
|
@@ -8253,10 +8265,33 @@
|
|
|
8253
8265
|
dspTy: 0,
|
|
8254
8266
|
};
|
|
8255
8267
|
}
|
|
8268
|
+
function getCssTextShadow(item) {
|
|
8269
|
+
if (!item) {
|
|
8270
|
+
return 'none';
|
|
8271
|
+
}
|
|
8272
|
+
return item.x + 'px ' + item.y + 'px ' + item.blur + ' px ' + color2rgbaStr(item.color);
|
|
8273
|
+
}
|
|
8256
8274
|
function getPropsRich(rich) {
|
|
8257
|
-
return
|
|
8258
|
-
|
|
8259
|
-
|
|
8275
|
+
return {
|
|
8276
|
+
fontFamily: rich.fontFamily.v,
|
|
8277
|
+
fontSize: rich.fontSize.v,
|
|
8278
|
+
fontWeight: rich.fontWeight.v,
|
|
8279
|
+
lineHeight: rich.lineHeight.v,
|
|
8280
|
+
letterSpacing: rich.letterSpacing.v,
|
|
8281
|
+
paragraphSpacing: rich.paragraphSpacing.v,
|
|
8282
|
+
fontStyle: ['normal', 'italic', 'oblique'][rich.fontStyle.v] || 'normal',
|
|
8283
|
+
color: color2rgbaStr(rich.color.v),
|
|
8284
|
+
textAlign: (['left', 'right', 'center', 'justify'][rich.textAlign.v] || 'left'),
|
|
8285
|
+
textDecoration: rich.textDecoration.map(function (item) {
|
|
8286
|
+
return ['none', 'underline', 'lineThrough'][item.v] || 'none';
|
|
8287
|
+
}),
|
|
8288
|
+
textShadow: getCssTextShadow(rich.textShadow.v),
|
|
8289
|
+
stroke: rich.stroke.map(function (item) {
|
|
8290
|
+
return getCssFillStroke(item.v, 1, 1, true);
|
|
8291
|
+
}),
|
|
8292
|
+
strokeWidth: rich.strokeWidth.map(function (item) { return item.v; }),
|
|
8293
|
+
strokeEnable: rich.strokeEnable.map(function (item) { return item.v; }),
|
|
8294
|
+
};
|
|
8260
8295
|
}
|
|
8261
8296
|
var css = {
|
|
8262
8297
|
normalize: normalize,
|
|
@@ -11753,27 +11788,27 @@
|
|
|
11753
11788
|
});
|
|
11754
11789
|
if (standard) {
|
|
11755
11790
|
if (this.isMounted) {
|
|
11756
|
-
res.fill =
|
|
11791
|
+
res.fill = style.fill.map(function (item) { return getCssFillStroke(item.v, _this.width, _this.height, true); });
|
|
11757
11792
|
}
|
|
11758
11793
|
else {
|
|
11759
11794
|
inject.error('Can not get CSS standard fill unmounted');
|
|
11760
11795
|
}
|
|
11761
11796
|
}
|
|
11762
11797
|
else {
|
|
11763
|
-
res.fill =
|
|
11798
|
+
res.fill = style.fill.map(function (item) { return getCssFillStroke(item.v); });
|
|
11764
11799
|
}
|
|
11765
11800
|
res.fillRule = ['nonzero', 'evenodd'][style.fillRule.v];
|
|
11766
11801
|
res.fillMode = style.fillMode.map(function (item) { return getCssMbm(item.v); });
|
|
11767
11802
|
if (standard) {
|
|
11768
11803
|
if (this.isMounted) {
|
|
11769
|
-
res.stroke =
|
|
11804
|
+
res.stroke = style.stroke.map(function (item) { return getCssFillStroke(item.v, _this.width, _this.height, true); });
|
|
11770
11805
|
}
|
|
11771
11806
|
else {
|
|
11772
11807
|
inject.error('Can not get CSS standard stroke unmounted');
|
|
11773
11808
|
}
|
|
11774
11809
|
}
|
|
11775
11810
|
else {
|
|
11776
|
-
res.stroke =
|
|
11811
|
+
res.stroke = style.stroke.map(function (item) { return getCssFillStroke(item.v); });
|
|
11777
11812
|
}
|
|
11778
11813
|
res.strokeLinecap = ['butt', 'round', 'square'][style.strokeLinecap.v];
|
|
11779
11814
|
res.strokeLinejoin = ['miter', 'round', 'bevel'][style.strokeLinejoin.v];
|
|
@@ -42775,7 +42810,7 @@
|
|
|
42775
42810
|
};
|
|
42776
42811
|
Text.prototype.cloneProps = function () {
|
|
42777
42812
|
var props = _super.prototype.cloneProps.call(this);
|
|
42778
|
-
|
|
42813
|
+
props.rich = this.rich.map(function (item) { return getPropsRich(item); });
|
|
42779
42814
|
if (this.isMounted) {
|
|
42780
42815
|
var textBehaviour = props.textBehaviour = this.getTextBehaviour();
|
|
42781
42816
|
var style = props.style;
|