build change

This commit is contained in:
pengfei.zhou 2020-01-17 17:38:25 +08:00 committed by osborn
parent ff87034413
commit 3aaa5a8708
2 changed files with 107 additions and 82 deletions

View File

@ -1781,7 +1781,6 @@ class View {
nativeChannel(context, name) { nativeChannel(context, name) {
let thisView = this; let thisView = this;
return function (args = undefined) { return function (args = undefined) {
const func = context.shader.command;
const viewIds = []; const viewIds = [];
while (thisView != undefined) { while (thisView != undefined) {
viewIds.push(thisView.viewId); viewIds.push(thisView.viewId);
@ -1792,7 +1791,7 @@ class View {
name, name,
args, args,
}; };
return Reflect.apply(func, undefined, [params]); return context.callNative('shader', 'command', params);
}; };
} }
getWidth(context) { getWidth(context) {
@ -1854,10 +1853,6 @@ __decorate([
Property, Property,
__metadata("design:type", Boolean) __metadata("design:type", Boolean)
], View.prototype, "hidden", void 0); ], View.prototype, "hidden", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], View.prototype, "viewId", void 0);
__decorate([ __decorate([
Property, Property,
__metadata("design:type", Object) __metadata("design:type", Object)
@ -2023,6 +2018,8 @@ class Gravity {
} }
Gravity.origin = new Gravity; Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center(); Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left(); Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right(); Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top(); Gravity.Top = Gravity.origin.top();
@ -2285,7 +2282,7 @@ class Panel {
}, undefined); }, undefined);
} }
nativeRender(model) { nativeRender(model) {
this.context.shader.render(model); this.context.callNative("shader", "render", model);
} }
hookBeforeNativeCall() { hookBeforeNativeCall() {
if (Environment.platform !== 'web') { if (Environment.platform !== 'web') {
@ -2697,6 +2694,10 @@ __decorate$3([
Property, Property,
__metadata$3("design:type", Gravity) __metadata$3("design:type", Gravity)
], Text.prototype, "textAlignment", void 0); ], Text.prototype, "textAlignment", void 0);
__decorate$3([
Property,
__metadata$3("design:type", String)
], Text.prototype, "fontStyle", void 0);
function text(config) { function text(config) {
const ret = new Text; const ret = new Text;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();
@ -3330,29 +3331,29 @@ function draggable(views, config) {
function modal(context) { function modal(context) {
return { return {
toast: (msg, gravity = Gravity.Bottom) => { toast: (msg, gravity = Gravity.Bottom) => {
context.modal.toast({ context.callNative('modal', 'toast', {
msg, msg,
gravity: gravity.toModel(), gravity: gravity.toModel(),
}); });
}, },
alert: (arg) => { alert: (arg) => {
if (typeof arg === 'string') { if (typeof arg === 'string') {
return context.modal.alert({ msg: arg }); return context.callNative('modal', 'alert', { msg: arg });
} }
else { else {
return context.modal.alert(arg); return context.callNative('modal', 'alert', arg);
} }
}, },
confirm: (arg) => { confirm: (arg) => {
if (typeof arg === 'string') { if (typeof arg === 'string') {
return context.modal.confirm({ msg: arg }); return context.callNative('modal', 'confirm', { msg: arg });
} }
else { else {
return context.modal.confirm(arg); return context.callNative('modal', 'confirm', arg);
} }
}, },
prompt: (arg) => { prompt: (arg) => {
return context.modal.prompt(arg); return context.callNative('modal', 'prompt', arg);
}, },
}; };
} }
@ -3365,36 +3366,30 @@ function navbar(context) {
} }
return { return {
isHidden: () => { isHidden: () => {
return context.navbar.isHidden(); return context.callNative('navbar', 'isHidden');
}, },
setHidden: (hidden) => { setHidden: (hidden) => {
return context.navbar.setHidden({ return context.callNative('navbar', 'setHidden', { hidden, });
hidden,
});
}, },
setTitle: (title) => { setTitle: (title) => {
return context.navbar.setTitle({ return context.callNative('navbar', 'setTitle', { title, });
title,
});
}, },
setBgColor: (color) => { setBgColor: (color) => {
return context.navbar.setBgColor({ return context.callNative('navbar', 'setBgColor', { color: color.toModel(), });
color: color.toModel(),
});
}, },
setLeft: (view) => { setLeft: (view) => {
if (panel) { if (panel) {
panel.clearHeadViews("navbar_left"); panel.clearHeadViews("navbar_left");
panel.addHeadView("navbar_left", view); panel.addHeadView("navbar_left", view);
} }
return context.navbar.setLeft(view.toModel()); return context.callNative('navbar', 'setLeft', view.toModel());
}, },
setRight: (view) => { setRight: (view) => {
if (panel) { if (panel) {
panel.clearHeadViews("navbar_right"); panel.clearHeadViews("navbar_right");
panel.addHeadView("navbar_right", view); panel.addHeadView("navbar_right", view);
} }
return context.navbar.setRight(view.toModel()); return context.callNative('navbar', 'setRight', view.toModel());
} }
}; };
} }
@ -3405,12 +3400,12 @@ function navigator(context) {
if (config && config.extra) { if (config && config.extra) {
config.extra = JSON.stringify(config.extra); config.extra = JSON.stringify(config.extra);
} }
return context.navigator.push({ return context.callNative('navigator', 'push', {
scheme, config scheme, config
}); });
}, },
pop: (animated = true) => { pop: (animated = true) => {
return context.navigator.pop({ animated }); return context.callNative('navigator', 'pop', { animated });
}, },
}; };
} }
@ -3432,7 +3427,7 @@ function transformRequest(request) {
function network(context) { function network(context) {
return { return {
request: (config) => { request: (config) => {
return context.network.request(transformRequest(config)); return context.callNative('network', 'request', transformRequest(config));
}, },
get: (url, config) => { get: (url, config) => {
let finalConfig = config; let finalConfig = config;
@ -3441,7 +3436,7 @@ function network(context) {
} }
finalConfig.url = url; finalConfig.url = url;
finalConfig.method = "get"; finalConfig.method = "get";
return context.network.request(transformRequest(finalConfig)); return context.callNative('network', 'request', transformRequest(finalConfig));
}, },
post: (url, data, config) => { post: (url, data, config) => {
let finalConfig = config; let finalConfig = config;
@ -3453,7 +3448,7 @@ function network(context) {
if (data !== undefined) { if (data !== undefined) {
finalConfig.data = data; finalConfig.data = data;
} }
return context.network.request(transformRequest(finalConfig)); return context.callNative('network', 'request', transformRequest(finalConfig));
}, },
put: (url, data, config) => { put: (url, data, config) => {
let finalConfig = config; let finalConfig = config;
@ -3465,7 +3460,7 @@ function network(context) {
if (data !== undefined) { if (data !== undefined) {
finalConfig.data = data; finalConfig.data = data;
} }
return context.network.request(transformRequest(finalConfig)); return context.callNative('network', 'request', transformRequest(finalConfig));
}, },
delete: (url, data, config) => { delete: (url, data, config) => {
let finalConfig = config; let finalConfig = config;
@ -3474,7 +3469,7 @@ function network(context) {
} }
finalConfig.url = url; finalConfig.url = url;
finalConfig.method = "delete"; finalConfig.method = "delete";
return context.network.request(transformRequest(finalConfig)); return context.callNative('network', 'request', transformRequest(finalConfig));
}, },
}; };
} }
@ -3482,16 +3477,16 @@ function network(context) {
function storage(context) { function storage(context) {
return { return {
setItem: (key, value, zone) => { setItem: (key, value, zone) => {
return context.storage.setItem({ key, value, zone }); return context.callNative('storage', 'setItem', { key, value, zone });
}, },
getItem: (key, zone) => { getItem: (key, zone) => {
return context.storage.getItem({ key, zone }); return context.callNative('storage', 'getItem', { key, zone });
}, },
remove: (key, zone) => { remove: (key, zone) => {
return context.storage.remove({ key, zone }); return context.callNative('storage', 'remove', { key, zone });
}, },
clear: (zone) => { clear: (zone) => {
return context.storage.clear({ zone }); return context.callNative('storage', 'clear', { zone });
}, },
}; };
} }
@ -3507,7 +3502,7 @@ function popover(context) {
if (panel) { if (panel) {
panel.addHeadView("popover", view); panel.addHeadView("popover", view);
} }
return context.popover.show(view.toModel()); return context.callNative('popover', 'show', view.toModel());
}, },
dismiss: (view = undefined) => { dismiss: (view = undefined) => {
if (panel) { if (panel) {
@ -3518,7 +3513,7 @@ function popover(context) {
panel.clearHeadViews("popover"); panel.clearHeadViews("popover");
} }
} }
return context.popover.dismiss(view ? { id: view.viewId } : undefined); return context.callNative('popover', 'dismiss', view ? { id: view.viewId } : undefined);
}, },
}; };
} }
@ -3586,21 +3581,15 @@ function repeat(action) {
}; };
} }
/* var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
* Copyright [2019] [Doric.Pub] function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
* return new (P || (P = Promise))(function (resolve, reject) {
* Licensed under the Apache License, Version 2.0 (the "License"); function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
* you may not use this file except in compliance with the License. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
* You may obtain a copy of the License at function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
* step((generator = generator.apply(thisArg, _arguments || [])).next());
* http://www.apache.org/licenses/LICENSE-2.0 });
* };
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** /**
* Only supports x,y,width,height,corner(just for four corners),rotation,bgColor, * Only supports x,y,width,height,corner(just for four corners),rotation,bgColor,
* @param panel @see Panel * @param panel @see Panel
@ -3609,33 +3598,30 @@ function animate(context) {
const entity = context.entity; const entity = context.entity;
if (entity instanceof Panel) { if (entity instanceof Panel) {
let panel = entity; let panel = entity;
return (args) => { return (args) => __awaiter(this, void 0, void 0, function* () {
return takeLet(panel.context.animate)(it => { yield context.callNative('animate', 'submit');
return it.submit().then(() => { args.animations();
args.animations(); return takeLet(panel.getRootView())(root => {
return takeLet(panel.getRootView())(root => { if (root.isDirty()) {
if (root.isDirty()) { const model = root.toModel();
const model = root.toModel(); model.duration = args.duration;
model.duration = args.duration; const ret = context.callNative('animate', 'animateRender', model);
const ret = it.animateRender(model); root.clean();
root.clean(); return ret;
return ret; }
for (let map of panel.allHeadViews()) {
for (let v of map.values()) {
if (v.isDirty()) {
const model_1 = v.toModel();
const ret_1 = context.callNative('animate', 'animateRender', model_1);
v.clean();
return ret_1;
} }
for (let map of panel.allHeadViews()) { }
for (let v of map.values()) { }
if (v.isDirty()) { throw new Error('Cannot find any animated elements');
const model = v.toModel();
const ret = it.animateRender(model);
it.clean();
return ret;
}
}
}
throw new Error('Cannot find any animated elements');
});
});
}); });
}; });
} }
else { else {
return (args) => { return (args) => {
@ -3650,19 +3636,37 @@ function notification(context) {
if (args.data !== undefined) { if (args.data !== undefined) {
args.data = JSON.stringify(args.data); args.data = JSON.stringify(args.data);
} }
return context.notification.publish(args); return context.callNative('notification', 'publish', args);
}, },
subscribe: (args) => { subscribe: (args) => {
args.callback = context.function2Id(args.callback); args.callback = context.function2Id(args.callback);
return context.notification.subscribe(args); return context.callNative('notification', 'subscribe', args);
}, },
unsubscribe: (subscribeId) => { unsubscribe: (subscribeId) => {
context.removeFuncById(subscribeId); context.removeFuncById(subscribeId);
return context.notification.unsubscribe(subscribeId); return context.callNative('notification', 'unsubscribe', subscribeId);
} }
}; };
} }
(function (StatusBarMode) {
StatusBarMode[StatusBarMode["LIGHT"] = 0] = "LIGHT";
StatusBarMode[StatusBarMode["DARK"] = 1] = "DARK";
})(exports.StatusBarMode || (exports.StatusBarMode = {}));
function statusbar(context) {
return {
setHidden: (hidden) => {
return context.callNative('statusbar', 'setHidden', { hidden });
},
setMode: (mode) => {
return context.callNative('statusbar', 'setMode', { mode });
},
setColor: (color) => {
return context.callNative('statusbar', 'setColor', { color: color.toModel() });
},
};
}
class Observable { class Observable {
constructor(provider, clz) { constructor(provider, clz) {
this.observers = new Set; this.observers = new Set;
@ -3816,6 +3820,7 @@ exports.scroller = scroller;
exports.slideItem = slideItem; exports.slideItem = slideItem;
exports.slider = slider; exports.slider = slider;
exports.stack = stack; exports.stack = stack;
exports.statusbar = statusbar;
exports.storage = storage; exports.storage = storage;
exports.take = take; exports.take = take;
exports.takeAlso = takeAlso; exports.takeAlso = takeAlso;
@ -4526,6 +4531,26 @@ var doric_web = (function (exports, axios, sandbox) {
v.style.alignItems = "center"; v.style.alignItems = "center";
} }
break; break;
case "fontStyle":
switch (prop) {
case "bold":
v.style.fontWeight = "bold";
v.style.fontStyle = "normal";
break;
case "italic":
v.style.fontWeight = "normal";
v.style.fontStyle = "italic";
break;
case "bold_italic":
v.style.fontWeight = "bold";
v.style.fontStyle = "italic";
break;
default:
v.style.fontWeight = "normal";
v.style.fontStyle = "normal";
break;
}
break;
default: default:
super.blendProps(v, propName, prop); super.blendProps(v, propName, prop);
break; break;

File diff suppressed because one or more lines are too long