Commit 245cfb8d authored by rockyl's avatar rockyl

修改了好多东西啊

parent d45fe6f0
......@@ -446,9 +446,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var RAD_TO_DEG = 180 / PI;
var DEG_TO_RAD = PI / 180;
(function (RENDERER_TYPE) {
RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN";
RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL";
RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS";
RENDERER_TYPE["UNKNOWN"] = "unknown";
RENDERER_TYPE["WEBGL"] = "webgl";
RENDERER_TYPE["CANVAS"] = "canvas";
})(exports.RENDERER_TYPE || (exports.RENDERER_TYPE = {}));
(function (SHAPES) {
SHAPES[SHAPES["POLY"] = 0] = "POLY";
......@@ -1701,10 +1701,13 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var ESCAPE_REG_EXP = /\$\{[\u4e00-\u9fa5_a-zA-Z0-9\|]+\}/g;
var linkedFlag = '$_linked_$';
var nodeScheme = 'node://';
function arrayFind(arr, callback) {
function arrayFind(arr, predicate) {
if (!arr) {
return;
}
for (var i = 0, li = arr.length; i < li; i++) {
var item = arr[i];
if (callback(item, i, arr)) {
if (predicate(item, i, arr)) {
return item;
}
}
......@@ -1869,11 +1872,51 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
el = document.createElement('div');
}
el.innerHTML = htmlText;
document.body.append(el);
document.body.appendChild(el);
var pureText = el.innerText;
document.body.removeChild(el);
return pureText;
}
var zhReg = /[\u4e00-\u9fa5]/;
function strLen(str) {
var len = 0;
for (var _i = 0, str_1 = str; _i < str_1.length; _i++) {
var char = str_1[_i];
len += char.match(zhReg) ? 2 : 1;
}
return len;
}
function strShort(str, limit, replace) {
if (replace === void 0) { replace = '…'; }
var result = '';
if (strLen(str) > limit) {
var len = 0;
for (var i = 0, li = str.length; i < li; i++) {
var char = str[i];
len += char.match(zhReg) ? 2 : 1;
if (len > limit) {
result += replace;
break;
}
else {
result += char;
}
}
}
else {
result = str;
}
return result;
}
function instantiateScript(node, ScriptConfig) {
var scriptName = ScriptConfig.script, props = ScriptConfig.props, disabled = ScriptConfig.disabled;
var script = node.scriptsProxy.add(scriptName, props, disabled);
}
function injectProperties(target, source) {
for (var key in source) {
propertyParse(key, target, source);
}
}
var rotateLeft = function (lValue, iShiftBits) {
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
......@@ -2119,8 +2162,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
scriptDefs[id] = def;
}
function registerScripts(scripts) {
for (var id in scripts) {
var code = scripts[id];
for (var _i = 0, scripts_1 = scripts; _i < scripts_1.length; _i++) {
var script = scripts_1[_i];
var id = script.id, code = script.code;
var def = importCJSCode(code);
registerScriptDef(id, def);
}
......@@ -2228,7 +2272,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return _this;
}
DataCenter.prototype.registerGroup = function (name, origin) {
this.store[name] = origin || {};
return this.store[name] = origin || {};
};
DataCenter.prototype.unregisterGroup = function (name) {
delete this.store[name];
......@@ -2286,7 +2330,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (dispatch === void 0) { dispatch = true; }
var group = this.getGroup(groupName);
if (!group) {
this.registerGroup(groupName);
group = this.registerGroup(groupName);
}
if (data !== undefined) {
if (path) {
......@@ -2347,9 +2391,28 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
var storeKey = 'zlog-switch';
(function (Logs) {
Logs["PROCESS"] = "process";
})(exports.Logs || (exports.Logs = {}));
var store;
try {
store = JSON.parse(localStorage.getItem(storeKey));
store = store === null ? false : store;
}
catch (e) {
store = false;
localStorage.setItem(storeKey, JSON.stringify(store));
}
function getLogSwitch(id) {
return typeof store === 'object' ? (!!store[id]) : !!store;
}
var log = getLogSwitch(exports.Logs.PROCESS);
var linkScheme = 'link://';
var Process = (function () {
function Process() {
function Process(id) {
this.id = id;
}
Object.defineProperty(Process.prototype, "processConfig", {
get: function () {
......@@ -2379,8 +2442,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this._config = sequence[id];
this._sequence = sequence;
this._target = target;
if (!this._originProps && this._config.props) {
this._originProps = objClone(this._config.props);
if (!this._config._originProps && this._config.props) {
this._config._originProps = objClone(this._config.props);
}
};
Process.prototype.execute = function (args) {
......@@ -2397,8 +2460,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
console.warn("meta [" + metaConfig + "] is not found");
return [2];
}
{
console.log("[" + this._vm.id + "] execute process [" + (this._config.alias || meta.name || meta.id) + "]");
if (log) {
console.log("[" + this._vm.id + ":" + this.id + "] execute [" + (this._config.alias || meta.name || meta.id) + "]");
}
if (!meta.isDivider) return [3, 6];
p = void 0;
......@@ -2452,11 +2515,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
result = {
type: type, payload: payload
};
if (!this._meta) return [3, 4];
if (!this._meta) return [3, 5];
metaConfig = this._meta;
if (!metaConfig) return [3, 3];
this.updateProps(this._config.props = {}, payload, this._originProps, this._meta.props);
if (!metaConfig.script) return [3, 2];
if (!metaConfig) return [3, 4];
this.updateProps(this._config.props = {}, payload, this._config._originProps, this._meta.props);
if (!metaConfig.script) return [3, 3];
func = void 0;
if (metaConfig.script.indexOf(linkScheme) === 0) {
func = this._vm.getScript(metaConfig.script.replace(linkScheme, ''));
......@@ -2464,20 +2527,26 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
else {
func = new Function('args', 'props', 'target', 'global', 'vm', warpAsyncScript(metaConfig.script));
}
if (!func) {
console.log();
}
if (!func) return [3, 2];
globalContext = this._vm.globalContext;
globalContext.dataCenter = globalContext.gameStage.dataCenter;
return [4, func(payload, this._config.props, this._target, globalContext, this._vm)];
case 1:
result = _a.sent();
_a.label = 2;
case 2: return [3, 4];
case 3:
if (log) {
console.log("[" + this._vm.id + ":" + this.id + "] output: <" + result.type + ">", result.payload ? JSON.stringify(result.payload) : '');
}
return [3, 3];
case 2:
if (log) {
console.log('script lose');
}
_a.label = 3;
case 3: return [3, 5];
case 4:
console.warn("process meta [" + meta + "] not found");
_a.label = 4;
case 4: return [2, result];
_a.label = 5;
case 5: return [2, result];
}
});
});
......@@ -2614,6 +2683,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var ID_INK = 0;
var VM = (function () {
function VM() {
this._pid = 0;
}
VM.prototype.setup = function (context) {
var processMetaLibs = context.processMetaLibs, globalContext = context.globalContext, target = context.target, scriptMap = context.scriptMap;
......@@ -2629,7 +2699,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
process = new Process();
process = new Process(this._pid++);
process.init({
sequence: sequence,
id: id,
......@@ -2672,6 +2742,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return VM;
}());
var log$1 = getLogSwitch(exports.Logs.PROCESS);
var processMetaLibs = [];
var globalContext = {};
var scriptMap = {};
......@@ -2682,9 +2753,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
for (var _a = 0, metaContexts_1 = metaContexts; _a < metaContexts_1.length; _a++) {
var context = metaContexts_1[_a];
if (context) {
processMetaLibs.push(context);
}
}
}
function setGlobalContext(context) {
globalContext = context;
for (var key in context) {
......@@ -2705,9 +2778,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
vm.executeProcess(sequence, subEntry, null, args)
.then(function (result) {
if (log$1) {
console.log("[" + vm.id + "] result:", result);
}
return result;
}, function (e) {
if (log$1) {
console.log("[" + vm.id + "] terminate:", e);
}
});
}
......@@ -2771,16 +2849,29 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this.applyScripts();
this.applyEvents();
};
ctor.prototype.clone = function () {
ctor.prototype.clone = function (withEvents, withScripts) {
if (withEvents === void 0) { withEvents = false; }
var target = this.constructor.apply(Object.create(this.constructor.prototype));
var originConfig = this.__originConfig;
target.name = originConfig.name;
for (var field in originConfig.properties) {
propertyParse(field, target, originConfig.properties);
var _a = this.__originConfig, name = _a.name, properties = _a.properties, events = _a.events, scripts = _a.scripts;
target.name = name;
injectProperties(target, properties);
if (withScripts) {
if (scripts && scripts.length > 0) {
for (var _i = 0, scripts_1 = scripts; _i < scripts_1.length; _i++) {
var scriptConfig = scripts_1[_i];
instantiateScript(target, scriptConfig);
}
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
var childCopy = child.clone();
}
}
if (withEvents) {
if (events) {
target.eventsProxy.eventsConfig = events;
}
target.eventsProxy.start();
}
for (var _b = 0, _c = this.children; _b < _c.length; _b++) {
var child = _c[_b];
var childCopy = child.clone(withEvents, withScripts);
target.addChild(childCopy);
}
return target;
......@@ -4191,6 +4282,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return undefined;
}
function sign(n) {
if (n === 0)
return 0;
return n < 0 ? -1 : 1;
}
function premultiplyTint(tint, alpha) {
if (alpha === 1.0) {
return (alpha * 255 << 24) + tint;
......@@ -4828,6 +4924,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this._textureTrimmedID = -1;
if (this._texture.valid)
this.uvs = this._texture._uvs.uvsFloat32;
if (this._width) {
this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;
}
if (this._height) {
this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;
}
var width = this._texture.orig.width;
var height = this._texture.orig.height;
this._localBoundsSelf.x = -width * this.anchorTexture.x;
......@@ -7345,7 +7447,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
d = displayList[i];
for (var j = 0; j < eLen; j++) {
if (!events[j]["_bpd"]) {
if (d.hasEventListener(events[j].type) && d.mouseEnabled) {
if (d.hasEventListener(events[j].type, false) && d.mouseEnabled) {
events[j].target = d;
events[j].currentTarget = displayList[eLen - 1];
lp = d.globalToLocal(cp, DisplayObject._bp);
......@@ -8805,7 +8907,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
enumerable: true,
configurable: true
});
Graphics.prototype.clone = function () {
Graphics.prototype.cloneSelf = function () {
var clone = new Graphics();
clone.renderable = this.renderable;
clone._fillStyle = this._fillStyle;
......@@ -10168,64 +10270,68 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return TextureCache[str] || null;
}
function httpRequest(callback, url, method, params, type) {
function httpRequest(url, method, params, type) {
if (method === void 0) { method = 'get'; }
if (type === void 0) { type = 'text'; }
if (type === "jsonp") {
jsonp(callback, url, params);
return jsonp(url, params);
}
else {
var _req_1;
return new Promise(function (resolve, reject) {
var _req;
if (window["XMLHttpRequest"]) {
_req_1 = new XMLHttpRequest();
_req = new XMLHttpRequest();
}
else if (window["ActiveXObject"]) {
_req_1 = new window["ActiveXObject"]();
_req = new window["ActiveXObject"]();
}
else {
console.log('no xhr');
}
if (_req_1 != null) {
if (_req != null) {
var isGet = method.toUpperCase() === 'GET';
var queryStr = obj2query(params);
if (isGet) {
url = urlJoin(url, queryStr);
}
_req_1.open(method, url, true);
_req.open(method, url, true);
if (!isGet) {
_req_1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
_req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
}
_req_1.responseType = type;
_req.responseType = type;
if (isGet) {
_req_1.send();
_req.send();
}
else {
_req_1.send(queryStr);
_req.send(queryStr);
}
_req_1.onreadystatechange = function () {
if (_req_1.readyState == 4 && _req_1.status == 200) {
callback && callback(true, _req_1.response);
_req.onreadystatechange = function () {
if (_req.readyState == 4 && _req.status == 200) {
resolve(_req.response);
}
};
_req_1.onerror = function (reason) {
callback && callback(false, reason);
_req.onerror = function (reason) {
reject(reason);
};
}
});
}
}
function jsonp(callback, url, params) {
function jsonp(url, params) {
return new Promise(function (resolve, reject) {
var src = urlJoin(url, obj2query(params));
var scriptEl = document.createElement('script');
scriptEl.src = src;
scriptEl.onload = function () {
callback && callback(true);
resolve();
document.body.removeChild(scriptEl);
};
scriptEl.onerror = function () {
callback && callback(false);
reject();
document.body.removeChild(scriptEl);
};
document.body.appendChild(scriptEl);
});
}
function urlJoin(url, query) {
if (query) {
......@@ -10238,82 +10344,100 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
function createTextureSheet(baseTexture, altaData) {
var frames = altaData;
var frameKeys = Object.keys(frames);
var frameIndex = 0;
while (frameIndex < frameKeys.length) {
var i = frameKeys[frameIndex];
var data = frames[i];
var frame = null;
var trim = null;
var orig = new Rectangle(0, 0, Math.floor(data.sw), Math.floor(data.sh));
if (data.ro) {
frame = new Rectangle(Math.floor(data.x), Math.floor(data.y), Math.floor(data.h), Math.floor(data.w));
}
else {
frame = new Rectangle(Math.floor(data.x), Math.floor(data.y), Math.floor(data.w), Math.floor(data.h));
}
if (data.ox || data.oy) {
trim = new Rectangle(Math.floor(data.ox), Math.floor(data.oy), Math.floor(data.w), Math.floor(data.h));
}
var texture = new Texture(baseTexture, frame, orig, trim, data.ro ? 2 : 0);
Texture.addToCache(texture, i);
frameIndex++;
}
}
var Loader = (function (_super) {
tslib_1.__extends(Loader, _super);
function Loader() {
var _this = _super.call(this) || this;
_this.caches = {};
_this._req = null;
_this.crossOrigin = true;
_this._instanceType = "Loader";
return _this;
}
Loader.prototype.loadSheet = function (callback, url) {
Loader.prototype.loadSheet = function (url) {
var _this = this;
var pngFile = url.substring(0, url.lastIndexOf('.')) + '.png';
this.loadImage(function (suc, data) {
if (suc) {
if (_this.caches[url]) {
callback(true, { json: _this.caches[url], img: data });
}
}
else {
callback(false, data);
}
}, pngFile);
this.loadJson(function (suc, data) {
if (suc) {
if (_this.caches[pngFile]) {
callback(true, { json: data, img: _this.caches[pngFile] });
}
}
else {
callback(false, data);
}
}, url);
var config;
return this.loadJson(url)
.then(function (json) {
var file = (config = json).file;
return _this.loadTexture(file);
})
.then(function (texture) {
createTextureSheet(texture.baseTexture, config.frames);
});
};
Loader.prototype.loadRaw = function (callback, url, type) {
Loader.prototype.loadRaw = function (url, uuid, type) {
var _this = this;
httpRequest(function (s, p) {
if (s) {
_this.cache(url, p);
var data = this.caches[uuid || url];
if (data) {
return Promise.resolve(data);
}
else {
return httpRequest(url, 'get', {}, type)
.then(function (data) {
_this.cache(uuid || url, data);
return data;
});
}
callback(s, p);
}, url, 'get', {}, type);
};
Loader.prototype.loadJson = function (callback, url) {
this.loadRaw(callback, url, 'json');
Loader.prototype.loadJson = function (url, uuid) {
return this.loadRaw(url, uuid, 'json');
};
Loader.prototype.loadText = function (callback, url) {
this.loadRaw(callback, url, 'text');
Loader.prototype.loadText = function (url, uuid) {
return this.loadRaw(url, uuid, 'text');
};
Loader.prototype.loadTexture = function (callback, url) {
Loader.prototype.loadImage = function (url, uuid) {
var _this = this;
this.loadImage(function (s, payload) {
if (s) {
_this.cache(url, payload);
callback(s, TextureCache[url] = Texture.from(payload));
return new Promise(function (resolve, reject) {
var img = _this.caches[uuid || url];
if (img) {
resolve(img);
}
else {
callback(s, payload);
}
}, url);
};
Loader.prototype.loadImage = function (callback, url, crossOrigin) {
if (crossOrigin === void 0) { crossOrigin = true; }
var self = this;
var img = new Image();
if (crossOrigin) {
img = new Image();
if (_this.crossOrigin) {
img.setAttribute('crossOrigin', 'anonymous');
}
img.onload = function (e) {
self.cache(url, img);
callback(true, img);
img.onload = function () {
_this.cache(uuid || url, img);
resolve(img);
};
img.onerror = function (e) {
callback(false, e);
reject(e);
};
img.src = url;
return img;
}
});
};
Loader.prototype.loadTexture = function (url, uuid) {
return this.loadImage(url)
.then(function (image) {
return TextureCache[uuid || url] = Texture.from(image);
});
};
Loader.prototype.cache = function (name, data) {
if (this.caches[name]) ;
......@@ -10821,7 +10945,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var s = this;
s.htmlElement.placeholder = text;
s.htmlElement.style.font = size + "px " + font;
s.htmlElement.style.color = color;
s.htmlElement.style.colorD = color;
s.htmlElement.style.textAlign = align;
s.border = showBorder;
if (s.inputType == 2) {
......@@ -10893,11 +11017,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
Object.defineProperty(InputText.prototype, "color", {
get: function () {
return this.htmlElement.style.color;
return this.htmlElement.style.colorD;
},
set: function (value) {
var ss = this.htmlElement.style;
ss.color = value;
ss.colorD = value;
},
enumerable: true,
configurable: true
......@@ -11009,7 +11133,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s.stage.rootDiv.insertBefore(s.htmlElement, s.stage.rootDiv.childNodes[0]);
}
s.htmlElement.style.font = s.size + "px " + this.font;
s.htmlElement.style.color = s.textColor;
s.htmlElement.style.colorD = s.textColor;
s.htmlElement.style.textAlign = s["_textWidth"] ? s.textAlign : exports.TEXT_ALIGN.LEFT;
s.htmlElement.style.width = s.width + "px";
s.text = "";
......@@ -11074,18 +11198,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return EditableText;
}(TextField));
var queue = [];
function registerScrollInstance(scrollContainer) {
while (queue.length > 0) {
var item = queue.shift();
if (scrollContainer) {
item.cancelScroll();
}
}
if (scrollContainer) {
queue.push(scrollContainer);
}
}
var ScrollContainer = (function (_super) {
tslib_1.__extends(ScrollContainer, _super);
function ScrollContainer(maxDistance, isFull) {
......@@ -11126,7 +11238,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s.stage.removeEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
s.stage.removeEventListener(MouseEvent.MOUSE_MOVE, s.onMouseEvent, s);
});
s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent, s);
s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent, s, false);
s.addEventListener(Event.ENTER_FRAME, function () {
var view = s.viewPort;
if (s.autoScroll)
......@@ -11248,6 +11360,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var s = this;
var view = s.viewPort;
if (e.type == MouseEvent.MOUSE_DOWN) {
e.stopPropagation();
if (!s.isStop) {
s.isStop = true;
}
......@@ -11262,7 +11375,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
s.speed = 0;
s.isMouseDownState = 1;
registerScrollInstance(this);
}
else if (e.type == MouseEvent.MOUSE_MOVE) {
if (s.isMouseDownState == 0)
......@@ -11311,7 +11423,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s.dispatchEvent(Event.ON_SCROLL_STOP);
}
s.isMouseDownState = 0;
registerScrollInstance();
}
};
ScrollContainer.prototype.scrollTo = function (dis, time) {
......@@ -11342,10 +11453,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var ScrollList = (function (_super) {
tslib_1.__extends(ScrollList, _super);
function ScrollList(itemClassName, itemWidth, itemHeight, vW, vH, isVertical, cols) {
if (isVertical === void 0) { isVertical = true; }
function ScrollList(itemClassName, itemWidth, itemHeight, cols) {
if (cols === void 0) { cols = 1; }
var _this = _super.call(this, vW, vH, 0, isVertical) || this;
var _this = _super.call(this) || this;
_this._items = null;
_this._isInit = 0;
_this.data = [];
......@@ -11431,8 +11541,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
};
ScrollList.prototype.updateViewRect = function (w, h, isVertical) {
_super.prototype.updateViewRect.call(this, w, h, isVertical);
ScrollList.prototype.updateViewRect = function () {
_super.prototype.updateViewRect.call(this);
var s = this;
if (s._itemRow && s._itemCol) {
s._updateViewRect();
......@@ -12203,6 +12313,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
'.json': 'Json',
'.svga': 'Svga',
'.sht': 'Sheet',
'': 'Raw',
};
function loadAssets(config, onProgress, onComplete) {
var total = config.length;
......@@ -12210,18 +12321,13 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var failedList = [];
return Promise.all(config.map(function (assetConfig) {
assetsConfig.push(assetConfig);
return new Promise(function (resolve) {
var loadFunc = loaderMapping[assetConfig.ext] || 'Raw';
globalLoader['load' + loadFunc](function (result, payload) {
if (result) {
var method = globalLoader['load' + loadFunc] || globalLoader.loadRaw;
return method.call(globalLoader, assetConfig.url, assetConfig.uuid).then(function (data) {
loaded++;
onProgress && onProgress(loaded, total);
}
else {
}, function (error) {
failedList.push(assetConfig.url);
}
resolve();
}, assetConfig.url);
});
})).then(function () {
if (loaded < total) {
......@@ -12232,145 +12338,2260 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
});
}
function getAssetByUUID(uuid) {
return assetsConfig.find(function (item) { return item.uuid === uuid; });
}
function getAssetByName(name) {
return assetsConfig.find(function (item) { return item.name === name; });
return arrayFind(assetsConfig, function (item) { return item.name === name; });
}
function fieldChanged(onModify) {
return function (target, key) {
var privateKey = '_' + key;
Object.defineProperty(target, key, {
enumerable: true,
get: function () {
return this[privateKey];
},
set: function (v) {
var oldValue = this[privateKey];
if (oldValue !== v) {
this[privateKey] = v;
onModify.apply(this, [v, key, oldValue]);
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
});
var colorName = {
"aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255],
"aquamarine": [127, 255, 212],
"azure": [240, 255, 255],
"beige": [245, 245, 220],
"bisque": [255, 228, 196],
"black": [0, 0, 0],
"blanchedalmond": [255, 235, 205],
"blue": [0, 0, 255],
"blueviolet": [138, 43, 226],
"brown": [165, 42, 42],
"burlywood": [222, 184, 135],
"cadetblue": [95, 158, 160],
"chartreuse": [127, 255, 0],
"chocolate": [210, 105, 30],
"coral": [255, 127, 80],
"cornflowerblue": [100, 149, 237],
"cornsilk": [255, 248, 220],
"crimson": [220, 20, 60],
"cyan": [0, 255, 255],
"darkblue": [0, 0, 139],
"darkcyan": [0, 139, 139],
"darkgoldenrod": [184, 134, 11],
"darkgray": [169, 169, 169],
"darkgreen": [0, 100, 0],
"darkgrey": [169, 169, 169],
"darkkhaki": [189, 183, 107],
"darkmagenta": [139, 0, 139],
"darkolivegreen": [85, 107, 47],
"darkorange": [255, 140, 0],
"darkorchid": [153, 50, 204],
"darkred": [139, 0, 0],
"darksalmon": [233, 150, 122],
"darkseagreen": [143, 188, 143],
"darkslateblue": [72, 61, 139],
"darkslategray": [47, 79, 79],
"darkslategrey": [47, 79, 79],
"darkturquoise": [0, 206, 209],
"darkviolet": [148, 0, 211],
"deeppink": [255, 20, 147],
"deepskyblue": [0, 191, 255],
"dimgray": [105, 105, 105],
"dimgrey": [105, 105, 105],
"dodgerblue": [30, 144, 255],
"firebrick": [178, 34, 34],
"floralwhite": [255, 250, 240],
"forestgreen": [34, 139, 34],
"fuchsia": [255, 0, 255],
"gainsboro": [220, 220, 220],
"ghostwhite": [248, 248, 255],
"gold": [255, 215, 0],
"goldenrod": [218, 165, 32],
"gray": [128, 128, 128],
"green": [0, 128, 0],
"greenyellow": [173, 255, 47],
"grey": [128, 128, 128],
"honeydew": [240, 255, 240],
"hotpink": [255, 105, 180],
"indianred": [205, 92, 92],
"indigo": [75, 0, 130],
"ivory": [255, 255, 240],
"khaki": [240, 230, 140],
"lavender": [230, 230, 250],
"lavenderblush": [255, 240, 245],
"lawngreen": [124, 252, 0],
"lemonchiffon": [255, 250, 205],
"lightblue": [173, 216, 230],
"lightcoral": [240, 128, 128],
"lightcyan": [224, 255, 255],
"lightgoldenrodyellow": [250, 250, 210],
"lightgray": [211, 211, 211],
"lightgreen": [144, 238, 144],
"lightgrey": [211, 211, 211],
"lightpink": [255, 182, 193],
"lightsalmon": [255, 160, 122],
"lightseagreen": [32, 178, 170],
"lightskyblue": [135, 206, 250],
"lightslategray": [119, 136, 153],
"lightslategrey": [119, 136, 153],
"lightsteelblue": [176, 196, 222],
"lightyellow": [255, 255, 224],
"lime": [0, 255, 0],
"limegreen": [50, 205, 50],
"linen": [250, 240, 230],
"magenta": [255, 0, 255],
"maroon": [128, 0, 0],
"mediumaquamarine": [102, 205, 170],
"mediumblue": [0, 0, 205],
"mediumorchid": [186, 85, 211],
"mediumpurple": [147, 112, 219],
"mediumseagreen": [60, 179, 113],
"mediumslateblue": [123, 104, 238],
"mediumspringgreen": [0, 250, 154],
"mediumturquoise": [72, 209, 204],
"mediumvioletred": [199, 21, 133],
"midnightblue": [25, 25, 112],
"mintcream": [245, 255, 250],
"mistyrose": [255, 228, 225],
"moccasin": [255, 228, 181],
"navajowhite": [255, 222, 173],
"navy": [0, 0, 128],
"oldlace": [253, 245, 230],
"olive": [128, 128, 0],
"olivedrab": [107, 142, 35],
"orange": [255, 165, 0],
"orangered": [255, 69, 0],
"orchid": [218, 112, 214],
"palegoldenrod": [238, 232, 170],
"palegreen": [152, 251, 152],
"paleturquoise": [175, 238, 238],
"palevioletred": [219, 112, 147],
"papayawhip": [255, 239, 213],
"peachpuff": [255, 218, 185],
"peru": [205, 133, 63],
"pink": [255, 192, 203],
"plum": [221, 160, 221],
"powderblue": [176, 224, 230],
"purple": [128, 0, 128],
"rebeccapurple": [102, 51, 153],
"red": [255, 0, 0],
"rosybrown": [188, 143, 143],
"royalblue": [65, 105, 225],
"saddlebrown": [139, 69, 19],
"salmon": [250, 128, 114],
"sandybrown": [244, 164, 96],
"seagreen": [46, 139, 87],
"seashell": [255, 245, 238],
"sienna": [160, 82, 45],
"silver": [192, 192, 192],
"skyblue": [135, 206, 235],
"slateblue": [106, 90, 205],
"slategray": [112, 128, 144],
"slategrey": [112, 128, 144],
"snow": [255, 250, 250],
"springgreen": [0, 255, 127],
"steelblue": [70, 130, 180],
"tan": [210, 180, 140],
"teal": [0, 128, 128],
"thistle": [216, 191, 216],
"tomato": [255, 99, 71],
"turquoise": [64, 224, 208],
"violet": [238, 130, 238],
"wheat": [245, 222, 179],
"white": [255, 255, 255],
"whitesmoke": [245, 245, 245],
"yellow": [255, 255, 0],
"yellowgreen": [154, 205, 50]
};
var isArrayish = function isArrayish(obj) {
if (!obj || typeof obj === 'string') {
return false;
}
var dirtyFieldDetector = fieldChanged(function (value, key, oldValue) {
this['__fieldDirty'] = true;
});
var deepDirtyFieldDetector = fieldChanged(function (value, key, oldValue) {
var scope = this;
scope['__fieldDirty'] = true;
if (typeof value === 'object') {
value['onModify'] = function () {
scope['__fieldDirty'] = true;
return obj instanceof Array || Array.isArray(obj) ||
(obj.length >= 0 && (obj.splice instanceof Function ||
(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
};
var simpleSwizzle = createCommonjsModule(function (module) {
var concat = Array.prototype.concat;
var slice = Array.prototype.slice;
var swizzle = module.exports = function swizzle(args) {
var results = [];
for (var i = 0, len = args.length; i < len; i++) {
var arg = args[i];
if (isArrayish(arg)) {
// http://jsperf.com/javascript-array-concat-vs-push/98
results = concat.call(results, slice.call(arg));
} else {
results.push(arg);
}
}
return results;
};
swizzle.wrap = function (fn) {
return function () {
return fn(swizzle(arguments));
};
};
});
var dirtyFieldTrigger = fieldChanged(function (value, key, oldValue) {
this['onModify'] && this['onModify'](value, key, oldValue);
});
var deepDirtyFieldTrigger = fieldChanged(function (value, key, oldValue) {
if (this['onModify']) {
this['onModify'](value, key, oldValue);
if (typeof value === 'object') {
value['onModify'] = this['onModify'];
var colorString = createCommonjsModule(function (module) {
/* MIT license */
var reverseNames = {};
// create a list of reverse color names
for (var name in colorName) {
if (colorName.hasOwnProperty(name)) {
reverseNames[colorName[name]] = name;
}
}
});
var ShapeBase = (function (_super) {
tslib_1.__extends(ShapeBase, _super);
function ShapeBase() {
var _this = _super.call(this) || this;
_this.__fieldDirty = true;
_this.fillColor = 'white';
_this.strokeColor = 0;
_this.strokeWidth = 0;
_this.addEventListener(Event.ENTER_FRAME, _this.onEnterFrame, _this);
_this.addEventListener(Event.RESIZE, _this.onResize, _this);
return _this;
var cs = module.exports = {
to: {},
get: {}
};
cs.get = function (string) {
var prefix = string.substring(0, 3).toLowerCase();
var val;
var model;
switch (prefix) {
case 'hsl':
val = cs.get.hsl(string);
model = 'hsl';
break;
case 'hwb':
val = cs.get.hwb(string);
model = 'hwb';
break;
default:
val = cs.get.rgb(string);
model = 'rgb';
break;
}
ShapeBase.prototype.onResize = function (e) {
this.__fieldDirty = true;
if (!val) {
return null;
}
return {model: model, value: val};
};
ShapeBase.prototype.onEnterFrame = function (e) {
if (this.__fieldDirty) {
this.__fieldDirty = false;
var _a = this, fillColor = _a.fillColor, strokeColor = _a.strokeColor, strokeWidth = _a.strokeWidth;
this.clear();
this.beginFill(fillColor);
if (strokeWidth > 0) {
this.beginStroke(strokeColor, strokeWidth);
cs.get.rgb = function (string) {
if (!string) {
return null;
}
this.redraw();
this.endFill();
if (strokeWidth > 0) {
this.endStroke();
var abbr = /^#([a-f0-9]{3,4})$/i;
var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
var rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
var keyword = /(\D+)/;
var rgb = [0, 0, 0, 1];
var match;
var i;
var hexAlpha;
if (match = string.match(hex)) {
hexAlpha = match[2];
match = match[1];
for (i = 0; i < 3; i++) {
// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
var i2 = i * 2;
rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
}
if (hexAlpha) {
rgb[3] = Math.round((parseInt(hexAlpha, 16) / 255) * 100) / 100;
}
};
ShapeBase.prototype.redraw = function () {
};
tslib_1.__decorate([
dirtyFieldDetector
], ShapeBase.prototype, "fillColor", void 0);
tslib_1.__decorate([
dirtyFieldDetector
], ShapeBase.prototype, "strokeColor", void 0);
tslib_1.__decorate([
dirtyFieldDetector
], ShapeBase.prototype, "strokeWidth", void 0);
return ShapeBase;
}(Shape));
var Rect = (function (_super) {
tslib_1.__extends(Rect, _super);
function Rect() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.borderRadius = 0;
return _this;
} else if (match = string.match(abbr)) {
match = match[1];
hexAlpha = match[3];
for (i = 0; i < 3; i++) {
rgb[i] = parseInt(match[i] + match[i], 16);
}
Rect.prototype.redraw = function () {
var _a = this, width = _a.width, height = _a.height, borderRadius = _a.borderRadius;
if (borderRadius > 0) {
this.drawRoundRect(0, 0, width, height, borderRadius, borderRadius, borderRadius, borderRadius);
if (hexAlpha) {
rgb[3] = Math.round((parseInt(hexAlpha + hexAlpha, 16) / 255) * 100) / 100;
}
else {
this.drawRect(0, 0, width, height);
} else if (match = string.match(rgba)) {
for (i = 0; i < 3; i++) {
rgb[i] = parseInt(match[i + 1], 0);
}
};
tslib_1.__decorate([
dirtyFieldDetector
], Rect.prototype, "borderRadius", void 0);
return Rect;
}(ShapeBase));
var Circle$1 = (function (_super) {
tslib_1.__extends(Circle, _super);
function Circle() {
return _super !== null && _super.apply(this, arguments) || this;
if (match[4]) {
rgb[3] = parseFloat(match[4]);
}
} else if (match = string.match(per)) {
for (i = 0; i < 3; i++) {
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
}
Circle.prototype.redraw = function () {
_super.prototype.redraw.call(this);
var _a = this, width = _a.width, height = _a.height;
var radius = Math.min(width, height) / 2;
this.drawCircle(radius, radius, radius);
};
return Circle;
}(ShapeBase));
var assetScheme = 'asset://';
var Image$1 = (function (_super) {
tslib_1.__extends(Image, _super);
function Image() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._escapes = [];
_this._registeredEvents = [];
return _this;
if (match[4]) {
rgb[3] = parseFloat(match[4]);
}
Object.defineProperty(Image.prototype, "source", {
get: function () {
} else if (match = string.match(keyword)) {
if (match[1] === 'transparent') {
return [0, 0, 0, 0];
}
rgb = colorName[match[1]];
if (!rgb) {
return null;
}
rgb[3] = 1;
return rgb;
} else {
return null;
}
for (i = 0; i < 3; i++) {
rgb[i] = clamp(rgb[i], 0, 255);
}
rgb[3] = clamp(rgb[3], 0, 1);
return rgb;
};
cs.get.hsl = function (string) {
if (!string) {
return null;
}
var hsl = /^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
var match = string.match(hsl);
if (match) {
var alpha = parseFloat(match[4]);
var h = (parseFloat(match[1]) + 360) % 360;
var s = clamp(parseFloat(match[2]), 0, 100);
var l = clamp(parseFloat(match[3]), 0, 100);
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h, s, l, a];
}
return null;
};
cs.get.hwb = function (string) {
if (!string) {
return null;
}
var hwb = /^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
var match = string.match(hwb);
if (match) {
var alpha = parseFloat(match[4]);
var h = ((parseFloat(match[1]) % 360) + 360) % 360;
var w = clamp(parseFloat(match[2]), 0, 100);
var b = clamp(parseFloat(match[3]), 0, 100);
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h, w, b, a];
}
return null;
};
cs.to.hex = function () {
var rgba = simpleSwizzle(arguments);
return (
'#' +
hexDouble(rgba[0]) +
hexDouble(rgba[1]) +
hexDouble(rgba[2]) +
(rgba[3] < 1
? (hexDouble(Math.round(rgba[3] * 255)))
: '')
);
};
cs.to.rgb = function () {
var rgba = simpleSwizzle(arguments);
return rgba.length < 4 || rgba[3] === 1
? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
};
cs.to.rgb.percent = function () {
var rgba = simpleSwizzle(arguments);
var r = Math.round(rgba[0] / 255 * 100);
var g = Math.round(rgba[1] / 255 * 100);
var b = Math.round(rgba[2] / 255 * 100);
return rgba.length < 4 || rgba[3] === 1
? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
: 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
};
cs.to.hsl = function () {
var hsla = simpleSwizzle(arguments);
return hsla.length < 4 || hsla[3] === 1
? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
};
// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
// (hwb have alpha optional & 1 is default value)
cs.to.hwb = function () {
var hwba = simpleSwizzle(arguments);
var a = '';
if (hwba.length >= 4 && hwba[3] !== 1) {
a = ', ' + hwba[3];
}
return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
};
cs.to.keyword = function (rgb) {
return reverseNames[rgb.slice(0, 3)];
};
// helpers
function clamp(num, min, max) {
return Math.min(Math.max(min, num), max);
}
function hexDouble(num) {
var str = num.toString(16).toUpperCase();
return (str.length < 2) ? '0' + str : str;
}
});
var colorString_1 = colorString.to;
var colorString_2 = colorString.get;
var colorName$1 = {
"aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255],
"aquamarine": [127, 255, 212],
"azure": [240, 255, 255],
"beige": [245, 245, 220],
"bisque": [255, 228, 196],
"black": [0, 0, 0],
"blanchedalmond": [255, 235, 205],
"blue": [0, 0, 255],
"blueviolet": [138, 43, 226],
"brown": [165, 42, 42],
"burlywood": [222, 184, 135],
"cadetblue": [95, 158, 160],
"chartreuse": [127, 255, 0],
"chocolate": [210, 105, 30],
"coral": [255, 127, 80],
"cornflowerblue": [100, 149, 237],
"cornsilk": [255, 248, 220],
"crimson": [220, 20, 60],
"cyan": [0, 255, 255],
"darkblue": [0, 0, 139],
"darkcyan": [0, 139, 139],
"darkgoldenrod": [184, 134, 11],
"darkgray": [169, 169, 169],
"darkgreen": [0, 100, 0],
"darkgrey": [169, 169, 169],
"darkkhaki": [189, 183, 107],
"darkmagenta": [139, 0, 139],
"darkolivegreen": [85, 107, 47],
"darkorange": [255, 140, 0],
"darkorchid": [153, 50, 204],
"darkred": [139, 0, 0],
"darksalmon": [233, 150, 122],
"darkseagreen": [143, 188, 143],
"darkslateblue": [72, 61, 139],
"darkslategray": [47, 79, 79],
"darkslategrey": [47, 79, 79],
"darkturquoise": [0, 206, 209],
"darkviolet": [148, 0, 211],
"deeppink": [255, 20, 147],
"deepskyblue": [0, 191, 255],
"dimgray": [105, 105, 105],
"dimgrey": [105, 105, 105],
"dodgerblue": [30, 144, 255],
"firebrick": [178, 34, 34],
"floralwhite": [255, 250, 240],
"forestgreen": [34, 139, 34],
"fuchsia": [255, 0, 255],
"gainsboro": [220, 220, 220],
"ghostwhite": [248, 248, 255],
"gold": [255, 215, 0],
"goldenrod": [218, 165, 32],
"gray": [128, 128, 128],
"green": [0, 128, 0],
"greenyellow": [173, 255, 47],
"grey": [128, 128, 128],
"honeydew": [240, 255, 240],
"hotpink": [255, 105, 180],
"indianred": [205, 92, 92],
"indigo": [75, 0, 130],
"ivory": [255, 255, 240],
"khaki": [240, 230, 140],
"lavender": [230, 230, 250],
"lavenderblush": [255, 240, 245],
"lawngreen": [124, 252, 0],
"lemonchiffon": [255, 250, 205],
"lightblue": [173, 216, 230],
"lightcoral": [240, 128, 128],
"lightcyan": [224, 255, 255],
"lightgoldenrodyellow": [250, 250, 210],
"lightgray": [211, 211, 211],
"lightgreen": [144, 238, 144],
"lightgrey": [211, 211, 211],
"lightpink": [255, 182, 193],
"lightsalmon": [255, 160, 122],
"lightseagreen": [32, 178, 170],
"lightskyblue": [135, 206, 250],
"lightslategray": [119, 136, 153],
"lightslategrey": [119, 136, 153],
"lightsteelblue": [176, 196, 222],
"lightyellow": [255, 255, 224],
"lime": [0, 255, 0],
"limegreen": [50, 205, 50],
"linen": [250, 240, 230],
"magenta": [255, 0, 255],
"maroon": [128, 0, 0],
"mediumaquamarine": [102, 205, 170],
"mediumblue": [0, 0, 205],
"mediumorchid": [186, 85, 211],
"mediumpurple": [147, 112, 219],
"mediumseagreen": [60, 179, 113],
"mediumslateblue": [123, 104, 238],
"mediumspringgreen": [0, 250, 154],
"mediumturquoise": [72, 209, 204],
"mediumvioletred": [199, 21, 133],
"midnightblue": [25, 25, 112],
"mintcream": [245, 255, 250],
"mistyrose": [255, 228, 225],
"moccasin": [255, 228, 181],
"navajowhite": [255, 222, 173],
"navy": [0, 0, 128],
"oldlace": [253, 245, 230],
"olive": [128, 128, 0],
"olivedrab": [107, 142, 35],
"orange": [255, 165, 0],
"orangered": [255, 69, 0],
"orchid": [218, 112, 214],
"palegoldenrod": [238, 232, 170],
"palegreen": [152, 251, 152],
"paleturquoise": [175, 238, 238],
"palevioletred": [219, 112, 147],
"papayawhip": [255, 239, 213],
"peachpuff": [255, 218, 185],
"peru": [205, 133, 63],
"pink": [255, 192, 203],
"plum": [221, 160, 221],
"powderblue": [176, 224, 230],
"purple": [128, 0, 128],
"rebeccapurple": [102, 51, 153],
"red": [255, 0, 0],
"rosybrown": [188, 143, 143],
"royalblue": [65, 105, 225],
"saddlebrown": [139, 69, 19],
"salmon": [250, 128, 114],
"sandybrown": [244, 164, 96],
"seagreen": [46, 139, 87],
"seashell": [255, 245, 238],
"sienna": [160, 82, 45],
"silver": [192, 192, 192],
"skyblue": [135, 206, 235],
"slateblue": [106, 90, 205],
"slategray": [112, 128, 144],
"slategrey": [112, 128, 144],
"snow": [255, 250, 250],
"springgreen": [0, 255, 127],
"steelblue": [70, 130, 180],
"tan": [210, 180, 140],
"teal": [0, 128, 128],
"thistle": [216, 191, 216],
"tomato": [255, 99, 71],
"turquoise": [64, 224, 208],
"violet": [238, 130, 238],
"wheat": [245, 222, 179],
"white": [255, 255, 255],
"whitesmoke": [245, 245, 245],
"yellow": [255, 255, 0],
"yellowgreen": [154, 205, 50]
};
var conversions = createCommonjsModule(function (module) {
/* MIT license */
// NOTE: conversions should only return primitive values (i.e. arrays, or
// values that give correct `typeof` results).
// do not use box values types (i.e. Number(), String(), etc.)
var reverseKeywords = {};
for (var key in colorName$1) {
if (colorName$1.hasOwnProperty(key)) {
reverseKeywords[colorName$1[key]] = key;
}
}
var convert = module.exports = {
rgb: {channels: 3, labels: 'rgb'},
hsl: {channels: 3, labels: 'hsl'},
hsv: {channels: 3, labels: 'hsv'},
hwb: {channels: 3, labels: 'hwb'},
cmyk: {channels: 4, labels: 'cmyk'},
xyz: {channels: 3, labels: 'xyz'},
lab: {channels: 3, labels: 'lab'},
lch: {channels: 3, labels: 'lch'},
hex: {channels: 1, labels: ['hex']},
keyword: {channels: 1, labels: ['keyword']},
ansi16: {channels: 1, labels: ['ansi16']},
ansi256: {channels: 1, labels: ['ansi256']},
hcg: {channels: 3, labels: ['h', 'c', 'g']},
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
gray: {channels: 1, labels: ['gray']}
};
// hide .channels and .labels properties
for (var model in convert) {
if (convert.hasOwnProperty(model)) {
if (!('channels' in convert[model])) {
throw new Error('missing channels property: ' + model);
}
if (!('labels' in convert[model])) {
throw new Error('missing channel labels property: ' + model);
}
if (convert[model].labels.length !== convert[model].channels) {
throw new Error('channel and label counts mismatch: ' + model);
}
var channels = convert[model].channels;
var labels = convert[model].labels;
delete convert[model].channels;
delete convert[model].labels;
Object.defineProperty(convert[model], 'channels', {value: channels});
Object.defineProperty(convert[model], 'labels', {value: labels});
}
}
convert.rgb.hsl = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var min = Math.min(r, g, b);
var max = Math.max(r, g, b);
var delta = max - min;
var h;
var s;
var l;
if (max === min) {
h = 0;
} else if (r === max) {
h = (g - b) / delta;
} else if (g === max) {
h = 2 + (b - r) / delta;
} else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) {
h += 360;
}
l = (min + max) / 2;
if (max === min) {
s = 0;
} else if (l <= 0.5) {
s = delta / (max + min);
} else {
s = delta / (2 - max - min);
}
return [h, s * 100, l * 100];
};
convert.rgb.hsv = function (rgb) {
var rdif;
var gdif;
var bdif;
var h;
var s;
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var v = Math.max(r, g, b);
var diff = v - Math.min(r, g, b);
var diffc = function (c) {
return (v - c) / 6 / diff + 1 / 2;
};
if (diff === 0) {
h = s = 0;
} else {
s = diff / v;
rdif = diffc(r);
gdif = diffc(g);
bdif = diffc(b);
if (r === v) {
h = bdif - gdif;
} else if (g === v) {
h = (1 / 3) + rdif - bdif;
} else if (b === v) {
h = (2 / 3) + gdif - rdif;
}
if (h < 0) {
h += 1;
} else if (h > 1) {
h -= 1;
}
}
return [
h * 360,
s * 100,
v * 100
];
};
convert.rgb.hwb = function (rgb) {
var r = rgb[0];
var g = rgb[1];
var b = rgb[2];
var h = convert.rgb.hsl(rgb)[0];
var w = 1 / 255 * Math.min(r, Math.min(g, b));
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
return [h, w * 100, b * 100];
};
convert.rgb.cmyk = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var c;
var m;
var y;
var k;
k = Math.min(1 - r, 1 - g, 1 - b);
c = (1 - r - k) / (1 - k) || 0;
m = (1 - g - k) / (1 - k) || 0;
y = (1 - b - k) / (1 - k) || 0;
return [c * 100, m * 100, y * 100, k * 100];
};
/**
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
* */
function comparativeDistance(x, y) {
return (
Math.pow(x[0] - y[0], 2) +
Math.pow(x[1] - y[1], 2) +
Math.pow(x[2] - y[2], 2)
);
}
convert.rgb.keyword = function (rgb) {
var reversed = reverseKeywords[rgb];
if (reversed) {
return reversed;
}
var currentClosestDistance = Infinity;
var currentClosestKeyword;
for (var keyword in colorName$1) {
if (colorName$1.hasOwnProperty(keyword)) {
var value = colorName$1[keyword];
// Compute comparative distance
var distance = comparativeDistance(rgb, value);
// Check if its less, if so set as closest
if (distance < currentClosestDistance) {
currentClosestDistance = distance;
currentClosestKeyword = keyword;
}
}
}
return currentClosestKeyword;
};
convert.keyword.rgb = function (keyword) {
return colorName$1[keyword];
};
convert.rgb.xyz = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
// assume sRGB
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
return [x * 100, y * 100, z * 100];
};
convert.rgb.lab = function (rgb) {
var xyz = convert.rgb.xyz(rgb);
var x = xyz[0];
var y = xyz[1];
var z = xyz[2];
var l;
var a;
var b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
l = (116 * y) - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};
convert.hsl.rgb = function (hsl) {
var h = hsl[0] / 360;
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var t1;
var t2;
var t3;
var rgb;
var val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5) {
t2 = l * (1 + s);
} else {
t2 = l + s - l * s;
}
t1 = 2 * l - t2;
rgb = [0, 0, 0];
for (var i = 0; i < 3; i++) {
t3 = h + 1 / 3 * -(i - 1);
if (t3 < 0) {
t3++;
}
if (t3 > 1) {
t3--;
}
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
} else if (2 * t3 < 1) {
val = t2;
} else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
} else {
val = t1;
}
rgb[i] = val * 255;
}
return rgb;
};
convert.hsl.hsv = function (hsl) {
var h = hsl[0];
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var smin = s;
var lmin = Math.max(l, 0.01);
var sv;
var v;
l *= 2;
s *= (l <= 1) ? l : 2 - l;
smin *= lmin <= 1 ? lmin : 2 - lmin;
v = (l + s) / 2;
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
return [h, sv * 100, v * 100];
};
convert.hsv.rgb = function (hsv) {
var h = hsv[0] / 60;
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var hi = Math.floor(h) % 6;
var f = h - Math.floor(h);
var p = 255 * v * (1 - s);
var q = 255 * v * (1 - (s * f));
var t = 255 * v * (1 - (s * (1 - f)));
v *= 255;
switch (hi) {
case 0:
return [v, t, p];
case 1:
return [q, v, p];
case 2:
return [p, v, t];
case 3:
return [p, q, v];
case 4:
return [t, p, v];
case 5:
return [v, p, q];
}
};
convert.hsv.hsl = function (hsv) {
var h = hsv[0];
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var vmin = Math.max(v, 0.01);
var lmin;
var sl;
var l;
l = (2 - s) * v;
lmin = (2 - s) * vmin;
sl = s * vmin;
sl /= (lmin <= 1) ? lmin : 2 - lmin;
sl = sl || 0;
l /= 2;
return [h, sl * 100, l * 100];
};
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
convert.hwb.rgb = function (hwb) {
var h = hwb[0] / 360;
var wh = hwb[1] / 100;
var bl = hwb[2] / 100;
var ratio = wh + bl;
var i;
var v;
var f;
var n;
// wh + bl cant be > 1
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
i = Math.floor(6 * h);
v = 1 - bl;
f = 6 * h - i;
if ((i & 0x01) !== 0) {
f = 1 - f;
}
n = wh + f * (v - wh); // linear interpolation
var r;
var g;
var b;
switch (i) {
default:
case 6:
case 0: r = v; g = n; b = wh; break;
case 1: r = n; g = v; b = wh; break;
case 2: r = wh; g = v; b = n; break;
case 3: r = wh; g = n; b = v; break;
case 4: r = n; g = wh; b = v; break;
case 5: r = v; g = wh; b = n; break;
}
return [r * 255, g * 255, b * 255];
};
convert.cmyk.rgb = function (cmyk) {
var c = cmyk[0] / 100;
var m = cmyk[1] / 100;
var y = cmyk[2] / 100;
var k = cmyk[3] / 100;
var r;
var g;
var b;
r = 1 - Math.min(1, c * (1 - k) + k);
g = 1 - Math.min(1, m * (1 - k) + k);
b = 1 - Math.min(1, y * (1 - k) + k);
return [r * 255, g * 255, b * 255];
};
convert.xyz.rgb = function (xyz) {
var x = xyz[0] / 100;
var y = xyz[1] / 100;
var z = xyz[2] / 100;
var r;
var g;
var b;
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
// assume sRGB
r = r > 0.0031308
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
: r * 12.92;
g = g > 0.0031308
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
: g * 12.92;
b = b > 0.0031308
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
: b * 12.92;
r = Math.min(Math.max(0, r), 1);
g = Math.min(Math.max(0, g), 1);
b = Math.min(Math.max(0, b), 1);
return [r * 255, g * 255, b * 255];
};
convert.xyz.lab = function (xyz) {
var x = xyz[0];
var y = xyz[1];
var z = xyz[2];
var l;
var a;
var b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
l = (116 * y) - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};
convert.lab.xyz = function (lab) {
var l = lab[0];
var a = lab[1];
var b = lab[2];
var x;
var y;
var z;
y = (l + 16) / 116;
x = a / 500 + y;
z = y - b / 200;
var y2 = Math.pow(y, 3);
var x2 = Math.pow(x, 3);
var z2 = Math.pow(z, 3);
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
x *= 95.047;
y *= 100;
z *= 108.883;
return [x, y, z];
};
convert.lab.lch = function (lab) {
var l = lab[0];
var a = lab[1];
var b = lab[2];
var hr;
var h;
var c;
hr = Math.atan2(b, a);
h = hr * 360 / 2 / Math.PI;
if (h < 0) {
h += 360;
}
c = Math.sqrt(a * a + b * b);
return [l, c, h];
};
convert.lch.lab = function (lch) {
var l = lch[0];
var c = lch[1];
var h = lch[2];
var a;
var b;
var hr;
hr = h / 360 * 2 * Math.PI;
a = c * Math.cos(hr);
b = c * Math.sin(hr);
return [l, a, b];
};
convert.rgb.ansi16 = function (args) {
var r = args[0];
var g = args[1];
var b = args[2];
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
value = Math.round(value / 50);
if (value === 0) {
return 30;
}
var ansi = 30
+ ((Math.round(b / 255) << 2)
| (Math.round(g / 255) << 1)
| Math.round(r / 255));
if (value === 2) {
ansi += 60;
}
return ansi;
};
convert.hsv.ansi16 = function (args) {
// optimization here; we already know the value and don't need to get
// it converted for us.
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
};
convert.rgb.ansi256 = function (args) {
var r = args[0];
var g = args[1];
var b = args[2];
// we use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r === g && g === b) {
if (r < 8) {
return 16;
}
if (r > 248) {
return 231;
}
return Math.round(((r - 8) / 247) * 24) + 232;
}
var ansi = 16
+ (36 * Math.round(r / 255 * 5))
+ (6 * Math.round(g / 255 * 5))
+ Math.round(b / 255 * 5);
return ansi;
};
convert.ansi16.rgb = function (args) {
var color = args % 10;
// handle greyscale
if (color === 0 || color === 7) {
if (args > 50) {
color += 3.5;
}
color = color / 10.5 * 255;
return [color, color, color];
}
var mult = (~~(args > 50) + 1) * 0.5;
var r = ((color & 1) * mult) * 255;
var g = (((color >> 1) & 1) * mult) * 255;
var b = (((color >> 2) & 1) * mult) * 255;
return [r, g, b];
};
convert.ansi256.rgb = function (args) {
// handle greyscale
if (args >= 232) {
var c = (args - 232) * 10 + 8;
return [c, c, c];
}
args -= 16;
var rem;
var r = Math.floor(args / 36) / 5 * 255;
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
var b = (rem % 6) / 5 * 255;
return [r, g, b];
};
convert.rgb.hex = function (args) {
var integer = ((Math.round(args[0]) & 0xFF) << 16)
+ ((Math.round(args[1]) & 0xFF) << 8)
+ (Math.round(args[2]) & 0xFF);
var string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.hex.rgb = function (args) {
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) {
return [0, 0, 0];
}
var colorString = match[0];
if (match[0].length === 3) {
colorString = colorString.split('').map(function (char) {
return char + char;
}).join('');
}
var integer = parseInt(colorString, 16);
var r = (integer >> 16) & 0xFF;
var g = (integer >> 8) & 0xFF;
var b = integer & 0xFF;
return [r, g, b];
};
convert.rgb.hcg = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var max = Math.max(Math.max(r, g), b);
var min = Math.min(Math.min(r, g), b);
var chroma = (max - min);
var grayscale;
var hue;
if (chroma < 1) {
grayscale = min / (1 - chroma);
} else {
grayscale = 0;
}
if (chroma <= 0) {
hue = 0;
} else
if (max === r) {
hue = ((g - b) / chroma) % 6;
} else
if (max === g) {
hue = 2 + (b - r) / chroma;
} else {
hue = 4 + (r - g) / chroma + 4;
}
hue /= 6;
hue %= 1;
return [hue * 360, chroma * 100, grayscale * 100];
};
convert.hsl.hcg = function (hsl) {
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var c = 1;
var f = 0;
if (l < 0.5) {
c = 2.0 * s * l;
} else {
c = 2.0 * s * (1.0 - l);
}
if (c < 1.0) {
f = (l - 0.5 * c) / (1.0 - c);
}
return [hsl[0], c * 100, f * 100];
};
convert.hsv.hcg = function (hsv) {
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var c = s * v;
var f = 0;
if (c < 1.0) {
f = (v - c) / (1 - c);
}
return [hsv[0], c * 100, f * 100];
};
convert.hcg.rgb = function (hcg) {
var h = hcg[0] / 360;
var c = hcg[1] / 100;
var g = hcg[2] / 100;
if (c === 0.0) {
return [g * 255, g * 255, g * 255];
}
var pure = [0, 0, 0];
var hi = (h % 1) * 6;
var v = hi % 1;
var w = 1 - v;
var mg = 0;
switch (Math.floor(hi)) {
case 0:
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
case 1:
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
case 2:
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
case 3:
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
case 4:
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
default:
pure[0] = 1; pure[1] = 0; pure[2] = w;
}
mg = (1.0 - c) * g;
return [
(c * pure[0] + mg) * 255,
(c * pure[1] + mg) * 255,
(c * pure[2] + mg) * 255
];
};
convert.hcg.hsv = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var v = c + g * (1.0 - c);
var f = 0;
if (v > 0.0) {
f = c / v;
}
return [hcg[0], f * 100, v * 100];
};
convert.hcg.hsl = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var l = g * (1.0 - c) + 0.5 * c;
var s = 0;
if (l > 0.0 && l < 0.5) {
s = c / (2 * l);
} else
if (l >= 0.5 && l < 1.0) {
s = c / (2 * (1 - l));
}
return [hcg[0], s * 100, l * 100];
};
convert.hcg.hwb = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var v = c + g * (1.0 - c);
return [hcg[0], (v - c) * 100, (1 - v) * 100];
};
convert.hwb.hcg = function (hwb) {
var w = hwb[1] / 100;
var b = hwb[2] / 100;
var v = 1 - b;
var c = v - w;
var g = 0;
if (c < 1) {
g = (v - c) / (1 - c);
}
return [hwb[0], c * 100, g * 100];
};
convert.apple.rgb = function (apple) {
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
};
convert.rgb.apple = function (rgb) {
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
};
convert.gray.rgb = function (args) {
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
};
convert.gray.hsl = convert.gray.hsv = function (args) {
return [0, 0, args[0]];
};
convert.gray.hwb = function (gray) {
return [0, 100, gray[0]];
};
convert.gray.cmyk = function (gray) {
return [0, 0, 0, gray[0]];
};
convert.gray.lab = function (gray) {
return [gray[0], 0, 0];
};
convert.gray.hex = function (gray) {
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
var integer = (val << 16) + (val << 8) + val;
var string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.rgb.gray = function (rgb) {
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
return [val / 255 * 100];
};
});
var conversions_1 = conversions.rgb;
var conversions_2 = conversions.hsl;
var conversions_3 = conversions.hsv;
var conversions_4 = conversions.hwb;
var conversions_5 = conversions.cmyk;
var conversions_6 = conversions.xyz;
var conversions_7 = conversions.lab;
var conversions_8 = conversions.lch;
var conversions_9 = conversions.hex;
var conversions_10 = conversions.keyword;
var conversions_11 = conversions.ansi16;
var conversions_12 = conversions.ansi256;
var conversions_13 = conversions.hcg;
var conversions_14 = conversions.apple;
var conversions_15 = conversions.gray;
/*
this function routes a model to all other models.
all functions that are routed have a property `.conversion` attached
to the returned synthetic function. This property is an array
of strings, each with the steps in between the 'from' and 'to'
color models (inclusive).
conversions that are not possible simply are not included.
*/
function buildGraph() {
var graph = {};
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
var models = Object.keys(conversions);
for (var len = models.length, i = 0; i < len; i++) {
graph[models[i]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
distance: -1,
parent: null
};
}
return graph;
}
// https://en.wikipedia.org/wiki/Breadth-first_search
function deriveBFS(fromModel) {
var graph = buildGraph();
var queue = [fromModel]; // unshift -> queue -> pop
graph[fromModel].distance = 0;
while (queue.length) {
var current = queue.pop();
var adjacents = Object.keys(conversions[current]);
for (var len = adjacents.length, i = 0; i < len; i++) {
var adjacent = adjacents[i];
var node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
node.parent = current;
queue.unshift(adjacent);
}
}
}
return graph;
}
function link(from, to) {
return function (args) {
return to(from(args));
};
}
function wrapConversion(toModel, graph) {
var path = [graph[toModel].parent, toModel];
var fn = conversions[graph[toModel].parent][toModel];
var cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn = link(conversions[graph[cur].parent][cur], fn);
cur = graph[cur].parent;
}
fn.conversion = path;
return fn;
}
var route = function (fromModel) {
var graph = deriveBFS(fromModel);
var conversion = {};
var models = Object.keys(graph);
for (var len = models.length, i = 0; i < len; i++) {
var toModel = models[i];
var node = graph[toModel];
if (node.parent === null) {
// no possible conversion, or this node is the source model.
continue;
}
conversion[toModel] = wrapConversion(toModel, graph);
}
return conversion;
};
var convert = {};
var models = Object.keys(conversions);
function wrapRaw(fn) {
var wrappedFn = function (args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
return fn(args);
};
// preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
function wrapRounded(fn) {
var wrappedFn = function (args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
var result = fn(args);
// we're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (var len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
};
// preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
models.forEach(function (fromModel) {
convert[fromModel] = {};
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
var routes = route(fromModel);
var routeModels = Object.keys(routes);
routeModels.forEach(function (toModel) {
var fn = routes[toModel];
convert[fromModel][toModel] = wrapRounded(fn);
convert[fromModel][toModel].raw = wrapRaw(fn);
});
});
var colorConvert = convert;
var _slice = [].slice;
var skippedModels = [
// to be honest, I don't really feel like keyword belongs in color convert, but eh.
'keyword',
// gray conflicts with some method names, and has its own method defined.
'gray',
// shouldn't really be in color-convert either...
'hex'
];
var hashedModelKeys = {};
Object.keys(colorConvert).forEach(function (model) {
hashedModelKeys[_slice.call(colorConvert[model].labels).sort().join('')] = model;
});
var limiters = {};
function Color(obj, model) {
if (!(this instanceof Color)) {
return new Color(obj, model);
}
if (model && model in skippedModels) {
model = null;
}
if (model && !(model in colorConvert)) {
throw new Error('Unknown model: ' + model);
}
var i;
var channels;
if (obj == null) { // eslint-disable-line no-eq-null,eqeqeq
this.model = 'rgb';
this.color = [0, 0, 0];
this.valpha = 1;
} else if (obj instanceof Color) {
this.model = obj.model;
this.color = obj.color.slice();
this.valpha = obj.valpha;
} else if (typeof obj === 'string') {
var result = colorString.get(obj);
if (result === null) {
throw new Error('Unable to parse color from string: ' + obj);
}
this.model = result.model;
channels = colorConvert[this.model].channels;
this.color = result.value.slice(0, channels);
this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
} else if (obj.length) {
this.model = model || 'rgb';
channels = colorConvert[this.model].channels;
var newArr = _slice.call(obj, 0, channels);
this.color = zeroArray(newArr, channels);
this.valpha = typeof obj[channels] === 'number' ? obj[channels] : 1;
} else if (typeof obj === 'number') {
// this is always RGB - can be converted later on.
obj &= 0xFFFFFF;
this.model = 'rgb';
this.color = [
(obj >> 16) & 0xFF,
(obj >> 8) & 0xFF,
obj & 0xFF
];
this.valpha = 1;
} else {
this.valpha = 1;
var keys = Object.keys(obj);
if ('alpha' in obj) {
keys.splice(keys.indexOf('alpha'), 1);
this.valpha = typeof obj.alpha === 'number' ? obj.alpha : 0;
}
var hashedKeys = keys.sort().join('');
if (!(hashedKeys in hashedModelKeys)) {
throw new Error('Unable to parse color from object: ' + JSON.stringify(obj));
}
this.model = hashedModelKeys[hashedKeys];
var labels = colorConvert[this.model].labels;
var color = [];
for (i = 0; i < labels.length; i++) {
color.push(obj[labels[i]]);
}
this.color = zeroArray(color);
}
// perform limitations (clamping, etc.)
if (limiters[this.model]) {
channels = colorConvert[this.model].channels;
for (i = 0; i < channels; i++) {
var limit = limiters[this.model][i];
if (limit) {
this.color[i] = limit(this.color[i]);
}
}
}
this.valpha = Math.max(0, Math.min(1, this.valpha));
if (Object.freeze) {
Object.freeze(this);
}
}
Color.prototype = {
toString: function () {
return this.string();
},
toJSON: function () {
return this[this.model]();
},
string: function (places) {
var self = this.model in colorString.to ? this : this.rgb();
self = self.round(typeof places === 'number' ? places : 1);
var args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
return colorString.to[self.model](args);
},
percentString: function (places) {
var self = this.rgb().round(typeof places === 'number' ? places : 1);
var args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
return colorString.to.rgb.percent(args);
},
array: function () {
return this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);
},
object: function () {
var result = {};
var channels = colorConvert[this.model].channels;
var labels = colorConvert[this.model].labels;
for (var i = 0; i < channels; i++) {
result[labels[i]] = this.color[i];
}
if (this.valpha !== 1) {
result.alpha = this.valpha;
}
return result;
},
unitArray: function () {
var rgb = this.rgb().color;
rgb[0] /= 255;
rgb[1] /= 255;
rgb[2] /= 255;
if (this.valpha !== 1) {
rgb.push(this.valpha);
}
return rgb;
},
unitObject: function () {
var rgb = this.rgb().object();
rgb.r /= 255;
rgb.g /= 255;
rgb.b /= 255;
if (this.valpha !== 1) {
rgb.alpha = this.valpha;
}
return rgb;
},
round: function (places) {
places = Math.max(places || 0, 0);
return new Color(this.color.map(roundToPlace(places)).concat(this.valpha), this.model);
},
alpha: function (val) {
if (arguments.length) {
return new Color(this.color.concat(Math.max(0, Math.min(1, val))), this.model);
}
return this.valpha;
},
// rgb
red: getset('rgb', 0, maxfn(255)),
green: getset('rgb', 1, maxfn(255)),
blue: getset('rgb', 2, maxfn(255)),
hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, function (val) { return ((val % 360) + 360) % 360; }), // eslint-disable-line brace-style
saturationl: getset('hsl', 1, maxfn(100)),
lightness: getset('hsl', 2, maxfn(100)),
saturationv: getset('hsv', 1, maxfn(100)),
value: getset('hsv', 2, maxfn(100)),
chroma: getset('hcg', 1, maxfn(100)),
gray: getset('hcg', 2, maxfn(100)),
white: getset('hwb', 1, maxfn(100)),
wblack: getset('hwb', 2, maxfn(100)),
cyan: getset('cmyk', 0, maxfn(100)),
magenta: getset('cmyk', 1, maxfn(100)),
yellow: getset('cmyk', 2, maxfn(100)),
black: getset('cmyk', 3, maxfn(100)),
x: getset('xyz', 0, maxfn(100)),
y: getset('xyz', 1, maxfn(100)),
z: getset('xyz', 2, maxfn(100)),
l: getset('lab', 0, maxfn(100)),
a: getset('lab', 1),
b: getset('lab', 2),
keyword: function (val) {
if (arguments.length) {
return new Color(val);
}
return colorConvert[this.model].keyword(this.color);
},
hex: function (val) {
if (arguments.length) {
return new Color(val);
}
return colorString.to.hex(this.rgb().round().color);
},
rgbNumber: function () {
var rgb = this.rgb().color;
return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
},
luminosity: function () {
// http://www.w3.org/TR/WCAG20/#relativeluminancedef
var rgb = this.rgb().color;
var lum = [];
for (var i = 0; i < rgb.length; i++) {
var chan = rgb[i] / 255;
lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
}
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
},
contrast: function (color2) {
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
var lum1 = this.luminosity();
var lum2 = color2.luminosity();
if (lum1 > lum2) {
return (lum1 + 0.05) / (lum2 + 0.05);
}
return (lum2 + 0.05) / (lum1 + 0.05);
},
level: function (color2) {
var contrastRatio = this.contrast(color2);
if (contrastRatio >= 7.1) {
return 'AAA';
}
return (contrastRatio >= 4.5) ? 'AA' : '';
},
isDark: function () {
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
var rgb = this.rgb().color;
var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
return yiq < 128;
},
isLight: function () {
return !this.isDark();
},
negate: function () {
var rgb = this.rgb();
for (var i = 0; i < 3; i++) {
rgb.color[i] = 255 - rgb.color[i];
}
return rgb;
},
lighten: function (ratio) {
var hsl = this.hsl();
hsl.color[2] += hsl.color[2] * ratio;
return hsl;
},
darken: function (ratio) {
var hsl = this.hsl();
hsl.color[2] -= hsl.color[2] * ratio;
return hsl;
},
saturate: function (ratio) {
var hsl = this.hsl();
hsl.color[1] += hsl.color[1] * ratio;
return hsl;
},
desaturate: function (ratio) {
var hsl = this.hsl();
hsl.color[1] -= hsl.color[1] * ratio;
return hsl;
},
whiten: function (ratio) {
var hwb = this.hwb();
hwb.color[1] += hwb.color[1] * ratio;
return hwb;
},
blacken: function (ratio) {
var hwb = this.hwb();
hwb.color[2] += hwb.color[2] * ratio;
return hwb;
},
grayscale: function () {
// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
var rgb = this.rgb().color;
var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
return Color.rgb(val, val, val);
},
fade: function (ratio) {
return this.alpha(this.valpha - (this.valpha * ratio));
},
opaquer: function (ratio) {
return this.alpha(this.valpha + (this.valpha * ratio));
},
rotate: function (degrees) {
var hsl = this.hsl();
var hue = hsl.color[0];
hue = (hue + degrees) % 360;
hue = hue < 0 ? 360 + hue : hue;
hsl.color[0] = hue;
return hsl;
},
mix: function (mixinColor, weight) {
// ported from sass implementation in C
// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
if (!mixinColor || !mixinColor.rgb) {
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
}
var color1 = mixinColor.rgb();
var color2 = this.rgb();
var p = weight === undefined ? 0.5 : weight;
var w = 2 * p - 1;
var a = color1.alpha() - color2.alpha();
var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
var w2 = 1 - w1;
return Color.rgb(
w1 * color1.red() + w2 * color2.red(),
w1 * color1.green() + w2 * color2.green(),
w1 * color1.blue() + w2 * color2.blue(),
color1.alpha() * p + color2.alpha() * (1 - p));
}
};
// model conversion methods and static constructors
Object.keys(colorConvert).forEach(function (model) {
if (skippedModels.indexOf(model) !== -1) {
return;
}
var channels = colorConvert[model].channels;
// conversion methods
Color.prototype[model] = function () {
if (this.model === model) {
return new Color(this);
}
if (arguments.length) {
return new Color(arguments, model);
}
var newAlpha = typeof arguments[channels] === 'number' ? channels : this.valpha;
return new Color(assertArray(colorConvert[this.model][model].raw(this.color)).concat(newAlpha), model);
};
// 'static' construction methods
Color[model] = function (color) {
if (typeof color === 'number') {
color = zeroArray(_slice.call(arguments), channels);
}
return new Color(color, model);
};
});
function roundTo(num, places) {
return Number(num.toFixed(places));
}
function roundToPlace(places) {
return function (num) {
return roundTo(num, places);
};
}
function getset(model, channel, modifier) {
model = Array.isArray(model) ? model : [model];
model.forEach(function (m) {
(limiters[m] || (limiters[m] = []))[channel] = modifier;
});
model = model[0];
return function (val) {
var result;
if (arguments.length) {
if (modifier) {
val = modifier(val);
}
result = this[model]();
result.color[channel] = val;
return result;
}
result = this[model]().color[channel];
if (modifier) {
result = modifier(result);
}
return result;
};
}
function maxfn(max) {
return function (v) {
return Math.max(0, Math.min(max, v));
};
}
function assertArray(val) {
return Array.isArray(val) ? val : [val];
}
function zeroArray(arr, length) {
for (var i = 0; i < length; i++) {
if (typeof arr[i] !== 'number') {
arr[i] = 0;
}
}
return arr;
}
var color = Color;
function fieldChanged(onModify) {
return function (target, key) {
var privateKey = '_' + key;
Object.defineProperty(target, key, {
enumerable: true,
get: function () {
return this[privateKey];
},
set: function (v) {
var oldValue = this[privateKey];
if (oldValue !== v) {
this[privateKey] = v;
onModify.apply(this, [v, key, oldValue]);
}
}
});
};
}
var dirtyFieldDetector = fieldChanged(function (value, key, oldValue) {
this['__fieldDirty'] = true;
});
var deepDirtyFieldDetector = fieldChanged(function (value, key, oldValue) {
var scope = this;
scope['__fieldDirty'] = true;
if (typeof value === 'object') {
value['onModify'] = function () {
scope['__fieldDirty'] = true;
};
}
});
var dirtyFieldTrigger = fieldChanged(function (value, key, oldValue) {
this['onModify'] && this['onModify'](value, key, oldValue);
});
var deepDirtyFieldTrigger = fieldChanged(function (value, key, oldValue) {
if (this['onModify']) {
this['onModify'](value, key, oldValue);
if (typeof value === 'object') {
value['onModify'] = this['onModify'];
}
}
});
var ShapeBase = (function (_super) {
tslib_1.__extends(ShapeBase, _super);
function ShapeBase() {
var _this = _super.call(this) || this;
_this.__fieldDirty = true;
_this.fillColor = 'white';
_this.strokeColor = 0;
_this.strokeWidth = 0;
_this.addEventListener(Event.ENTER_FRAME, _this.onEnterFrame, _this);
_this.addEventListener(Event.RESIZE, _this.onResize, _this);
return _this;
}
ShapeBase.prototype.onResize = function (e) {
this.__fieldDirty = true;
};
ShapeBase.prototype.onEnterFrame = function (e) {
if (this.__fieldDirty) {
this.__fieldDirty = false;
var _a = this, fillColor = _a.fillColor, strokeColor = _a.strokeColor, strokeWidth = _a.strokeWidth;
this.clear();
this.beginFill(new color(fillColor).rgbNumber());
if (strokeWidth > 0) {
this.lineStyle(strokeWidth, new color(strokeColor).rgbNumber());
}
this.redraw();
this.endFill();
}
};
ShapeBase.prototype.redraw = function () {
};
tslib_1.__decorate([
dirtyFieldDetector
], ShapeBase.prototype, "fillColor", void 0);
tslib_1.__decorate([
dirtyFieldDetector
], ShapeBase.prototype, "strokeColor", void 0);
tslib_1.__decorate([
dirtyFieldDetector
], ShapeBase.prototype, "strokeWidth", void 0);
return ShapeBase;
}(Graphics));
var Rect = (function (_super) {
tslib_1.__extends(Rect, _super);
function Rect() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.borderRadius = 0;
return _this;
}
Rect.prototype.redraw = function () {
var _a = this, width = _a.width, height = _a.height, borderRadius = _a.borderRadius;
if (borderRadius > 0) {
this.drawRoundedRect(0, 0, width, height, borderRadius);
}
else {
this.drawRect(0, 0, width, height);
}
};
tslib_1.__decorate([
dirtyFieldDetector
], Rect.prototype, "borderRadius", void 0);
return Rect;
}(ShapeBase));
var Circle$1 = (function (_super) {
tslib_1.__extends(Circle, _super);
function Circle() {
return _super !== null && _super.apply(this, arguments) || this;
}
Circle.prototype.redraw = function () {
_super.prototype.redraw.call(this);
var _a = this, width = _a.width, height = _a.height;
var radius = Math.min(width, height) / 2;
this.drawCircle(radius, radius, radius);
};
return Circle;
}(ShapeBase));
var assetScheme = 'asset://';
var Image$1 = (function (_super) {
tslib_1.__extends(Image, _super);
function Image() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._escapes = [];
_this._registeredEvents = [];
return _this;
}
Object.defineProperty(Image.prototype, "source", {
get: function () {
return this._source;
},
set: function (v) {
......@@ -12386,11 +14607,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (url.indexOf('://') >= 0) {
if (url.indexOf(assetScheme) === 0) {
var uuid = url.replace(assetScheme, '');
var assetConfig = getAssetByUUID(uuid);
if (assetConfig) {
url = assetConfig.url;
this.texture = Texture.fromImage(url);
}
this.texture = Texture.from(uuid);
}
}
else {
......@@ -12550,14 +14767,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return instantiateView(config);
}
function instantiateView(config) {
var type = config.type, scripts = config.scripts;
var type = config.type;
var nodeTypeDef = nodeTypeMapping[type];
if (!nodeTypeDef) {
console.warn('error node type:', type);
return;
}
var node = new nodeTypeDef();
var name = config.name, uuid = config.uuid, properties = config.properties, children = config.children, events = config.events;
var name = config.name, uuid = config.uuid, properties = config.properties, children = config.children, events = config.events, scripts = config.scripts;
node.name = name;
node.uuid = uuid;
node.__originConfig = config;
......@@ -12583,15 +14800,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return node;
}
function instantiateScript(node, ScriptConfig) {
var scriptName = ScriptConfig.script, props = ScriptConfig.props, disabled = ScriptConfig.disabled;
var script = node.scriptsProxy.add(scriptName, props, disabled);
}
function injectProperties(target, source) {
for (var key in source) {
propertyParse(key, target, source);
}
}
var template = "\n<div style=\"\nposition: absolute;\nleft: 0;\nright: 0;\ntop: 0;\nbottom: 0;\ndisplay: flex;\ndisplay: -webkit-flex;\njustify-content: center;\n-webkit-justify-content: center;\nalign-items: center;\n-webkit-align-items: center;\n\">\n<img src=\"//yun.duiba.com.cn/editor/zeroing/assets/loading.gif\"\n</div>\n";
var container = document.createElement('div');
......@@ -12781,7 +14989,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
showLoadingView();
return [4, loadAssets(assets, p)];
return [4, loadAssets(assets, p).catch(function (e) {
console.log(e);
})];
case 1:
_b.sent();
if (!customs) return [3, 5];
......@@ -12791,7 +15001,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (!(_a < customs_2.length)) return [3, 5];
custom = customs_2[_a];
if (!custom.assets) return [3, 4];
return [4, loadAssets(custom.assets, p)];
return [4, loadAssets(custom.assets, p).catch(function (e) {
console.log(e);
})];
case 3:
_b.sent();
_b.label = 4;
......@@ -12838,7 +15050,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return view;
};
GameStage.prototype.getViewConfigByName = function (name) {
return this._config.views.find(function (view) { return view.name === name; });
return arrayFind(this._config.views, function (view) { return view.name === name; });
};
GameStage.prototype.setBlackLayerVisible = function (visible) {
this._blackLayer.visible = visible;
......@@ -12888,29 +15100,24 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
function launch(url, onAssetsProgress, onAssetsComplete) {
return new Promise(function (resolve, reject) {
globalLoader.loadJson(function (s, payload) {
if (s) {
resolve(payload);
}
else {
reject(payload);
}
}, url);
}).then(function (config) {
return globalLoader.loadJson(url)
.then(function (config) {
return launchWithConfig(config, onAssetsProgress, onAssetsComplete);
});
}
function launchWithLocalStorage(id, onAssetsProgress, onAssetsComplete) {
var storeKey = 'preview-project-' + id;
var data = localStorage.getItem(storeKey);
var dataObj = JSON.parse(data);
return launchWithConfig(dataObj, onAssetsProgress, onAssetsComplete);
var storeData = localStorage.getItem(storeKey);
var _a = JSON.parse(storeData), data = _a.data, processes = _a.processes, scripts = _a.scripts, customs = _a.customs;
setProcessMetaLibs(processes);
registerScripts(scripts);
registerCustomModuleFromConfig(customs);
return launchWithConfig(data, onAssetsProgress, onAssetsComplete);
}
function launchWithConfig(config, onAssetsProgress, onAssetsComplete) {
return new Promise(function (resolve) {
var _a = config.options, containerID = _a.containerID, designWidth = _a.designWidth, designHeight = _a.designHeight, frameRate = _a.frameRate, scaleMode = _a.scaleMode, rendererType = _a.rendererType;
var stage = window['stage'] = new Stage(containerID || "game-container", designWidth || 750, designHeight || 1334, frameRate || 60, scaleMode || StageScaleMode.FIXED_WIDTH, rendererType || exports.RENDERER_TYPE.WEBGL);
var _a = config.options, containerId = _a.containerId, designWidth = _a.designWidth, designHeight = _a.designHeight, frameRate = _a.frameRate, scaleMode = _a.scaleMode, rendererType = _a.rendererType;
var stage = window['stage'] = new Stage(containerId || "game-container", designWidth || 750, designHeight || 1334, frameRate || 60, scaleMode || StageScaleMode.FIXED_WIDTH, rendererType || exports.RENDERER_TYPE.WEBGL);
Stage.flushAll();
stage.addEventListener(Event.ON_INIT_STAGE, function () {
exports.gameStage = new GameStage(stage);
......@@ -12924,9 +15131,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
}
var queryParams = {};
for (var _i = 0, _a$1 = location.search.replace('?', '').split('&'); _i < _a$1.length; _i++) {
var item = _a$1[_i];
var arr = item.split('=');
queryParams[arr[0]] = arr.length === 1 ? true : arr[1];
}
exports.BaseTexture = BaseTexture;
exports.Button = Button;
exports.Circle = Circle$1;
exports.Color = color;
exports.Container = Container;
exports.DATA_CENTER_EVENT = DATA_CENTER_EVENT;
exports.DATA_URI = DATA_URI;
......@@ -12982,6 +15197,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.fieldChanged = fieldChanged;
exports.findVariable = findVariable;
exports.getDataByPath = getDataByPath;
exports.getLogSwitch = getLogSwitch;
exports.getTexture = getTexture;
exports.globalEvent = globalEvent;
exports.globalLoader = globalLoader;
......@@ -12991,8 +15207,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.importUMDCode = importUMDCode;
exports.injectEnv = injectEnv;
exports.injectProp = injectProp;
exports.injectProperties = injectProperties;
exports.inputFeildIosEnable = inputFeildIosEnable;
exports.instantiate = instantiate;
exports.instantiateScript = instantiateScript;
exports.joinPath = joinPath;
exports.jsonp = jsonp;
exports.launch = launch;
......@@ -13005,6 +15223,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.objClone = objClone;
exports.osType = osType;
exports.propertyParse = propertyParse;
exports.queryParams = queryParams;
exports.registerCustomCodeModule = registerCustomCodeModule;
exports.registerCustomModule = registerCustomModule;
exports.registerCustomModuleFromConfig = registerCustomModuleFromConfig;
......@@ -13014,6 +15233,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.setProcessMetaLibs = setProcessMetaLibs;
exports.setScriptMap = setScriptMap;
exports.sin = sin;
exports.strLen = strLen;
exports.strShort = strShort;
exports.toDisplayDataURL = toDisplayDataURL;
exports.trimChar = trimChar;
exports.urlJoin = urlJoin;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -146,7 +146,20 @@ export const URL_FILE_EXTENSION: any;
export const DATA_URI: any;
export enum SCROLL_DIRECTION {
HORIZONTAL = "horizontal",
VERTICAL = "vertical"
}
export class Container extends DisplayObject {
percentWidth: number;
percentHeight: number;
left: number;
top: number;
right: number;
bottom: number;
horizonCenter: number;
verticalCenter: number;
mouseChildren: boolean;
children: any[];
containerUpdateTransform: any;
......@@ -668,14 +681,14 @@ export abstract class HashObject {
export class Loader extends EventDispatcher {
caches: {};
_req: XMLHttpRequest;
crossOrigin: boolean;
constructor();
loadSheet(callback: Function, url: string): void;
loadRaw(callback: Function, url: string, type: 'text' | 'json'): void;
loadJson(callback: Function, url: string): void;
loadText(callback: Function, url: string): void;
loadTexture(callback: Function, url: string): void;
loadImage(callback: Function, url: string, crossOrigin?: boolean): HTMLImageElement;
loadSheet(url: string): Promise<void>;
loadRaw(url: string, uuid?: string, type?: 'text' | 'json'): Promise<any>;
loadJson(url: string, uuid?: string): Promise<any>;
loadText(url: string, uuid?: string): Promise<any>;
loadImage(url: string, uuid?: string): Promise<{}>;
loadTexture(url: string, uuid?: string): Promise<Texture>;
cache(name: string, data: any): void;
}
......@@ -808,9 +821,9 @@ export class Transform extends HashObject {
destroy(): void;
}
export function httpRequest(callback: Function, url: string, method?: string, params?: any, type?: 'text' | 'json' | 'jsonp'): void;
export function httpRequest(url: string, method?: string, params?: any, type?: 'text' | 'json' | 'jsonp'): Promise<{}>;
export function jsonp(callback: any, url: any, params: any): void;
export function jsonp(url: any, params: any): Promise<{}>;
export function urlJoin(url: any, query: any): any;
......@@ -1470,7 +1483,7 @@ export class TextField extends Sprite {
private _lineType;
text: string;
protected _setText(value: any): void;
private _text;
protected _text: string;
font: string;
private _font;
size: number;
......@@ -1584,14 +1597,14 @@ export class Texture extends EventDispatcher {
}
export class TextureSheet {
baseTexture: BaseTexture;
baseTexture: any;
textures: {};
animations: {};
data: any;
_frames: any;
_frameKeys: string[];
_callback: Function;
constructor(baseTexture: BaseTexture, data: any);
constructor(baseTexture: BaseTexture | Texture, data: any);
parse(callback: Function): void;
_processFrames(initialFrameIndex: number): void;
_processAnimations(): void;
......@@ -1762,13 +1775,42 @@ export class FrameAni extends Sprite {
private changeTexture;
}
export class ScrollContainer extends Container {
private _direction;
protected distance: number;
private minDis;
private maskObj;
viewPort: Container;
private lastValue;
protected speed: number;
private addSpeed;
isStop: boolean;
maxSpeed: number;
fSpeed: number;
protected paramXY: string;
protected paramSize: string;
private stopTimes;
private isMouseDownState;
private autoScroll;
isSpringBack: boolean;
constructor(maxDistance?: number, isFull?: boolean);
readonly maxDistance: any;
direction: SCROLL_DIRECTION;
protected updateDirection(): void;
updateViewRect(): void;
cancelScroll(): void;
private onMouseEvent;
scrollTo(dis: number, time?: number): void;
destroy(): void;
}
export interface IScrollListItem extends DisplayObject {
initData(id: number, data: any): void;
id: number;
data: number;
}
export class ScrollList extends ScrollPage {
export class ScrollList extends ScrollContainer {
private _items;
private _itemW;
private _itemH;
......@@ -1783,42 +1825,15 @@ export class ScrollList extends ScrollPage {
private _disParam;
private _lastFirstId;
readonly loadingView: DisplayObject;
constructor(itemClassName: any, itemWidth: number, itemHeight: number, vW: number, vH: number, isVertical?: boolean, cols?: number);
constructor(itemClassName: any, itemWidth: number, itemHeight: number, cols?: number);
updateData(data: Array<any>, isReset?: boolean): void;
private flushData;
setViewRect(w: number, h: number, isVertical: boolean): void;
updateViewRect(): void;
private _updateViewRect;
setLoading(downLoading: DisplayObject): void;
destroy(): void;
}
export class ScrollPage extends Container {
protected isVertical: boolean;
private viewWidth;
private viewHeight;
maxDistance: number;
protected distance: number;
private minDis;
private maskObj;
view: Container;
private lastValue;
protected speed: number;
private addSpeed;
isStop: boolean;
maxSpeed: number;
fSpeed: number;
protected paramXY: string;
private stopTimes;
private isMouseDownState;
private autoScroll;
isSpringBack: boolean;
constructor(vW: number, vH: number, maxDistance: number, isVertical?: boolean, isFull?: boolean);
setViewRect(w: number, h: number, isVertical: boolean): void;
private onMouseEvent;
scrollTo(dis: number, time?: number): void;
destroy(): void;
}
export class ShowWord extends TextField {
playWords(text: string, deltaTime?: number, callback?: Function): void;
}
......@@ -2044,6 +2059,8 @@ export function setProcessMetaLibs(...metaContexts: any[]): void;
export function setGlobalContext(context: any): void;
export function setScriptMap(_scriptMap: any): void;
export function executeBehavior(sequence: any, subEntry: string, target: any, args?: any): void;
export class Process {
......@@ -2074,7 +2091,7 @@ export class Process {
}>;
getProcessMeta(id: any): any;
getProps(key?: any): any;
updateProps(args: any): void;
updateProps(props: any, args: any, originProps: any, propsConfig: any): void;
resolveLinkedProp(data: any, key: any): any;
}
......@@ -2083,9 +2100,11 @@ export class VM {
_globalContext: any;
_target: any;
_id: any;
_scriptMap: any;
setup(context: any): void;
executeProcess(sequence: any, id: any, parentProcess: any, args: any): Promise<any>;
getMeta(id: any): any;
getScript(hash: any): any;
readonly globalContext: any;
readonly id: any;
}
......@@ -2114,8 +2133,9 @@ export function applyScript(ctor: Function): void;
export class ScriptBase {
private _host;
disabled: boolean;
private _disabled;
readonly host: Container;
disabled: boolean;
mounted(): void;
destroy(): void;
update(t: number): void;
......@@ -2133,6 +2153,14 @@ export function getAssetByUUID(uuid: any): any;
export function getAssetByName(name: any): any;
export function registerCustomModule(id: any, def: any): void;
export function registerCustomCodeModule(config: any): void;
export function registerCustomModuleFromConfig(config: any): void;
export function addCustomModule(id: any, container: Container, options?: any): any;
export class DataCenter extends EventDispatcher {
store: {};
watchers: any[];
......@@ -2140,10 +2168,11 @@ export class DataCenter extends EventDispatcher {
registerGroup(name: any, origin?: any): void;
unregisterGroup(name: any): void;
getGroup(name: any): any;
getDataByPath(path: any, throwException?: any): any;
getDataByPath(path: any, groupName?: any, throwException?: any): any;
getDataByName(name: any, throwException?: any): any;
formatString(str: any, escapes: any): any;
mutate(name: any, data?: any, path?: any, dispatch?: boolean): void;
increase(groupName: any, step?: any, path?: any, dispatch?: boolean): void;
mutate(groupName: any, data?: any, path?: any, dispatch?: boolean): void;
watch(name: any, path: any): void;
getWatcher(name: any): any;
registerDataMapping(dataMapping: any): void;
......@@ -2158,21 +2187,31 @@ export function injectEnv(data: any): void;
export class GameStage extends Container {
private _sceneContainer;
private _popupContainer;
private _toast;
private _blackLayer;
private _stage;
private _dataCenter;
private _config;
private _viewCache;
constructor(stage: Stage);
readonly sceneContainer: StackContainer;
readonly popupContainer: StackContainer;
readonly toast: Toast;
readonly dataCenter: DataCenter;
launch(config: any, onAssetsProgress: any, onAssetsComplete: any): void;
launch(config: any, onAssetsProgress?: any, onAssetsComplete?: any): Promise<void>;
start(): void;
instantiateView(name: any, cache?: boolean): any;
getViewConfigByName(name: any): any;
setBlackLayerVisible(visible: any): void;
onPopupContainerChange(e: any): void;
}
export function showLoadingView(): void;
export function hideLoadingView(): void;
export function setLoadingViewProgress(current: any, total: any): void;
export class Image extends Sprite {
private _originText;
private _escapes;
......@@ -2190,9 +2229,17 @@ export class Label extends TextField {
private _originText;
private _escapes;
private _registeredEvents;
private _htmlText;
protected _setText(value: any): void;
private dealEscape;
htmlText: any;
private unregisterEvents;
private onDataMutated;
private onTextMutated;
private onHtmlMutated;
}
export class ScrollView extends ScrollContainer {
constructor();
}
export class ShapeBase extends Shape {
......@@ -2219,32 +2266,50 @@ export {};
export class StackContainer extends Container {
private _mutex;
private _stack;
constructor(mutex?: boolean);
push(view: DisplayObject, options?: any, dispatch?: boolean): void;
replace(view: DisplayObject, options?: any): void;
pop(): boolean;
pop(dispatch?: boolean): boolean;
popAll(view?: DisplayObject, options?: any): void;
}
export function createTextureSheet(baseTexture: BaseTexture, altaData: any): void;
export class Toast extends Container {
private _contentSample;
private _content;
private _gameStage;
constructor(gameStage: GameStage);
show(props?: any): void;
hide(animation?: boolean, hideDuration?: number): void;
private removeContentView;
private getContent;
}
export function instantiate(config: any): any;
export { instantiate };
export let gameStage: any;
export let gameStage: GameStage;
export function launch(url: any, onAssetsProgress: any, onAssetsComplete: any): Promise<{}>;
export function launchWithLocalStorage(id: any, onAssetsProgress: any, onAssetsComplete: any): Promise<{}>;
export function launchWithConfig(config: any, onAssetsProgress: any, onAssetsComplete: any): Promise<{}>;
export function findNodeByUUID(node: any, uuid: any): any;
export function md5(string: any): string;
export const ESCAPE_REG_EXP: RegExp;
export const linkedFlag = "$_linked_$";
export const nodeScheme = "node://";
export function arrayFind(arr: any, callback: any): any;
export function arrayFind(arr: any, predicate: any): any;
export function objClone(obj: any): any;
......@@ -2257,4 +2322,16 @@ export function injectProp(target: any, data?: any, callback?: Function, ignore
export function copyProp(target: any, data: any, config?: any): void;
export function obj2query(obj: any): string;
export function importCJSCode(code: any, node?: any): any;
export function importUMDCode(code: any): any;
export function trimChar(str: string, char: string): string;
export function joinPath(...segments: string[]): string;
export function findVariable(name: string, ...contexts: any[]): any;
export function htmlToPureText(htmlText: any): any;
}
......@@ -5,15 +5,16 @@
"main": "index.js",
"types": "index.d.ts",
"dependencies": {
"glob": "^7.1.6",
"rollup-plugin-typescript": "^1.0.1"
"color": "^3.1.2"
},
"devDependencies": {
"dts-bundle": "^0.7.3",
"glob": "^7.1.6",
"protobufjs": "^6.8.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-progress": "^1.1.1",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-typescript2": "^0.25.2",
"rollup-plugin-uglify": "^6.0.3",
"ts-loader": "^4.0.0",
......@@ -25,10 +26,12 @@
},
"scripts": {
"build-webpack": "webpack",
"rollup": "rollup -c -o dist/engine.js --environment BUILD:production1",
"rollup:prod": "rollup -c -o dist/engine.js --environment BUILD:production",
"rollup": "rollup -c -o dist/engine.js",
"rollup:debug": "rollup -c -m ",
"rename": "node scripts/rename-hash.js dist/engine.js",
"build": "rm -rf dist&&yarn rollup && yarn rename && ali-oss-publish -c oss.config.js -e dist",
"build": "rm -rf dist&&yarn rollup:prod && yarn rename && ali-oss-publish -c oss.config.js -e dist",
"build:debug": "rm -rf dist&&yarn rollup && yarn rename && ali-oss-publish -c oss.config.js -e dist",
"ts": "dts-bundle --name engine --main types/src/index.d.ts --out ../../dist/index.d.ts",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack -w",
......
......@@ -54,5 +54,5 @@ ${allExports}
}
`;
fs.writeFileSync('dist/types.d.ts', content);
fs.writeFileSync('debug/types.d.ts', content);
});
......@@ -153,9 +153,9 @@ export const DEG_TO_RAD: number = PI / 180;
* @property {number} CANVAS - Canvas render type.
*/
export enum RENDERER_TYPE {
UNKNOWN = 0,
WEBGL,
CANVAS,
UNKNOWN = 'unknown',
WEBGL = 'webgl',
CANVAS = 'canvas',
};
/**
......
import { ObservablePoint, Point, Rectangle } from '../math';
import { sign, TextureCache } from '../utils';
import {ObservablePoint, Point, Rectangle} from '../math';
import {sign, TextureCache} from '../utils';
// import { BLEND_MODES } from '../const';
import Texture from '../texture/Texture';
import {Event} from '../events/Event';
import Container from './Container';
import { DisplayObject } from "./DisplayObject";
import {DisplayObject} from "./DisplayObject";
import CanvasRenderer from '../renderers/CanvasRenderer';
import { SCALE_MODES } from '../const';
import { WebglRenderer } from '../renderers/WebglRenderer';
import {SCALE_MODES} from '../const';
import {WebglRenderer} from '../renderers/WebglRenderer';
const indices = new Uint16Array([0, 1, 2, 0, 2, 3]);
/**
......@@ -21,7 +21,7 @@ export default class Sprite extends Container {
* 关于贴图的锚点,0到1,默认为texture自己的
*
*/
private _anchorTexture: ObservablePoint
private _anchorTexture: ObservablePoint;
/**
* 使用的贴图
* @member {Texture}
......@@ -124,13 +124,13 @@ export default class Sprite extends Container {
//可用才赋值uv
if (this._texture.valid) this.uvs = this._texture._uvs.uvsFloat32;
//设置过宽高的话,就需要改变缩放值,废弃先
// if (this._width) {
// this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;
// }
if (this._width) {
this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;
}
// if (this._height) {
// this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;
// }
if (this._height) {
this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;
}
//修改_localBoundsSelf
const width = this._texture.orig.width;
......@@ -435,7 +435,6 @@ export default class Sprite extends Container {
}
//一些静态类方法
/**
* 方便创建sprite
......
......@@ -724,7 +724,7 @@ export class Stage extends Container {
for (let j = 0; j < eLen; j++) {
if (!events[j]["_bpd"]) {
//有事件,且mouseEnabled为true
if (d.hasEventListener(events[j].type) && d.mouseEnabled) {
if (d.hasEventListener(events[j].type, false) && d.mouseEnabled) {
events[j].target = d;
events[j].currentTarget = displayList[eLen - 1];
lp = d.globalToLocal(cp, DisplayObject._bp);
......
......@@ -220,7 +220,7 @@ export default class Graphics extends Container {
* 克隆该Graphics的几何绘制,不包括它自身的transform
* @return {Graphics} A clone of the graphics object
*/
clone(): Graphics {
cloneSelf(): Graphics {
const clone = new Graphics();
clone.renderable = this.renderable;
......
......@@ -4,6 +4,8 @@ import {EventDispatcher} from "../events/EventDispatcher";
import {TextureCache} from "../utils";
import {Texture} from "../texture";
import {httpRequest} from "../net";
import TextureSheet from "../texture/TextureSheet";
import {createTextureSheet} from "../../zeroing/game-warpper/texture-sheet";
export class Loader extends EventDispatcher {
......@@ -11,12 +13,10 @@ export class Loader extends EventDispatcher {
* 记录原始数据,json和image,贴图在建立时会被缓存
*/
caches = {};
crossOrigin: boolean = true;
//parser: Parser;
_req: XMLHttpRequest = null;
/**
*
*/
......@@ -27,75 +27,73 @@ export class Loader extends EventDispatcher {
/**
*
* @param callback
* @param url 图集一般是png格式,传的是json,在callback自行拆分
* @param url
*/
loadSheet(callback: Function, url: string) {
let pngFile = url.substring(0, url.lastIndexOf('.')) + '.png';
this.loadImage((suc, data) => {
if (suc) {
if (this.caches[url]) {
callback(true, {json: this.caches[url], img: data})
}
} else {
callback(false, data)
loadSheet(url: string) {
let config;
return this.loadJson(url)
.then(json => {
const {file} = config = json;
return this.loadTexture(file)
})
.then(texture => {
createTextureSheet(texture.baseTexture, config.frames);
})
}
}, pngFile);
this.loadJson((suc, data) => {
if (suc) {
if (this.caches[pngFile]) {
callback(true, {json: data, img: this.caches[pngFile]})
}
loadRaw(url: string, uuid?: string, type?: 'text' | 'json') {
let data = this.caches[uuid || url];
if (data) {
return Promise.resolve(data);
} else {
callback(false, data)
}
}, url)
}
loadRaw(callback: Function, url: string, type: 'text' | 'json') {
httpRequest((s, p) => {
if (s) {
this.cache(url, p);
return httpRequest(url, 'get', {}, type)
.then(data => {
this.cache(uuid || url, data);
return data;
});
}
callback(s, p);
}, url, 'get', {}, type);
}
loadJson(callback: Function, url: string) {
this.loadRaw(callback, url, 'json');
loadJson(url: string, uuid?: string) {
return this.loadRaw(url, uuid, 'json');
}
loadText(callback: Function, url: string) {
this.loadRaw(callback, url, 'text');
loadText(url: string, uuid?: string) {
return this.loadRaw(url, uuid, 'text');
}
loadTexture(callback: Function, url: string) {
this.loadImage((s, payload) => {
if (s) {
this.cache(url, payload);
callback(s, TextureCache[url] = Texture.from(payload));
loadImage(url: string, uuid?: string) {
return new Promise((resolve, reject) => {
let img = this.caches[uuid || url];
if (img) {
resolve(img);
} else {
callback(s, payload);
}
}, url)
}
loadImage(callback: Function, url: string, crossOrigin: boolean = true) {
let self = this
let img = new Image();
if (crossOrigin) {
img = new Image();
if (this.crossOrigin) {
img.setAttribute('crossOrigin', 'anonymous');
}
img.onload = function (e) {
self.cache(url, img);
callback(true, img);
img.onload = () => {
this.cache(uuid || url, img);
resolve(img);
};
img.onerror = function (e) {
callback(false, e);
reject(e);
};
img.src = url;
return img
}
})
}
/**
* 加载纹理
* @param url
* @param uuid
*/
loadTexture(url: string, uuid?: string) {
return this.loadImage(url)
.then(image => {
return TextureCache[uuid || url] = Texture.from(image);
})
}
/*loadSvga(callback: (suc: boolean, data: VideoEntity) => void, url: string) {
......@@ -113,10 +111,8 @@ export class Loader extends EventDispatcher {
if (this.caches[name]) {
//console.log("覆盖原先数据:" + name);
}
this.caches[name] = data
this.caches[name] = data;
}
}
async function fetchAsync(url: string) {
......
......@@ -6,16 +6,16 @@ import {obj2query} from "../zeroing/utils";
/**
* http请求
* @param callback
* @param url
* @param method
* @param params
* @param type
*/
export function httpRequest(callback: Function, url: string, method: string = 'get', params?: any, type: 'text' | 'json' | 'jsonp' = 'text') {
export function httpRequest(url: string, method: string = 'get', params?: any, type: 'text' | 'json' | 'jsonp' = 'text') {
if (type === "jsonp") {
jsonp(callback, url, params);
return jsonp(url, params);
} else {
return new Promise((resolve, reject) => {
let _req;
if (window["XMLHttpRequest"]) {
_req = new XMLHttpRequest();
......@@ -31,8 +31,8 @@ export function httpRequest(callback: Function, url: string, method: string = 'g
url = urlJoin(url, queryStr);
}
_req.open(method, url, true);
if(!isGet){
_req.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
if (!isGet) {
_req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
}
_req.responseType = type;
if (isGet) {
......@@ -42,26 +42,33 @@ export function httpRequest(callback: Function, url: string, method: string = 'g
}
_req.onreadystatechange = () => {
if (_req.readyState == 4 && _req.status == 200) {
callback && callback(true, _req.response)
resolve(_req.response)
}
};
_req.onerror = (reason): void => {
callback && callback(false, reason)
reject(reason)
}
}
});
}
}
export function jsonp(callback, url, params) {
/**
* jsonp请求
* @param url
* @param params
*/
export function jsonp(url, params) {
return new Promise((resolve, reject) => {
const src = urlJoin(url, obj2query(params));
const scriptEl = document.createElement('script');
scriptEl.src = src;
scriptEl.onload = function () {
callback && callback(true);
resolve();
document.body.removeChild(scriptEl);
};
scriptEl.onerror = function () {
callback && callback(false);
reject();
document.body.removeChild(scriptEl);
};
/*const callbackFuncName = '__zeroing_jsonp_callback__' + Math.random();
......@@ -69,6 +76,7 @@ export function jsonp(callback, url, params) {
callback(result);
};*/
document.body.appendChild(scriptEl);
})
}
export function urlJoin(url, query) {
......
......@@ -113,7 +113,7 @@ export class EditableText extends TextField {
}
//font包括字体和大小
s.htmlElement.style.font = s.size + "px " + this.font;
s.htmlElement.style.color = s.textColor;
s.htmlElement.style.colorD = s.textColor;
s.htmlElement.style.textAlign = s["_textWidth"] ? s.textAlign : TEXT_ALIGN.LEFT;
// s.htmlElement.setAttribute("class", "inputTextFor");
// .inputTextFor:: -webkit - input - placeholder {
......
......@@ -127,7 +127,7 @@ export class InputText extends FloatDisplay {
s.htmlElement.placeholder = text;
//font包括字体和大小
s.htmlElement.style.font = size + "px " + font;
s.htmlElement.style.color = color;
s.htmlElement.style.colorD = color;
s.htmlElement.style.textAlign = align;
/////////////////////设置边框//////////////
s.border = showBorder;
......@@ -233,11 +233,11 @@ export class InputText extends FloatDisplay {
*/
public set color(value: string) {
var ss = this.htmlElement.style;
ss.color = value;
ss.colorD = value;
}
public get color(): string {
return this.htmlElement.style.color;
return this.htmlElement.style.colorD;
}
/**
......
......@@ -12,7 +12,7 @@ export default class TextureSheet {
/**
* Reference to ths source texture
*/
baseTexture: BaseTexture;
baseTexture;
/**
* A map containing all textures of the sprite sheet.
* Can be used to create a {@link Sprite|Sprite}:
......@@ -56,7 +56,7 @@ export default class TextureSheet {
* @param {BaseTexture} baseTexture Reference to the source BaseTexture object.
* @param {Object} data - TextureSheet image data.
*/
constructor(baseTexture: BaseTexture, data: any) {
constructor(baseTexture: BaseTexture | Texture, data: any) {
this.baseTexture = baseTexture;
this.textures = {};
this.animations = {};
......
......@@ -6,20 +6,6 @@ import {SCROLL_DIRECTION} from "../const";
// import Tween from "../../tweenSimple/Tween";
let queue: ScrollContainer[] = [];
function registerScrollInstance(scrollContainer?) {
while (queue.length > 0) {
let item = queue.shift();
if(scrollContainer){
item.cancelScroll();
}
}
if(scrollContainer){
queue.push(scrollContainer);
}
}
/**
* 滚动视图
* @class ScrollPage
......@@ -200,7 +186,7 @@ export class ScrollContainer extends Container {
s.stage.removeEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
s.stage.removeEventListener(MouseEvent.MOUSE_MOVE, s.onMouseEvent, s);
});
s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent, s);
s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent, s, false);
// s.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
// s.addEventListener(MouseEvent.MOUSE_OUT, s.onMouseEvent, s);
s.addEventListener(Event.ENTER_FRAME, function () {
......@@ -327,6 +313,7 @@ export class ScrollContainer extends Container {
let view: any = s.viewPort;
// if (s.distance < s.maxDistance) {
if (e.type == MouseEvent.MOUSE_DOWN) {
e.stopPropagation();
if (!s.isStop) {
s.isStop = true;
}
......@@ -341,8 +328,6 @@ export class ScrollContainer extends Container {
}
s.speed = 0;
s.isMouseDownState = 1;
registerScrollInstance(this);
} else if (e.type == MouseEvent.MOUSE_MOVE) {
if (s.isMouseDownState == 0) return;
if (s.isMouseDownState == 1) {
......@@ -385,8 +370,6 @@ export class ScrollContainer extends Container {
s.dispatchEvent(Event.ON_SCROLL_STOP);
}
s.isMouseDownState = 0;
registerScrollInstance();
}
// }
}
......
......@@ -55,14 +55,11 @@ export class ScrollList extends ScrollContainer {
* @param {Class} itemClassName 可以做为Item的类
* @param {number} itemWidth item宽
* @param {number} itemHeight item高
* @param {number} vW 列表的宽
* @param {number} vH 列表的高
* @param {boolean} isVertical 是横向滚动还是纵向滚动 默认是纵向
* @param {number} cols 分几列,默认是1列
* @since 1.0.9
*/
constructor(itemClassName: any, itemWidth: number, itemHeight: number, vW: number, vH: number, isVertical: boolean = true, cols: number = 1) {
super(vW, vH, 0, isVertical);
constructor(itemClassName: any, itemWidth: number, itemHeight: number, cols: number = 1) {
super();
let s = this;
s._instanceType = "ScrollList";
s._itemW = itemWidth;
......@@ -145,14 +142,11 @@ export class ScrollList extends ScrollContainer {
/**
* 设置可见区域,可见区域的坐标始终在本地坐标中0,0点位置
* @method setViewRect
* @param {number}w 设置可见区域的宽
* @param {number}h 设置可见区域的高
* @param {boolean} isVertical 方向
* @public
* @since 1.1.1
*/
public updateViewRect(w: number, h: number, isVertical: boolean): void {
super.updateViewRect(w, h, isVertical);
public updateViewRect(): void {
super.updateViewRect();
let s = this;
if (s._itemRow && s._itemCol) {
s._updateViewRect();
......
......@@ -35,10 +35,7 @@ export * from './2d/const'
export * from './zeroing'
export {default as Color} from 'color'
// function aa(){
// HashObject
......
......@@ -8,11 +8,13 @@ import {getDataByPath, linkedFlag, nodeScheme, objClone} from "../utils";
import {findNodeByUUID} from "../node-utils";
import {dataCenter} from "../game-warpper/data-center";
import {env} from "../game-warpper/enviroment";
import {getLogSwitch, Logs} from "../log-switch";
const log = true;
const log = getLogSwitch(Logs.PROCESS);
const linkScheme = 'link://';
export class Process {
private readonly id;
private _config;
private _parent: Process;
private _vm: VM;
......@@ -21,8 +23,8 @@ export class Process {
private _target;
private _originProps;
constructor() {
constructor(id) {
this.id = id;
}
get processConfig() {
......@@ -45,8 +47,8 @@ export class Process {
this._sequence = sequence;
this._target = target;
if (!this._originProps && this._config.props) {
this._originProps = objClone(this._config.props)
if (!this._config._originProps && this._config.props) {
this._config._originProps = objClone(this._config.props)
}
}
......@@ -98,7 +100,7 @@ export class Process {
if (this._meta) {
let metaConfig = this._meta;
if (metaConfig) {
this.updateProps(this._config.props = {}, payload, this._originProps, this._meta.props);
this.updateProps(this._config.props = {}, payload, this._config._originProps, this._meta.props);
if (metaConfig.script) {
let func;
if (metaConfig.script.indexOf(linkScheme) === 0) {
......@@ -106,12 +108,18 @@ export class Process {
} else {
func = new Function('args', 'props', 'target', 'global', 'vm', warpAsyncScript(metaConfig.script));
}
if (!func) {
console.log();
}
if (func) {
let globalContext = this._vm.globalContext;
globalContext.dataCenter = globalContext.gameStage.dataCenter;
result = await func(payload, this._config.props, this._target, globalContext, this._vm);
if (log){
console.log(`[${this._vm.id}:${this.id}] output: <${result.type}>`, result.payload ? JSON.stringify(result.payload) : '');
}
} else {
if (log){
console.log('script lose');
}
}
}
} else {
console.warn(`process meta [${meta}] not found`)
......
......@@ -14,6 +14,8 @@ export class VM {
_id;
_scriptMap;
_pid = 0;
setup(context) {
const {processMetaLibs, globalContext, target, scriptMap} = context;
......@@ -25,7 +27,7 @@ export class VM {
}
async executeProcess(sequence, id, parentProcess, args) {
const process = new Process();
const process = new Process(this._pid++);
process.init({
sequence,
id,
......@@ -46,7 +48,7 @@ export class VM {
}
}
getScript(hash){
getScript(hash) {
return this._scriptMap[hash];
}
......
......@@ -3,6 +3,9 @@
*/
import {VM} from "./VM";
import {getLogSwitch, Logs} from "../log-switch";
const log = getLogSwitch(Logs.PROCESS);
let processMetaLibs = [];
let globalContext = {};
......@@ -14,8 +17,10 @@ let scriptMap = {};
*/
export function setProcessMetaLibs(...metaContexts) {
for (let context of metaContexts) {
if(context){
processMetaLibs.push(context);
}
}
}
/**
......
/**
* Created by rockyl on 2019-11-08.
*/
import {propertyParse} from "../utils";
import {injectProperties, instantiateScript, propertyParse} from "../utils";
const cloneFields = [
/*node*/ 'x', 'y', 'width', 'height', 'rotation', 'alpha', 'scaleX', 'scaleY', 'visible',
......@@ -22,17 +22,29 @@ export function afterConstructor(ctor: Function) {
this.applyEvents();
};
ctor.prototype.clone = function () {
ctor.prototype.clone = function (withEvents = false, withScripts: false) {
let target = this.constructor.apply(Object.create(this.constructor.prototype));
let originConfig = this.__originConfig;
target.name = originConfig.name;
for (let field in originConfig.properties) {
propertyParse(field, target, originConfig.properties);
const {name, properties, events, scripts} = this.__originConfig;
target.name = name;
injectProperties(target, properties);
if(withScripts){
if (scripts && scripts.length > 0) {
for (let scriptConfig of scripts) {
instantiateScript(target, scriptConfig);
}
}
}
if(withEvents){
if (events) {
target.eventsProxy.eventsConfig = events;
}
target.eventsProxy.start();
}
for(let child of this.children){
let childCopy = child.clone();
let childCopy = child.clone(withEvents, withScripts);
target.addChild(childCopy);
}
......
......@@ -98,8 +98,8 @@ export function registerScriptDef(id, def) {
}
export function registerScripts(scripts) {
for (let id in scripts) {
let code = scripts[id];
for (let script of scripts) {
let {id, code} = script;
let def = importCJSCode(code);
registerScriptDef(id, def);
}
......
......@@ -15,6 +15,7 @@ import {injectEnv} from "./enviroment";
import {registerCustomModuleFromConfig} from "./custom-module";
import {hideLoadingView, showLoadingView} from "./loading-view";
import {Toast} from "./Toast";
import {arrayFind} from "../utils";
/**
* 游戏舞台
......@@ -104,18 +105,22 @@ export class GameStage extends Container {
let total = assets.length;
if (customs) {
for (let custom of customs) {
if(custom.assets){
if (custom.assets) {
total += custom.assets.length;
}
}
}
showLoadingView();
await loadAssets(assets, p);
await loadAssets(assets, p).catch(e => {
console.log(e);
});
if (customs) {
for (let custom of customs) {
if(custom.assets){
await loadAssets(custom.assets, p);
if (custom.assets) {
await loadAssets(custom.assets, p).catch(e => {
console.log(e);
});
}
}
}
......@@ -183,7 +188,7 @@ export class GameStage extends Container {
* @param name
*/
getViewConfigByName(name) {
return this._config.views.find(view => view.name === name);
return arrayFind(this._config.views, view => view.name === name);
}
/**
......
......@@ -3,6 +3,7 @@
*/
import {globalLoader} from "../../2d/loader/Loader";
import {arrayFind} from "../utils";
let assetsConfig = [];
......@@ -16,6 +17,7 @@ const loaderMapping = {
'.json': 'Json',
'.svga': 'Svga',
'.sht': 'Sheet',
'': 'Raw',
};
/**
......@@ -29,18 +31,17 @@ export function loadAssets(config, onProgress?, onComplete?) {
return Promise.all(
config.map(assetConfig => {
assetsConfig.push(assetConfig);
return new Promise((resolve) => {
const loadFunc = loaderMapping[assetConfig.ext] || 'Raw';
globalLoader['load' + loadFunc](function (result, payload) {
if (result) {
let method = globalLoader['load' + loadFunc] || globalLoader.loadRaw;
return method.call(globalLoader, assetConfig.url, assetConfig.uuid).then(
(data)=>{
loaded++;
onProgress && onProgress(loaded, total);
} else {
},
(error)=>{
failedList.push(assetConfig.url);
}
resolve();
}, assetConfig.url);
})
);
})
).then(
() => {
......@@ -58,7 +59,7 @@ export function loadAssets(config, onProgress?, onComplete?) {
* @param uuid
*/
export function getAssetByUUID(uuid) {
return assetsConfig.find(item => item.uuid === uuid);
return arrayFind(assetsConfig,item => item.uuid === uuid);
}
/**
......@@ -66,5 +67,5 @@ export function getAssetByUUID(uuid) {
* @param name
*/
export function getAssetByName(name) {
return assetsConfig.find(item => item.name === name);
return arrayFind(assetsConfig,item => item.name === name);
}
......@@ -24,7 +24,7 @@ export class DataCenter extends EventDispatcher {
* @param origin
*/
registerGroup(name, origin?) {
this.store[name] = origin || {};
return this.store[name] = origin || {};
}
/**
......@@ -125,7 +125,7 @@ export class DataCenter extends EventDispatcher {
let group = this.getGroup(groupName);
if (!group) {
this.registerGroup(groupName);
group = this.registerGroup(groupName);
}
if (data !== undefined) {
if (path) {
......
......@@ -32,11 +32,12 @@ export class Image extends Sprite {
if(url.indexOf('://') >= 0){ //如果是有协议的地址
if (url.indexOf(assetScheme) === 0) {
let uuid = url.replace(assetScheme, '');
const assetConfig = getAssetByUUID(uuid);
/*const assetConfig = getAssetByUUID(uuid);
if(assetConfig){
url = assetConfig.url;
this.texture = Texture.fromImage(url);
}
}*/
this.texture = Texture.from(uuid);
}
} else{ //否则就使用素材名
const assetConfig = getAssetByName(url);
......
/**
* Created by rockyl on 2019-11-06.
*/
import Color from "color";
import {Shape} from "../../../";
import {Event} from "../../../2d/events";
import {dirtyFieldDetector} from "../../decorators";
import Graphics from "../../../2d/graphics/Graphics";
/**
* 图形基类
*/
class ShapeBase extends Shape {
class ShapeBase extends Graphics {
protected __fieldDirty = true;
@dirtyFieldDetector
......@@ -36,15 +38,12 @@ class ShapeBase extends Shape {
const {fillColor, strokeColor, strokeWidth} = this;
this.clear();
this.beginFill(fillColor);
this.beginFill(new Color(fillColor).rgbNumber());
if (strokeWidth > 0) {
this.beginStroke(strokeColor, strokeWidth);
this.lineStyle(strokeWidth, new Color(strokeColor).rgbNumber());
}
this.redraw();
this.endFill();
if (strokeWidth > 0) {
this.endStroke();
}
}
}
......@@ -64,7 +63,7 @@ export class Rect extends ShapeBase {
const {width, height, borderRadius,} = this;
if (borderRadius > 0) {
this.drawRoundRect(0, 0, width, height, borderRadius, borderRadius, borderRadius, borderRadius)
this.drawRoundedRect(0, 0, width, height, borderRadius);
} else {
this.drawRect(0, 0, width, height);
}
......
/**
* Created by rockyl on 2019-12-09.
*/
import BaseTexture from "../../2d/texture/BaseTexture";
import {Rectangle} from "../../2d/math";
import Texture from "../../2d/texture/Texture";
interface dataTm {
x: number, //x,y,w,h为图集上的切图位置数据
y: number,
w: number,
h: number,
ox: number, //ox,oy为偏移数据,trim裁剪的数据,在orig上的偏移{x:0,y:0,width:200,height:200}
oy: number,
sw: number, //sw,sh为原始宽高
sh: number,
ro: boolean, //是否旋转
}
export function createTextureSheet(baseTexture: BaseTexture, altaData) {
var frames = altaData;
var frameKeys = Object.keys(frames);
let frameIndex = 0;
while (frameIndex < frameKeys.length) {
//名字
const i = frameKeys[frameIndex];
//数据
const data: dataTm = frames[i];
//切图上的数据
let frame: Rectangle = null;
//裁切的数据
let trim: Rectangle = null;
//贴图原始尺寸
const orig = new Rectangle(
0,
0,
Math.floor(data.sw),
Math.floor(data.sh)
);
//如果旋转过
if (data.ro) {
frame = new Rectangle(
Math.floor(data.x),
Math.floor(data.y),
Math.floor(data.h),
Math.floor(data.w)
);
} else {
frame = new Rectangle(
Math.floor(data.x),
Math.floor(data.y),
Math.floor(data.w),
Math.floor(data.h)
);
}
//如果是被截掉过透明边界的
if (data.ox || data.oy) {
//其实就是在orig上切图,偏移
trim = new Rectangle(
Math.floor(data.ox),
Math.floor(data.oy),
Math.floor(data.w),
Math.floor(data.h)
);
}
var texture = new Texture(
baseTexture,
frame,
orig,
trim,
data.ro ? 2 : 0,
// data.anchor
);
//缓存下
Texture.addToCache(texture, i);
frameIndex++;
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
import {Container} from "../../2d/display";
import {Rect, Image, Label, Circle, ScrollView} from "./nodes";
import {propertyParse} from "../utils";
import {injectProperties, instantiateScript, propertyParse} from "../utils";
const nodeTypeMapping = {
node: Container,
......@@ -20,7 +20,7 @@ export function instantiate(config) {
}
function instantiateView(config) {
const {type, scripts} = config;
const {type} = config;
const nodeTypeDef = nodeTypeMapping[type];
if (!nodeTypeDef) {
......@@ -29,7 +29,7 @@ function instantiateView(config) {
}
const node = new nodeTypeDef();
const {name, uuid, properties, children, events} = config;
const {name, uuid, properties, children, events, scripts} = config;
node.name = name;
node.uuid = uuid;
node.__originConfig = config;
......@@ -56,14 +56,3 @@ function instantiateView(config) {
return node;
}
function instantiateScript(node, ScriptConfig) {
const {script: scriptName, props, disabled} = ScriptConfig;
const script = node.scriptsProxy.add(scriptName, props, disabled);
}
function injectProperties(target, source) {
for (let key in source) {
propertyParse(key, target, source);
}
}
......@@ -9,6 +9,8 @@ export * from './utils'
export * from './decorators'
export * from './game-warpper'
export * from './behavior-runtime'
export * from './web'
export * from './log-switch'
import {instantiate} from './game-warpper/view-interpreter'
export {
......
......@@ -3,43 +3,38 @@
*/
import {Stage} from "../2d/display";
import {RENDERER_TYPE, StageScaleMode} from "..";
import {registerCustomModuleFromConfig, registerScripts, RENDERER_TYPE, setProcessMetaLibs, StageScaleMode} from "..";
import {GameStage} from "./game-warpper";
import {setGlobalContext} from "./behavior-runtime";
import {globalLoader} from "../2d/loader/Loader";
import {Event} from "../2d/events/Event";
export let gameStage;
export let gameStage: GameStage;
export function launch(url, onAssetsProgress, onAssetsComplete) {
return new Promise((resolve, reject) => {
globalLoader.loadJson((s, payload) => {
if(s){
resolve(payload);
}else{
reject(payload);
}
}, url);
}).then(
config=>{
return globalLoader.loadJson(url)
.then(config => {
return launchWithConfig(config, onAssetsProgress, onAssetsComplete);
}
)
});
}
export function launchWithLocalStorage(id, onAssetsProgress, onAssetsComplete){
export function launchWithLocalStorage(id, onAssetsProgress, onAssetsComplete) {
const storeKey = 'preview-project-' + id;
let data = localStorage.getItem(storeKey);
let dataObj = JSON.parse(data);
let storeData = localStorage.getItem(storeKey);
let {data, processes, scripts, customs,} = JSON.parse(storeData);
setProcessMetaLibs(processes);
registerScripts(scripts);
registerCustomModuleFromConfig(customs);
return launchWithConfig(dataObj, onAssetsProgress, onAssetsComplete);
return launchWithConfig(data, onAssetsProgress, onAssetsComplete);
}
export function launchWithConfig(config, onAssetsProgress, onAssetsComplete) {
return new Promise(resolve => {
const {containerID, designWidth, designHeight, frameRate, scaleMode, rendererType,} = config.options;
const {containerId, designWidth, designHeight, frameRate, scaleMode, rendererType,} = config.options;
let stage = window['stage'] = new Stage(
containerID || "game-container",
containerId || "game-container",
designWidth || 750,
designHeight || 1334,
frameRate || 60,
......@@ -48,7 +43,7 @@ export function launchWithConfig(config, onAssetsProgress, onAssetsComplete) {
);
Stage.flushAll();
stage.addEventListener(Event.ON_INIT_STAGE, ()=>{
stage.addEventListener(Event.ON_INIT_STAGE, () => {
gameStage = new GameStage(stage);
setGlobalContext({
gameStage
......
/**
* Created by rockyl on 2019-12-11.
*/
const storeKey = 'zlog-switch';
export enum Logs{
PROCESS = 'process',
}
let store;
try {
store = JSON.parse(localStorage.getItem(storeKey));
store = store === null ? false : store;
} catch (e) {
store = false;
localStorage.setItem(storeKey, JSON.stringify(store));
}
export function getLogSwitch(id) {
return typeof store === 'object' ? (!!store[id]) : !!store;
}
......@@ -8,11 +8,14 @@ export const ESCAPE_REG_EXP = /\$\{[\u4e00-\u9fa5_a-zA-Z0-9\|]+\}/g;
export const linkedFlag = '$_linked_$';
export const nodeScheme = 'node://';
export function arrayFind(arr, callback) {
export function arrayFind(arr, predicate) {
if(!arr){
return ;
}
for (let i = 0, li = arr.length; i < li; i++) {
const item = arr[i];
if (callback(item, i, arr)) {
if (predicate(item, i, arr)) {
return item;
}
}
......@@ -212,9 +215,49 @@ export function htmlToPureText(htmlText) {
el = document.createElement('div');
}
el.innerHTML = htmlText;
document.body.append(el);
document.body.appendChild(el);
let pureText = el.innerText;
document.body.removeChild(el);
return pureText;
}
const zhReg = /[\u4e00-\u9fa5]/;
export function strLen(str){
let len = 0;
for(let char of str){
len += char.match(zhReg) ? 2 : 1;
}
return len;
}
export function strShort(str, limit, replace = '…'){
let result = '';
if(strLen(str) > limit){
let len = 0;
for (let i = 0, li = str.length; i < li; i++) {
const char = str[i];
len += char.match(zhReg) ? 2 : 1;
if(len > limit){
result += replace;
break;
}else{
result += char;
}
}
}else{
result = str;
}
return result;
}
export function instantiateScript(node, ScriptConfig) {
const {script: scriptName, props, disabled} = ScriptConfig;
const script = node.scriptsProxy.add(scriptName, props, disabled);
}
export function injectProperties(target, source) {
for (let key in source) {
propertyParse(key, target, source);
}
}
/**
* Created by rockyl on 2019-12-10.
*/
export let queryParams:any = {};
for(let item of location.search.replace('?', '').split('&')){
let arr = item.split('=');
queryParams[arr[0]] = arr.length === 1 ? true : arr[1];
}
......@@ -811,7 +811,7 @@ collection-visit@^1.0.0:
map-visit "^1.0.0"
object-visit "^1.0.0"
color-convert@^1.9.0:
color-convert@^1.9.0, color-convert@^1.9.1:
version "1.9.3"
resolved "https://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcolor-convert%2Fdownload%2Fcolor-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
integrity sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=
......@@ -823,6 +823,27 @@ color-name@1.1.3:
resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
color-name@^1.0.0:
version "1.1.4"
resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=
color-string@^1.5.2:
version "1.5.3"
resolved "https://registry.npm.taobao.org/color-string/download/color-string-1.5.3.tgz#c9bbc5f01b58b5492f3d6857459cb6590ce204cc"
integrity sha1-ybvF8BtYtUkvPWhXRZy2WQziBMw=
dependencies:
color-name "^1.0.0"
simple-swizzle "^0.2.2"
color@^3.1.2:
version "3.1.2"
resolved "https://registry.npm.taobao.org/color/download/color-3.1.2.tgz#68148e7f85d41ad7649c5fa8c8106f098d229e10"
integrity sha1-aBSOf4XUGtdknF+oyBBvCY0inhA=
dependencies:
color-convert "^1.9.1"
color-string "^1.5.2"
commander@^2.20.0, commander@^2.9.0, commander@~2.20.3:
version "2.20.3"
resolved "https://registry.npm.taobao.org/commander/download/commander-2.20.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
......@@ -2054,6 +2075,11 @@ is-arguments@^1.0.4:
resolved "https://registry.npm.taobao.org/is-arguments/download/is-arguments-1.0.4.tgz#3faf966c7cba0ff437fb31f6250082fcf0448cf3"
integrity sha1-P6+WbHy6D/Q3+zH2JQCC/PBEjPM=
is-arrayish@^0.3.1:
version "0.3.2"
resolved "https://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03"
integrity sha1-RXSirlb3qyBolvtDHq7tBm/fjwM=
is-binary-path@^1.0.0:
version "1.0.1"
resolved "https://registry.npm.taobao.org/is-binary-path/download/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898"
......@@ -3636,6 +3662,13 @@ signal-exit@^3.0.0:
resolved "https://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=
simple-swizzle@^0.2.2:
version "0.2.2"
resolved "https://registry.npm.taobao.org/simple-swizzle/download/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=
dependencies:
is-arrayish "^0.3.1"
snapdragon-node@^2.0.1:
version "2.1.1"
resolved "https://registry.npm.taobao.org/snapdragon-node/download/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"
......@@ -4005,7 +4038,7 @@ ts-loader@^4.0.0:
micromatch "^3.1.4"
semver "^5.0.1"
tslib@1.10.0, tslib@^1.10.0, tslib@^1.9.0:
tslib@1.10.0, tslib@^1.9.0:
version "1.10.0"
resolved "https://registry.npm.taobao.org/tslib/download/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha1-w8GflZc/sKYpc/sJ2Q2WHuQ+XIo=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment