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

@@ -2910,6 +2910,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
*/
@@ -2984,89 +3067,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);
@@ -5164,7 +5164,7 @@ var doric_web = (function (exports, axios, sandbox) {
}());
});
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -5176,7 +5176,7 @@ var doric_web = (function (exports, axios, sandbox) {
const loaders = [
{
filter: () => true,
request: (source) => __awaiter(void 0, void 0, void 0, function* () {
request: (source) => __awaiter$1(void 0, void 0, void 0, function* () {
const result = yield axios__default['default'].get(source);
return result.data;
})
@@ -5186,7 +5186,7 @@ var doric_web = (function (exports, axios, sandbox) {
loaders.push(loader);
}
function loadDoricJSBundle(source) {
return __awaiter(this, void 0, void 0, function* () {
return __awaiter$1(this, void 0, void 0, function* () {
const matched = loaders.filter(e => e.filter(source));
if (matched.length > 0) {
return matched[matched.length - 1].request(source);
@@ -5203,6 +5203,7 @@ var doric_web = (function (exports, axios, sandbox) {
}
}
exports.LayoutSpec = void 0;
(function (LayoutSpec) {
LayoutSpec[LayoutSpec["EXACTLY"] = 0] = "EXACTLY";
LayoutSpec[LayoutSpec["WRAP_CONTENT"] = 1] = "WRAP_CONTENT";
@@ -7608,7 +7609,7 @@ ${content}
}
}
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -7622,7 +7623,7 @@ ${content}
smoothscroll.polyfill();
registerDoricJSLoader({
filter: (source) => source.startsWith("assets://"),
request: (source) => __awaiter$1(void 0, void 0, void 0, function* () {
request: (source) => __awaiter(void 0, void 0, void 0, function* () {
const ret = yield axios__default['default'].get(source.replace("assets://", `${window.location.href}/../../doric-demo/bundle/`));
return ret.data;
})
@@ -7655,6 +7656,8 @@ ${content}
exports.toPixelString = toPixelString;
exports.toRGBAString = toRGBAString;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}({}, axios, doric));

File diff suppressed because one or more lines are too long