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.mjs CHANGED
@@ -6949,7 +6949,7 @@ function convert2Css(g, width, height, standard) {
6949
6949
  }
6950
6950
  var newStops = stops.slice(0);
6951
6951
  // panel新增可能出现顺序不对
6952
- newStops.sort(function (a, b) { return a.offset - b.offset; });
6952
+ newStops.sort(function (a, b) { return a.offset.v - b.offset.v; });
6953
6953
  if (t === GRADIENT.LINEAR) {
6954
6954
  var start = void 0, end = void 0;
6955
6955
  if (deg <= 90) {
@@ -7108,7 +7108,7 @@ function convert2Css(g, width, height, standard) {
7108
7108
  if (i) {
7109
7109
  s_2 += ', ';
7110
7110
  }
7111
- var color = item.color.map(function (c, i) {
7111
+ var color = item.color.v.map(function (c, i) {
7112
7112
  if (i === 3) {
7113
7113
  return toPrecision(c);
7114
7114
  }
@@ -7116,7 +7116,7 @@ function convert2Css(g, width, height, standard) {
7116
7116
  return Math.min(255, Math.floor(c * ratio_1));
7117
7117
  }
7118
7118
  });
7119
- s_2 += color2rgbaStr(color) + ' ' + toPrecision(item.offset * 100) + '%';
7119
+ s_2 += color2rgbaStr(color) + ' ' + toPrecision(item.offset.v * 100) + '%';
7120
7120
  });
7121
7121
  return s_2 + ')';
7122
7122
  }
@@ -7129,38 +7129,50 @@ function convert2Css(g, width, height, standard) {
7129
7129
  // 当首尾offset不为[0,1]时,标准尾首间会断渐变需要手动补齐
7130
7130
  var first = newStops[0];
7131
7131
  var last = newStops[newStops.length - 1];
7132
- if (standard && (first.offset > 0 || last.offset < 1)) {
7133
- var fa = (_a = first.color[3]) !== null && _a !== void 0 ? _a : 1;
7134
- var la = (_b = last.color[3]) !== null && _b !== void 0 ? _b : 1;
7132
+ if (standard && (first.offset.v > 0 || last.offset.v < 1)) {
7133
+ var fa = (_a = first.color.v[3]) !== null && _a !== void 0 ? _a : 1;
7134
+ var la = (_b = last.color.v[3]) !== null && _b !== void 0 ? _b : 1;
7135
7135
  var dc = [
7136
- first.color[0] - last.color[0],
7137
- first.color[1] - last.color[1],
7138
- first.color[2] - last.color[2],
7136
+ first.color.v[0] - last.color.v[0],
7137
+ first.color.v[1] - last.color.v[1],
7138
+ first.color.v[2] - last.color.v[2],
7139
7139
  fa - la,
7140
7140
  ];
7141
- var dl = 1 - last.offset + first.offset;
7142
- if (first.offset > 0) {
7143
- var p = first.offset / dl;
7141
+ var dl = 1 - last.offset.v + first.offset.v;
7142
+ if (first.offset.v > 0) {
7143
+ var p = first.offset.v / dl;
7144
7144
  newStops.unshift({
7145
- color: [
7146
- Math.min(255, Math.max(0, Math.round(first.color[0] - dc[0] * p))),
7147
- Math.min(255, Math.max(0, Math.round(first.color[1] - dc[1] * p))),
7148
- Math.min(255, Math.max(0, Math.round(first.color[2] - dc[2] * p))),
7149
- Math.min(1, Math.max(0, (_c = first.color[3]) !== null && _c !== void 0 ? _c : 1 - dc[3] * p)),
7150
- ],
7151
- offset: 0,
7145
+ color: {
7146
+ v: [
7147
+ Math.min(255, Math.max(0, Math.round(first.color.v[0] - dc[0] * p))),
7148
+ Math.min(255, Math.max(0, Math.round(first.color.v[1] - dc[1] * p))),
7149
+ Math.min(255, Math.max(0, Math.round(first.color.v[2] - dc[2] * p))),
7150
+ Math.min(1, Math.max(0, (_c = first.color.v[3]) !== null && _c !== void 0 ? _c : 1 - dc[3] * p)),
7151
+ ],
7152
+ u: StyleUnit.RGBA,
7153
+ },
7154
+ offset: {
7155
+ v: 0,
7156
+ u: StyleUnit.PERCENT,
7157
+ },
7152
7158
  });
7153
7159
  }
7154
- if (last.offset < 1) {
7155
- var p = (1 - last.offset) / dl;
7160
+ if (last.offset.v < 1) {
7161
+ var p = (1 - last.offset.v) / dl;
7156
7162
  newStops.push({
7157
- color: [
7158
- Math.min(255, Math.max(0, Math.round(last.color[0] + dc[0] * p))),
7159
- Math.min(255, Math.max(0, Math.round(last.color[1] + dc[1] * p))),
7160
- Math.min(255, Math.max(0, Math.round(last.color[2] + dc[2] * p))),
7161
- Math.min(1, Math.max(0, (_d = last.color[3]) !== null && _d !== void 0 ? _d : 1 + dc[3] * p)),
7162
- ],
7163
- offset: 1,
7163
+ color: {
7164
+ v: [
7165
+ Math.min(255, Math.max(0, Math.round(last.color.v[0] + dc[0] * p))),
7166
+ Math.min(255, Math.max(0, Math.round(last.color.v[1] + dc[1] * p))),
7167
+ Math.min(255, Math.max(0, Math.round(last.color.v[2] + dc[2] * p))),
7168
+ Math.min(1, Math.max(0, (_d = last.color.v[3]) !== null && _d !== void 0 ? _d : 1 + dc[3] * p)),
7169
+ ],
7170
+ u: StyleUnit.RGBA,
7171
+ },
7172
+ offset: {
7173
+ v: 100,
7174
+ u: StyleUnit.PERCENT,
7175
+ },
7164
7176
  });
7165
7177
  }
7166
7178
  }
@@ -7168,8 +7180,8 @@ function convert2Css(g, width, height, standard) {
7168
7180
  if (i) {
7169
7181
  s_3 += ', ';
7170
7182
  }
7171
- item.color[3] = toPrecision(item.color[3]);
7172
- s_3 += color2rgbaStr(item.color) + ' ' + toPrecision(item.offset * 100) + '%';
7183
+ item.color.v[3] = toPrecision(item.color.v[3]);
7184
+ s_3 += color2rgbaStr(item.color.v) + ' ' + toPrecision(item.offset.v * 100) + '%';
7173
7185
  });
7174
7186
  return s_3 + ')';
7175
7187
  }
@@ -8247,10 +8259,33 @@ function normalizePoints(item) {
8247
8259
  dspTy: 0,
8248
8260
  };
8249
8261
  }
8262
+ function getCssTextShadow(item) {
8263
+ if (!item) {
8264
+ return 'none';
8265
+ }
8266
+ return item.x + 'px ' + item.y + 'px ' + item.blur + ' px ' + color2rgbaStr(item.color);
8267
+ }
8250
8268
  function getPropsRich(rich) {
8251
- return __assign(__assign({}, rich), { textAlign: (['left', 'right', 'center', 'justify'][rich.textAlign] || 'left'), textDecoration: rich.textDecoration.map(function (o) {
8252
- return ['none', 'underline', 'lineThrough'][o] || 'none';
8253
- }), color: color2rgbaStr(rich.color) });
8269
+ return {
8270
+ fontFamily: rich.fontFamily.v,
8271
+ fontSize: rich.fontSize.v,
8272
+ fontWeight: rich.fontWeight.v,
8273
+ lineHeight: rich.lineHeight.v,
8274
+ letterSpacing: rich.letterSpacing.v,
8275
+ paragraphSpacing: rich.paragraphSpacing.v,
8276
+ fontStyle: ['normal', 'italic', 'oblique'][rich.fontStyle.v] || 'normal',
8277
+ color: color2rgbaStr(rich.color.v),
8278
+ textAlign: (['left', 'right', 'center', 'justify'][rich.textAlign.v] || 'left'),
8279
+ textDecoration: rich.textDecoration.map(function (item) {
8280
+ return ['none', 'underline', 'lineThrough'][item.v] || 'none';
8281
+ }),
8282
+ textShadow: getCssTextShadow(rich.textShadow.v),
8283
+ stroke: rich.stroke.map(function (item) {
8284
+ return getCssFillStroke(item.v, 1, 1, true);
8285
+ }),
8286
+ strokeWidth: rich.strokeWidth.map(function (item) { return item.v; }),
8287
+ strokeEnable: rich.strokeEnable.map(function (item) { return item.v; }),
8288
+ };
8254
8289
  }
8255
8290
  var css = {
8256
8291
  normalize: normalize,
@@ -11747,27 +11782,27 @@ var Node = /** @class */ (function (_super) {
11747
11782
  });
11748
11783
  if (standard) {
11749
11784
  if (this.isMounted) {
11750
- res.fill = computedStyle.fill.map(function (item) { return getCssFillStroke(item, _this.width, _this.height, true); });
11785
+ res.fill = style.fill.map(function (item) { return getCssFillStroke(item.v, _this.width, _this.height, true); });
11751
11786
  }
11752
11787
  else {
11753
11788
  inject.error('Can not get CSS standard fill unmounted');
11754
11789
  }
11755
11790
  }
11756
11791
  else {
11757
- res.fill = calComputedFill(style.fill).map(function (item) { return getCssFillStroke(item); });
11792
+ res.fill = style.fill.map(function (item) { return getCssFillStroke(item.v); });
11758
11793
  }
11759
11794
  res.fillRule = ['nonzero', 'evenodd'][style.fillRule.v];
11760
11795
  res.fillMode = style.fillMode.map(function (item) { return getCssMbm(item.v); });
11761
11796
  if (standard) {
11762
11797
  if (this.isMounted) {
11763
- res.stroke = computedStyle.stroke.map(function (item) { return getCssFillStroke(item, _this.width, _this.height, true); });
11798
+ res.stroke = style.stroke.map(function (item) { return getCssFillStroke(item.v, _this.width, _this.height, true); });
11764
11799
  }
11765
11800
  else {
11766
11801
  inject.error('Can not get CSS standard stroke unmounted');
11767
11802
  }
11768
11803
  }
11769
11804
  else {
11770
- res.stroke = calComputedStroke(style.stroke).map(function (item) { return getCssFillStroke(item, _this.width, _this.height); });
11805
+ res.stroke = style.stroke.map(function (item) { return getCssFillStroke(item.v); });
11771
11806
  }
11772
11807
  res.strokeLinecap = ['butt', 'round', 'square'][style.strokeLinecap.v];
11773
11808
  res.strokeLinejoin = ['miter', 'round', 'bevel'][style.strokeLinejoin.v];
@@ -42769,7 +42804,7 @@ var Text = /** @class */ (function (_super) {
42769
42804
  };
42770
42805
  Text.prototype.cloneProps = function () {
42771
42806
  var props = _super.prototype.cloneProps.call(this);
42772
- // props.rich = this.computedRich.map(item => getPropsRich(item));
42807
+ props.rich = this.rich.map(function (item) { return getPropsRich(item); });
42773
42808
  if (this.isMounted) {
42774
42809
  var textBehaviour = props.textBehaviour = this.getTextBehaviour();
42775
42810
  var style = props.style;