UNPKG

@morjs/runtime-web

Version:
81 lines 3.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const react_1 = tslib_1.__importDefault(require("react")); // eslint-disable-next-line node/no-missing-import const block_1 = require("./components/block"); // eslint-disable-next-line node/no-missing-import const slot_1 = require("./components/slot"); const attribute_value_1 = require("./dsl/attribute-value"); const axml_api_1 = require("./dsl/axml-api"); const event_1 = require("./dsl/event"); const for_1 = tslib_1.__importDefault(require("./dsl/for")); const ref_1 = tslib_1.__importDefault(require("./dsl/ref")); const rpx_1 = require("./dsl/rpx"); const style_1 = require("./dsl/style"); const template_1 = tslib_1.__importDefault(require("./dsl/template")); // import TwoWayBinding from './dsl/two-way-binding'; require("./public/app"); const index_1 = require("./public/index"); exports.default = { Component: index_1.Component, Page: index_1.Page, createTemplateManager: function () { return new template_1.default(); }, Slot: slot_1.Slot, Block: block_1.Block, slotScope(f, name) { // 主要是为了防止因为打包的问题,将方法的名称重命名,导致slot匹配不到 if (name) { f._name = name; } return f; }, createStyle: style_1.createStyle, // 事件绑定 getEvent: event_1.getEvent, // 对方法绑定this bindThis: event_1.bindThis, registEvents: event_1.registEvents, // ref 绑定 ref: ref_1.default, // 合并配置 mergeConfig(appConfig, config) { // NOTE: appConfig 为全局配置,config为局部配置,但是config 的优先级大于 appConfig // 这个版本主要是window。而且目前也不需要区分page 还是 component 。相关的配置基本上随着版本走的。 // 这里也算是预留了一个未来配置扩展扣子 const result = Object.assign(Object.assign(Object.assign({}, appConfig), config), { window: Object.assign(Object.assign({}, appConfig.window), config.window) }); return result; }, toJsonString: attribute_value_1.toJsonString, // 将内容转换成字符串 // TODO: 要改名字,改成 renderContent getString(content) { try { if (content === undefined || content == null) { return ''; } // 如果是函数,那么直接返回函数 if (typeof content === 'function') return content; if (react_1.default.isValidElement(content)) { return content; } return content.toString(); } catch (err) { console.log(err); return ''; } }, // 根据给定的value,获得for指令可用的数组 getForValue: for_1.default, // 创建一个专门提供给axml 的api axmlApi: axml_api_1.axmlApi, // 手动设置根节点fontsize setRootFontSizeForRem: rpx_1.setRootFontSizeForRem, // 自动同步根节点的 font-size, 并设置 ROOT_VALUE autoSyncRootFontSize: rpx_1.autoSyncRootFontSize }; //# sourceMappingURL=index.js.map