UNPKG

@bytedance/mona-shared

Version:

mona shared utils

93 lines 2.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DEFAULT_HOST = exports.DEFAULT_PORT = exports.GLOBAL_LIFECYCLE_STORE = exports.CUSTOM_COMPONENT_PROTOCOL = exports.CUSTOM_REF = exports.MiniComponentAliasMap = exports.ComponentType = exports.webComponentType = exports.RENDER_NODE = void 0; exports.RENDER_NODE = { COMPLIER_KEY: 'k', COMPLIER_TYPE: 't', COMPLIER_NODES: 'n', COMPLIER_CHILDREN: 'c', COMPLIER_TEXT: 'x', COMPLIER_PROPS: 'p', }; const MiniComponentType = { text: '1', block: '2', 'rich-text': '3', progress: '4', icon: '5', view: '6', 'scroll-view': '7', swiper: '8', 'swiper-item': '9', 'movable-area': '10', 'movable-view': '11', button: '12', checkbox: '13', 'checkbox-group': '14', form: '15', input: '16', label: '17', picker: '18', 'picker-view': '19', 'picker-view-column': '20', radio: '21', 'radio-group': '22', slider: '23', switch: '24', textarea: '25', navigator: '26', image: '27', video: '28', 'live-player': '29', camera: '30', canvas: '31', map: '32', 'web-view': '33', ad: '34', 'open-data': '35', ptext: '36', 'member-button': '37', 'coupon-card': '38', 'product-follow-button': '39', 'sku-button': '40', 'shop-follow-card': '41', }; // TODO:开发模式语义化, 小程序运行时 build两份代码, index.production.js, index.development.js // if (process.env.NODE_ENV === 'production') { // RENDER_NODE = { // COMPLIER_KEY: 'key', // COMPLIER_TYPE: 'type', // COMPLIER_NODES: 'nodes', // COMPLIER_CHILDREN: 'children', // COMPLIER_TEXT: 'text', // COMPLIER_PROPS: 'props', // }; // for (const k in MiniComponentType) { // MiniComponentType[k as keyof typeof MiniComponentType] = k; // } // } exports.webComponentType = { span: MiniComponentType.text, div: MiniComponentType.view, section: MiniComponentType.view, article: MiniComponentType.view, aside: MiniComponentType.view, footer: MiniComponentType.view, address: MiniComponentType.view, main: MiniComponentType.view, nav: MiniComponentType.view, code: MiniComponentType.view, img: MiniComponentType.image, iframe: MiniComponentType['web-view'], }; exports.ComponentType = Object.assign(Object.assign({}, exports.webComponentType), MiniComponentType); exports.MiniComponentAliasMap = Object.keys(MiniComponentType).reduce((pre, item) => { pre[MiniComponentType[item]] = item; return pre; }, {}); exports.CUSTOM_REF = '__ref'; exports.CUSTOM_COMPONENT_PROTOCOL = 'native://'; exports.GLOBAL_LIFECYCLE_STORE = '_mona_app_lifecycle'; exports.DEFAULT_PORT = '9999'; exports.DEFAULT_HOST = 'localhost'; //# sourceMappingURL=constants.js.map