feat:add lib and bundle

This commit is contained in:
pengfei.zhou 2021-04-23 17:57:34 +08:00 committed by osborn
parent 5982b15b0d
commit cc7df5d2ca
17 changed files with 427 additions and 322 deletions

View File

@ -2130,6 +2130,10 @@ var List = /** @class */ (function (_super) {
Property,
__metadata$8("design:type", Number)
], List.prototype, "scrolledPosition", void 0);
__decorate$8([
Property,
__metadata$8("design:type", Boolean)
], List.prototype, "scrollable", void 0);
return List;
}(Superview));
function list(config) {
@ -2245,6 +2249,10 @@ var Slider = /** @class */ (function (_super) {
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "loop", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
return Slider;
}(Superview));
function slider(config) {
@ -2338,6 +2346,10 @@ var Scroller = /** @class */ (function (_super) {
Property,
__metadata$6("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);
return Scroller;
}(Superview));
@ -2643,6 +2655,10 @@ var FlowLayout = /** @class */ (function (_super) {
Property,
__metadata$4("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate$4([
Property,
__metadata$4("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
return FlowLayout;
}(Superview));
function flowlayout(config) {
@ -2826,6 +2842,10 @@ var NestedSlider = /** @class */ (function (_super) {
Property,
__metadata$2("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0);
__decorate$2([
Property,
__metadata$2("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);
return NestedSlider;
}(Group));

View File

@ -116,110 +116,6 @@ function logw(...message) {
nativeLog('w', out);
}
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -431,9 +327,8 @@ class View {
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
for (let key in args) {
Reflect.set(this, key, Reflect.get(args, key, args), this);
//Reflect.deleteProperty(this.__dirty_props__, key)
Reflect.deleteProperty(this.__dirty_props__, key);
}
modal(context).alert(JSON.stringify(this.__dirty_props__));
});
}
}
@ -617,6 +512,80 @@ class Group extends Superview {
}
}
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
exports.LayoutSpec = void 0;
(function (LayoutSpec) {
/**
@ -1657,6 +1626,10 @@ __decorate$8([
Property,
__metadata$8("design:type", Number)
], List.prototype, "scrolledPosition", void 0);
__decorate$8([
Property,
__metadata$8("design:type", Boolean)
], List.prototype, "scrollable", void 0);
function list(config) {
const ret = new List;
for (let key in config) {
@ -1747,6 +1720,10 @@ __decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "loop", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
function slider(config) {
const ret = new Slider;
for (let key in config) {
@ -1820,6 +1797,10 @@ __decorate$6([
Property,
__metadata$6("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -2059,6 +2040,10 @@ __decorate$4([
Property,
__metadata$4("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate$4([
Property,
__metadata$4("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {
@ -2200,6 +2185,10 @@ __decorate$2([
Property,
__metadata$2("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0);
__decorate$2([
Property,
__metadata$2("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -2277,6 +2266,36 @@ function switchView(config) {
return ret;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
function navbar(context) {
const entity = context.entity;
let panel = undefined;

View File

@ -1637,110 +1637,6 @@ class Mutable {
}
}
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -1952,9 +1848,8 @@ class View {
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
for (let key in args) {
Reflect.set(this, key, Reflect.get(args, key, args), this);
//Reflect.deleteProperty(this.__dirty_props__, key)
Reflect.deleteProperty(this.__dirty_props__, key);
}
modal(context).alert(JSON.stringify(this.__dirty_props__));
});
}
}
@ -2138,6 +2033,80 @@ class Group extends Superview {
}
}
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
exports.LayoutSpec = void 0;
(function (LayoutSpec) {
/**
@ -3178,6 +3147,10 @@ __decorate$8([
Property,
__metadata$8("design:type", Number)
], List.prototype, "scrolledPosition", void 0);
__decorate$8([
Property,
__metadata$8("design:type", Boolean)
], List.prototype, "scrollable", void 0);
function list(config) {
const ret = new List;
for (let key in config) {
@ -3268,6 +3241,10 @@ __decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "loop", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
function slider(config) {
const ret = new Slider;
for (let key in config) {
@ -3341,6 +3318,10 @@ __decorate$6([
Property,
__metadata$6("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -3580,6 +3561,10 @@ __decorate$4([
Property,
__metadata$4("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate$4([
Property,
__metadata$4("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {
@ -3721,6 +3706,10 @@ __decorate$2([
Property,
__metadata$2("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0);
__decorate$2([
Property,
__metadata$2("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -3798,6 +3787,36 @@ function switchView(config) {
return ret;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
function navbar(context) {
const entity = context.entity;
let panel = undefined;

5
doric-js/index.d.ts vendored
View File

@ -610,6 +610,7 @@ declare module 'doric/lib/src/widget/list' {
y: number;
}) => void;
scrolledPosition?: number;
scrollable?: boolean;
scrollToItem(context: BridgeContext, index: number, config?: {
animated?: boolean;
}): Promise<any>;
@ -637,6 +638,7 @@ declare module 'doric/lib/src/widget/slider' {
batchCount: number;
onPageSlided?: (index: number) => void;
loop?: boolean;
scrollable?: boolean;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>;
}
@ -662,6 +664,7 @@ declare module 'doric/lib/src/widget/scroller' {
x: number;
y: number;
}) => void;
scrollable?: boolean;
allSubviews(): View[];
toModel(): NativeViewModel;
scrollTo(context: BridgeContext, offset: {
@ -726,6 +729,7 @@ declare module 'doric/lib/src/widget/flowlayout' {
x: number;
y: number;
}) => void;
scrollable?: boolean;
reset(): void;
toModel(): NativeViewModel;
}
@ -771,6 +775,7 @@ declare module 'doric/lib/src/widget/nestedSlider' {
import { BridgeContext } from 'doric/lib/src/runtime/global';
export class NestedSlider extends Group {
onPageSlided?: (index: number) => void;
scrollable?: boolean;
addSlideItem(view: View): void;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>;

View File

@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { obj2Model } from "../util/types";
import { uniqueId } from "../util/uniqueId";
import { loge } from "../util/log";
import { modal } from "../native/modal";
const PROP_CONSIST = 1;
const PROP_INCONSIST = 2;
export function Property(target, propKey) {
@ -213,9 +212,8 @@ export class View {
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
for (let key in args) {
Reflect.set(this, key, Reflect.get(args, key, args), this);
//Reflect.deleteProperty(this.__dirty_props__, key)
Reflect.deleteProperty(this.__dirty_props__, key);
}
modal(context).alert(JSON.stringify(this.__dirty_props__));
});
}
}

View File

@ -26,6 +26,7 @@ export declare class FlowLayout extends Superview {
x: number;
y: number;
}) => void;
scrollable?: boolean;
reset(): void;
private getItem;
private renderBunchedItems;

View File

@ -114,6 +114,10 @@ __decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
export function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {

View File

@ -25,6 +25,7 @@ export declare class List extends Superview {
y: number;
}) => void;
scrolledPosition?: number;
scrollable?: boolean;
scrollToItem(context: BridgeContext, index: number, config?: {
animated?: boolean;
}): Promise<any>;

View File

@ -109,6 +109,10 @@ __decorate([
Property,
__metadata("design:type", Number)
], List.prototype, "scrolledPosition", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], List.prototype, "scrollable", void 0);
export function list(config) {
const ret = new List;
for (let key in config) {

View File

@ -2,6 +2,7 @@ import { Group, View } from '../ui/view';
import { BridgeContext } from '../runtime/global';
export declare class NestedSlider extends Group {
onPageSlided?: (index: number) => void;
scrollable?: boolean;
addSlideItem(view: View): void;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>;

View File

@ -38,3 +38,7 @@ __decorate([
Property,
__metadata("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);

View File

@ -15,6 +15,7 @@ export declare class Scroller extends Superview {
x: number;
y: number;
}) => void;
scrollable?: boolean;
allSubviews(): View[];
toModel(): NativeViewModel;
scrollTo(context: BridgeContext, offset: {

View File

@ -62,3 +62,7 @@ __decorate([
Property,
__metadata("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);

View File

@ -15,6 +15,7 @@ export declare class Slider extends Superview {
batchCount: number;
onPageSlided?: (index: number) => void;
loop?: boolean;
scrollable?: boolean;
private getItem;
private renderBunchedItems;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;

View File

@ -80,6 +80,10 @@ __decorate([
Property,
__metadata("design:type", Boolean)
], Slider.prototype, "loop", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
export function slider(config) {
const ret = new Slider;
for (let key in config) {

View File

@ -1691,110 +1691,6 @@ function logw(...message) {
nativeLog('w', out);
}
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -2006,9 +1902,8 @@ class View {
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
for (let key in args) {
Reflect.set(this, key, Reflect.get(args, key, args), this);
//Reflect.deleteProperty(this.__dirty_props__, key)
Reflect.deleteProperty(this.__dirty_props__, key);
}
modal(context).alert(JSON.stringify(this.__dirty_props__));
});
}
}
@ -2192,6 +2087,80 @@ class Group extends Superview {
}
}
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
exports.LayoutSpec = void 0;
(function (LayoutSpec) {
/**
@ -3232,6 +3201,10 @@ __decorate$8([
Property,
__metadata$8("design:type", Number)
], List.prototype, "scrolledPosition", void 0);
__decorate$8([
Property,
__metadata$8("design:type", Boolean)
], List.prototype, "scrollable", void 0);
function list(config) {
const ret = new List;
for (let key in config) {
@ -3322,6 +3295,10 @@ __decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "loop", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
function slider(config) {
const ret = new Slider;
for (let key in config) {
@ -3395,6 +3372,10 @@ __decorate$6([
Property,
__metadata$6("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -3634,6 +3615,10 @@ __decorate$4([
Property,
__metadata$4("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate$4([
Property,
__metadata$4("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {
@ -3775,6 +3760,10 @@ __decorate$2([
Property,
__metadata$2("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0);
__decorate$2([
Property,
__metadata$2("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -3852,6 +3841,36 @@ function switchView(config) {
return ret;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
function navbar(context) {
const entity = context.entity;
let panel = undefined;

File diff suppressed because one or more lines are too long