'use strict';

var doric = require('doric');

const colors = [
    "#70a1ff",
    "#7bed9f",
    "#ff6b81",
    "#a4b0be",
    "#f0932b",
    "#eb4d4b",
    "#6ab04c",
    "#e056fd",
    "#686de0",
    "#30336b",
].map(e => doric.Color.parse(e));

var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
const files = [
    {
        name: "五子棋",
        url: "./dist/Gobang.js",
        alias: "Gobang.js",
        icon: "data:image/png;base64,[encoded data, 10684 characters]",
    },
    {
        name: "贪吃蛇",
        url: "./dist/Snake.js",
        alias: "Snake.js",
        icon: "data:image/png;base64,[encoded data, 13352 characters]",
    },
    {
        name: "列表",
        url: "./dist/ListDemo.js",
        alias: "ListDemo.js",
        icon: "",
    },
    {
        name: "Counter",
        url: "../doric-demo/bundle/src/Counter.js",
        alias: "Counter.js",
        icon: "",
    },
    {
        name: "EffectsDemo",
        url: "../doric-demo/bundle/src/EffectsDemo.js",
        alias: "EffectsDemo.js",
        icon: "",
    },
    {
        name: "ImageDemo",
        url: "../doric-demo/bundle/src/ImageDemo.js",
        alias: "ImageDemo.js",
        icon: "",
    },
    {
        name: "LayoutDemo",
        url: "../doric-demo/bundle/src/LayoutDemo.js",
        alias: "LayoutDemo.js",
        icon: "",
    },
];
let DoricPlayground = class DoricPlayground extends doric.Panel {
    onShow() {
        doric.navbar(context).setTitle("Doric Playground");
    }
    build(rootView) {
        doric.scroller(doric.vlayout([
            doric.hlayout([
                doric.text({
                    text: "Demo列表",
                    textSize: 20,
                }).apply({
                    layoutConfig: doric.layoutConfig().fit().configAlignment(doric.gravity().centerY()).configMargin({
                        left: 15,
                    })
                })
            ]).apply({
                layoutConfig: doric.layoutConfig().just().configWidth(doric.LayoutSpec.MOST).configMargin({
                    top: 0,
                }),
                height: 50,
                backgroundColor: colors[3].alpha(0.2),
            }),
            ...files.map(e => doric.vlayout([
                doric.hlayout([
                    doric.image({
                        imageBase64: e.icon,
                        layoutConfig: doric.layoutConfig().just(),
                        width: 50,
                        height: 50,
                        scaleType: doric.ScaleType.ScaleAspectFit,
                    }),
                    doric.text({
                        text: e.name,
                        textSize: 30,
                        textColor: doric.Color.BLACK,
                    }).apply({
                        layoutConfig: doric.layoutConfig().fit().configAlignment(doric.gravity().centerY()).configMargin({
                            left: 15,
                        })
                    }),
                ]).apply({
                    layoutConfig: doric.layoutConfig().just().configWidth(doric.LayoutSpec.MOST).configMargin({
                        top: 10,
                        bottom: 10
                    }),
                    height: 50,
                }),
                (new doric.Stack).apply({
                    layoutConfig: doric.layoutConfig().just().configWidth(doric.LayoutSpec.MOST),
                    height: 1,
                    backgroundColor: colors[3].alpha(0.2),
                }),
            ]).apply({
                layoutConfig: doric.layoutConfig().fit().configWidth(doric.LayoutSpec.MOST),
                onClick: () => {
                    doric.navigator(context).push(e.url, {
                        alias: e.alias,
                    });
                },
            })),
            doric.hlayout([
                doric.text({
                    text: "待上线",
                    textSize: 20,
                }).apply({
                    layoutConfig: doric.layoutConfig().fit().configAlignment(doric.gravity().centerY()).configMargin({
                        left: 15,
                    })
                })
            ]).apply({
                layoutConfig: doric.layoutConfig().just().configWidth(doric.LayoutSpec.MOST).configMargin({
                    top: 0,
                }),
                height: 50,
                backgroundColor: colors[3].alpha(0.2),
            }),
        ])
            .apply({
                layoutConfig: doric.layoutConfig().fit().configWidth(doric.LayoutSpec.MOST)
            }))
            .apply({
                layoutConfig: doric.layoutConfig().most()
            })
            .in(rootView);
    }
};
DoricPlayground = __decorate([
    Entry
], DoricPlayground);
//# sourceMappingURL=DoricPlayground.js.map
