js: define text color with gradient

This commit is contained in:
王劲鹏
2021-07-19 16:29:54 +08:00
committed by osborn
parent ae62a76160
commit 4a0c8bd171
10 changed files with 458 additions and 367 deletions

View File

@@ -1764,6 +1764,109 @@ var AnimationSet = /** @class */ (function () {
return AnimationSet;
}());
var __extends$c = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) { d[p] = b[p]; } } };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
{ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); }
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") { r = Reflect.decorate(decorators, target, key, desc); }
else { for (var i = decorators.length - 1; i >= 0; i--) { if (d = decorators[i]) { r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; } } }
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata$a = (undefined && undefined.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(k, v); }
};
exports.TruncateAt = void 0;
(function (TruncateAt) {
TruncateAt[TruncateAt["End"] = 0] = "End";
TruncateAt[TruncateAt["Middle"] = 1] = "Middle";
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(exports.TruncateAt || (exports.TruncateAt = {}));
var Text = /** @class */ (function (_super) {
__extends$c(Text, _super);
function Text() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "text", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Object)
], Text.prototype, "textColor", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "textSize", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxLines", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Gravity)
], Text.prototype, "textAlignment", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "fontStyle", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "font", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxWidth", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxHeight", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "lineSpacing", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "strikethrough", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "underline", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "truncateAt", void 0);
return Text;
}(View));
function text(config) {
var ret = new Text;
ret.layoutConfig = layoutConfig().fit();
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
return ret;
}
/**
* Store color as format AARRGGBB or RRGGBB
*/
@@ -1840,109 +1943,6 @@ exports.GradientOrientation = void 0;
GradientOrientation[GradientOrientation["TL_BR"] = 7] = "TL_BR";
})(exports.GradientOrientation || (exports.GradientOrientation = {}));
var __extends$c = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) { d[p] = b[p]; } } };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
{ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); }
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") { r = Reflect.decorate(decorators, target, key, desc); }
else { for (var i = decorators.length - 1; i >= 0; i--) { if (d = decorators[i]) { r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; } } }
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata$a = (undefined && undefined.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(k, v); }
};
exports.TruncateAt = void 0;
(function (TruncateAt) {
TruncateAt[TruncateAt["End"] = 0] = "End";
TruncateAt[TruncateAt["Middle"] = 1] = "Middle";
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(exports.TruncateAt || (exports.TruncateAt = {}));
var Text = /** @class */ (function (_super) {
__extends$c(Text, _super);
function Text() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "text", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Color)
], Text.prototype, "textColor", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "textSize", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxLines", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Gravity)
], Text.prototype, "textAlignment", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "fontStyle", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "font", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxWidth", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxHeight", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "lineSpacing", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "strikethrough", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "underline", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "truncateAt", void 0);
return Text;
}(View));
function text(config) {
var ret = new Text;
ret.layoutConfig = layoutConfig().fit();
for (var key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
return ret;
}
var __extends$b = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||

View File

@@ -1335,6 +1335,89 @@ class AnimationSet {
}
}
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata$a = (undefined && undefined.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
exports.TruncateAt = void 0;
(function (TruncateAt) {
TruncateAt[TruncateAt["End"] = 0] = "End";
TruncateAt[TruncateAt["Middle"] = 1] = "Middle";
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(exports.TruncateAt || (exports.TruncateAt = {}));
class Text extends View {
}
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "text", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Object)
], Text.prototype, "textColor", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "textSize", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxLines", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Gravity)
], Text.prototype, "textAlignment", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "fontStyle", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "font", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxWidth", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxHeight", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "lineSpacing", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "strikethrough", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "underline", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "truncateAt", void 0);
function text(config) {
const ret = new Text;
ret.layoutConfig = layoutConfig().fit();
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
return ret;
}
/**
* Store color as format AARRGGBB or RRGGBB
*/
@@ -1409,89 +1492,6 @@ exports.GradientOrientation = void 0;
GradientOrientation[GradientOrientation["TL_BR"] = 7] = "TL_BR";
})(exports.GradientOrientation || (exports.GradientOrientation = {}));
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata$a = (undefined && undefined.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
exports.TruncateAt = void 0;
(function (TruncateAt) {
TruncateAt[TruncateAt["End"] = 0] = "End";
TruncateAt[TruncateAt["Middle"] = 1] = "Middle";
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(exports.TruncateAt || (exports.TruncateAt = {}));
class Text extends View {
}
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "text", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Color)
], Text.prototype, "textColor", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "textSize", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxLines", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Gravity)
], Text.prototype, "textAlignment", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "fontStyle", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "font", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxWidth", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxHeight", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "lineSpacing", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "strikethrough", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "underline", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "truncateAt", void 0);
function text(config) {
const ret = new Text;
ret.layoutConfig = layoutConfig().fit();
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
return ret;
}
var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

View File

@@ -2856,6 +2856,89 @@ class AnimationSet {
}
}
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata$a = (undefined && undefined.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
exports.TruncateAt = void 0;
(function (TruncateAt) {
TruncateAt[TruncateAt["End"] = 0] = "End";
TruncateAt[TruncateAt["Middle"] = 1] = "Middle";
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(exports.TruncateAt || (exports.TruncateAt = {}));
class Text extends View {
}
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "text", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Object)
], Text.prototype, "textColor", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "textSize", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxLines", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Gravity)
], Text.prototype, "textAlignment", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "fontStyle", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "font", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxWidth", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxHeight", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "lineSpacing", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "strikethrough", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "underline", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "truncateAt", void 0);
function text(config) {
const ret = new Text;
ret.layoutConfig = layoutConfig().fit();
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
return ret;
}
/**
* Store color as format AARRGGBB or RRGGBB
*/
@@ -2930,89 +3013,6 @@ exports.GradientOrientation = void 0;
GradientOrientation[GradientOrientation["TL_BR"] = 7] = "TL_BR";
})(exports.GradientOrientation || (exports.GradientOrientation = {}));
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata$a = (undefined && undefined.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
exports.TruncateAt = void 0;
(function (TruncateAt) {
TruncateAt[TruncateAt["End"] = 0] = "End";
TruncateAt[TruncateAt["Middle"] = 1] = "Middle";
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(exports.TruncateAt || (exports.TruncateAt = {}));
class Text extends View {
}
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "text", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Color)
], Text.prototype, "textColor", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "textSize", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxLines", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Gravity)
], Text.prototype, "textAlignment", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "fontStyle", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "font", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxWidth", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "maxHeight", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "lineSpacing", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "strikethrough", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Boolean)
], Text.prototype, "underline", void 0);
__decorate$a([
Property,
__metadata$a("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate$a([
Property,
__metadata$a("design:type", Number)
], Text.prototype, "truncateAt", void 0);
function text(config) {
const ret = new Text;
ret.layoutConfig = layoutConfig().fit();
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
return ret;
}
var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);