├── website ├── CNAME ├── bg.mp4 ├── playground │ └── images │ │ └── iphone.png ├── package.json ├── 404.html └── README.md ├── packages ├── weex-rax-framework │ ├── .gitignore │ ├── src │ │ ├── builtin.js │ │ ├── define.weex.js │ │ ├── require.weex.js │ │ ├── performance.weex.js │ │ ├── timer.weex.js │ │ └── semver.js │ ├── package.json │ └── build ├── rax │ ├── src │ │ ├── version.js │ │ ├── server │ │ │ ├── renderer.js │ │ │ ├── escapeText.js │ │ │ ├── __tests__ │ │ │ │ └── escapeText.js │ │ │ └── renderToString.js │ │ ├── check.js │ │ ├── findComponentInstance.js │ │ ├── debug │ │ │ ├── devtools.js │ │ │ └── hook.js │ │ ├── vdom │ │ │ ├── host.js │ │ │ ├── root.js │ │ │ ├── stateless.js │ │ │ ├── getElementKeyName.js │ │ │ ├── shouldUpdateComponent.js │ │ │ ├── scheduler.js │ │ │ ├── instantiateComponent.js │ │ │ ├── empty.js │ │ │ ├── shallowEqual.js │ │ │ ├── __tests__ │ │ │ │ └── text.js │ │ │ └── ref.js │ │ ├── purecomponent.js │ │ ├── unmountComponentAtNode.js │ │ ├── component.js │ │ ├── index.js │ │ ├── render.js │ │ ├── style │ │ │ ├── styleToCSS.js │ │ │ └── __tests__ │ │ │ │ ├── styleToCSS.js │ │ │ │ └── flexbox.js │ │ ├── setNativeProps.js │ │ ├── __tests__ │ │ │ ├── proptypes.js │ │ │ ├── setNativeProps.js │ │ │ ├── unmountComponentAtNode.js │ │ │ └── component.js │ │ ├── testing │ │ │ ├── renderer.js │ │ │ └── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ └── snapshot.js.snap │ │ │ │ └── snapshot.js │ │ ├── findDOMNode.js │ │ ├── proptypes.js │ │ └── inject.js │ ├── .npmignore │ ├── package.json │ └── README.md ├── runtime-shared │ ├── README.md │ ├── src │ │ └── fontface.js │ └── package.json ├── weex-rax-examples │ ├── README.md │ ├── components │ │ ├── a.js │ │ └── input.js │ ├── package.json │ ├── common │ │ ├── StyleItem.js │ │ └── Tip.js │ ├── syntax │ │ └── hello-world.js │ ├── index.js │ └── style │ │ └── index.js ├── babel-preset-rax │ ├── .npmignore │ ├── src │ │ ├── resolvePlugins.js │ │ └── index.js │ ├── README.md │ └── package.json ├── rax-webpack-plugin │ ├── .npmignore │ ├── src │ │ ├── __tests__ │ │ │ └── fixtures │ │ │ │ ├── umd │ │ │ │ ├── index.js │ │ │ │ └── webpack.config.js │ │ │ │ ├── bundle │ │ │ │ ├── index.js │ │ │ │ └── webpack.config.js │ │ │ │ ├── factory │ │ │ │ ├── index.js │ │ │ │ └── webpack.config.js │ │ │ │ ├── function │ │ │ │ ├── index.js │ │ │ │ └── webpack.config.js │ │ │ │ ├── module │ │ │ │ ├── index.js │ │ │ │ └── webpack.config.js │ │ │ │ ├── bundle-compatible │ │ │ │ ├── index.js │ │ │ │ └── webpack.config.js │ │ │ │ └── factory-factoryGlobals │ │ │ │ ├── index.js │ │ │ │ └── webpack.config.js │ │ └── BuiltinModules.js │ └── package.json ├── element-loader │ ├── src │ │ ├── defaultKey.js │ │ ├── __mocks__ │ │ │ └── fs.js │ │ ├── __tests__ │ │ │ ├── getBabelConfig.js │ │ │ ├── parserHTML.js │ │ │ └── transformer.js │ │ ├── getBabelConfig.js │ │ ├── node-loader.js │ │ └── template-loader.js │ └── package.json ├── rax-test-renderer │ ├── src │ │ └── index.js │ ├── package.json │ └── README.md ├── rax-server-renderer │ ├── src │ │ └── index.js │ ├── package.json │ └── README.md ├── rax-image │ ├── README.md │ ├── package.json │ └── src │ │ └── __tests__ │ │ └── Image.weex.js ├── rax-link │ ├── README.md │ ├── package.json │ └── src │ │ ├── __tests__ │ │ ├── Link.weex.js │ │ └── Link.js │ │ └── index.js ├── rax-redux │ ├── README.md │ ├── src │ │ ├── index.js │ │ ├── utils │ │ │ ├── wrapActionCreators.js │ │ │ ├── storeShape.js │ │ │ ├── warning.js │ │ │ └── hoistNonRaxStatics.js │ │ └── components │ │ │ └── Provider.js │ └── package.json ├── rax-text │ ├── README.md │ ├── src │ │ └── __tests__ │ │ │ ├── Text.weex.js │ │ │ └── Text.js │ └── package.json ├── rax-video │ ├── README.md │ ├── src │ │ ├── __tests__ │ │ │ ├── Video.weex.js │ │ │ └── Video.js │ │ └── index.js │ └── package.json ├── rax-view │ ├── README.md │ ├── src │ │ ├── __tests__ │ │ │ ├── View.weex.js │ │ │ └── View.js │ │ └── index.js │ └── package.json ├── rax-button │ ├── README.md │ ├── package.json │ └── src │ │ ├── __tests__ │ │ ├── Button.js │ │ └── __snapshots__ │ │ │ └── Button.js.snap │ │ └── index.js ├── rax-slider │ ├── README.md │ ├── src │ │ ├── index.js │ │ └── __tests__ │ │ │ └── Slider.weex.js │ └── package.json ├── rax-switch │ ├── README.md │ ├── package.json │ └── src │ │ └── __tests__ │ │ ├── Switch.weex.js │ │ └── Switch.js ├── weex-builtin-globals-service-template │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── weex-builtin-modules-service-template │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── rax-animated │ ├── README.md │ ├── package.json │ └── src │ │ └── mapStyle.js ├── rax-listview │ ├── README.md │ ├── src │ │ ├── __tests__ │ │ │ └── ListView.js │ │ └── index.js │ └── package.json ├── rax-cli │ ├── src │ │ ├── generator │ │ │ ├── templates │ │ │ │ ├── src │ │ │ │ │ ├── index.js │ │ │ │ │ ├── App.css │ │ │ │ │ └── App.js │ │ │ │ ├── README.md │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── package.json │ │ │ └── index.js │ │ └── index.js │ ├── README.md │ └── package.json ├── rax-components │ ├── README.md │ ├── src │ │ └── index.js │ └── package.json ├── rax-scrollview │ ├── README.md │ └── package.json ├── rax-textinput │ ├── README.md │ ├── src │ │ └── __tests__ │ │ │ ├── TextInput.weex.js │ │ │ └── TextInput.js │ └── package.json ├── rax-touchable │ ├── README.md │ ├── src │ │ ├── __tests__ │ │ │ ├── Touchable.weex.js │ │ │ └── Touchable.js │ │ └── index.js │ └── package.json ├── rax-recyclerview │ ├── README.md │ ├── package.json │ └── src │ │ └── __tests__ │ │ └── RecyclerView.js ├── rax-refreshcontrol │ ├── README.md │ ├── src │ │ └── index.js │ └── package.json ├── universal-platform │ ├── src │ │ ├── index.js │ │ └── __tests__ │ │ │ └── index.js │ ├── package.json │ └── README.md ├── universal-stylesheet │ ├── src │ │ ├── index.js │ │ ├── flattenStyle.js │ │ └── __tests__ │ │ │ └── flattenStyle.js │ └── package.json ├── universal-env │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── web-rax-framework │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── universal-perf │ ├── package.json │ ├── src │ │ └── getTreeSnapshot.js │ └── README.md ├── universal-toast │ ├── src │ │ └── __tests__ │ │ │ ├── index.weex.js │ │ │ └── index.web.js │ ├── package.json │ └── README.md ├── universal-jsonp │ ├── package.json │ ├── README.md │ └── src │ │ └── __tests__ │ │ └── index.web.js ├── universal-transition │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ ├── index.weex.js │ │ │ └── index.js │ │ └── index.js │ └── README.md ├── universal-panresponder │ └── package.json ├── stylesheet-loader │ ├── package.json │ └── src │ │ ├── TextStylePropTypes.js │ │ ├── ColorPropTypes.js │ │ ├── promptMessage.js │ │ ├── FlexboxPropTypes.js │ │ ├── __tests__ │ │ └── PropTypes.js │ │ ├── BoxModelPropTypes.js │ │ └── Validation.js └── babel-plugin-transform-jsx-stylesheet │ └── package.json ├── scripts ├── jest.js ├── authors ├── link.js └── mapCoverage.js ├── .eslintignore ├── examples ├── uikit │ ├── index.js │ ├── colors.js │ ├── Divider.js │ ├── Text.js │ ├── index.html │ └── UIKit.js ├── game2048 │ ├── index.js │ └── index.html ├── hello │ ├── index.js │ └── index.html ├── drag │ └── index.html ├── perf │ └── index.html ├── profile │ └── index.html ├── redux │ └── index.html ├── parallax │ └── index.html ├── tictactoe │ └── index.html └── components │ ├── index.html │ ├── VideoDemo.js │ └── SwitchDemo.js ├── .babelrc ├── lerna.json ├── .gitignore ├── .travis.yml ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE.md └── GIT_COMMIT_SPECIFIC.md ├── docs ├── README.md ├── publishing.md ├── zh-Hans │ └── use-class-name-in-jsx.md ├── jsx.md ├── difference-with-react.md └── driver-spec.md ├── AUTHORS └── LICENSE /website/CNAME: -------------------------------------------------------------------------------- 1 | rax.taobaofed.org -------------------------------------------------------------------------------- /packages/weex-rax-framework/.gitignore: -------------------------------------------------------------------------------- 1 | weex 2 | -------------------------------------------------------------------------------- /packages/rax/src/version.js: -------------------------------------------------------------------------------- 1 | export default '0.2.2'; 2 | -------------------------------------------------------------------------------- /packages/runtime-shared/README.md: -------------------------------------------------------------------------------- 1 | # runtime-shared 2 | -------------------------------------------------------------------------------- /packages/rax/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | build 4 | -------------------------------------------------------------------------------- /packages/weex-rax-examples/README.md: -------------------------------------------------------------------------------- 1 | # weex-rax-examples 2 | -------------------------------------------------------------------------------- /packages/babel-preset-rax/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | src 4 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | src 4 | test 5 | -------------------------------------------------------------------------------- /scripts/jest.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | global.__weex_require__ = require; 3 | -------------------------------------------------------------------------------- /website/bg.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/rax/master/website/bg.mp4 -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/umd/index.js: -------------------------------------------------------------------------------- 1 | console.log('it work!'); -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/bundle/index.js: -------------------------------------------------------------------------------- 1 | console.log('it work!'); -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/factory/index.js: -------------------------------------------------------------------------------- 1 | console.log('it work!'); -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/function/index.js: -------------------------------------------------------------------------------- 1 | console.log('it work!'); -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/module/index.js: -------------------------------------------------------------------------------- 1 | console.log('it work!'); -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/BuiltinModules.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'rax': ['rax'] 3 | }; 4 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/bundle-compatible/index.js: -------------------------------------------------------------------------------- 1 | console.log('it work!'); -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | gh-pages 3 | lib 4 | dist 5 | build 6 | coverage 7 | weex 8 | expected 9 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/factory-factoryGlobals/index.js: -------------------------------------------------------------------------------- 1 | console.log('it work!'); -------------------------------------------------------------------------------- /packages/element-loader/src/defaultKey.js: -------------------------------------------------------------------------------- 1 | export const IF_KEY = ':if'; 2 | export const FOR_KEY = ':for'; 3 | -------------------------------------------------------------------------------- /website/playground/images/iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/rax/master/website/playground/images/iphone.png -------------------------------------------------------------------------------- /packages/rax-test-renderer/src/index.js: -------------------------------------------------------------------------------- 1 | import renderer from 'rax/lib/testing/renderer'; 2 | 3 | module.exports = renderer; 4 | -------------------------------------------------------------------------------- /examples/uikit/index.js: -------------------------------------------------------------------------------- 1 | import {createElement, render} from 'rax'; 2 | import UIKit from './UIKit'; 3 | 4 | render(); 5 | -------------------------------------------------------------------------------- /packages/rax-server-renderer/src/index.js: -------------------------------------------------------------------------------- 1 | import renderer from 'rax/lib/server/renderer'; 2 | 3 | module.exports = renderer; 4 | -------------------------------------------------------------------------------- /packages/weex-rax-framework/src/builtin.js: -------------------------------------------------------------------------------- 1 | export let ModuleFactories = { 2 | 'rax': require('rax/dist/rax.factory') 3 | }; 4 | -------------------------------------------------------------------------------- /packages/rax-image/README.md: -------------------------------------------------------------------------------- 1 | # rax-image [![npm](https://img.shields.io/npm/v/rax-image.svg)](https://www.npmjs.com/package/rax-image) 2 | -------------------------------------------------------------------------------- /packages/rax-link/README.md: -------------------------------------------------------------------------------- 1 | # rax-link [![npm](https://img.shields.io/npm/v/rax-link.svg)](https://www.npmjs.com/package/rax-link) 2 | -------------------------------------------------------------------------------- /packages/rax-redux/README.md: -------------------------------------------------------------------------------- 1 | # rax-redux [![npm](https://img.shields.io/npm/v/rax-redux.svg)](https://www.npmjs.com/package/rax-redux) 2 | -------------------------------------------------------------------------------- /packages/rax-text/README.md: -------------------------------------------------------------------------------- 1 | # rax-text [![npm](https://img.shields.io/npm/v/rax-text.svg)](https://www.npmjs.com/package/rax-text) 2 | -------------------------------------------------------------------------------- /packages/rax-video/README.md: -------------------------------------------------------------------------------- 1 | # rax-video [![npm](https://img.shields.io/npm/v/rax-video.svg)](https://www.npmjs.com/package/rax-video) 2 | -------------------------------------------------------------------------------- /packages/rax-view/README.md: -------------------------------------------------------------------------------- 1 | # rax-view [![npm](https://img.shields.io/npm/v/rax-view.svg)](https://www.npmjs.com/package/rax-view) 2 | -------------------------------------------------------------------------------- /examples/game2048/index.js: -------------------------------------------------------------------------------- 1 | import {createElement, render} from 'rax'; 2 | import Game2048 from './Game2048'; 3 | 4 | render(); 5 | -------------------------------------------------------------------------------- /packages/rax-button/README.md: -------------------------------------------------------------------------------- 1 | # rax-button [![npm](https://img.shields.io/npm/v/rax-button.svg)](https://www.npmjs.com/package/rax-button) 2 | -------------------------------------------------------------------------------- /packages/rax-slider/README.md: -------------------------------------------------------------------------------- 1 | # rax-slider [![npm](https://img.shields.io/npm/v/rax-slider.svg)](https://www.npmjs.com/package/rax-slider) 2 | -------------------------------------------------------------------------------- /packages/rax-switch/README.md: -------------------------------------------------------------------------------- 1 | # rax-switch [![npm](https://img.shields.io/npm/v/rax-switch.svg)](https://www.npmjs.com/package/rax-switch) 2 | -------------------------------------------------------------------------------- /packages/rax/src/server/renderer.js: -------------------------------------------------------------------------------- 1 | import renderToString from './renderToString'; 2 | 3 | export default { 4 | renderToString 5 | }; 6 | -------------------------------------------------------------------------------- /packages/weex-builtin-globals-service-template/README.md: -------------------------------------------------------------------------------- 1 | # weex-builtin-globals-service-template 2 | > weex builtin globals service template 3 | -------------------------------------------------------------------------------- /packages/weex-builtin-globals-service-template/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "weex-builtin-global-service-template", 3 | "private": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/weex-builtin-modules-service-template/README.md: -------------------------------------------------------------------------------- 1 | # weex-builtin-modules-service-template 2 | > weex builtin modules service template 3 | -------------------------------------------------------------------------------- /packages/weex-builtin-modules-service-template/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "weex-builtin-modules-service-template", 3 | "private": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/rax-animated/README.md: -------------------------------------------------------------------------------- 1 | # rax-animated [![npm](https://img.shields.io/npm/v/rax-animated.svg)](https://www.npmjs.com/package/rax-animated) 2 | -------------------------------------------------------------------------------- /packages/rax-listview/README.md: -------------------------------------------------------------------------------- 1 | # rax-listview [![npm](https://img.shields.io/npm/v/rax-listview.svg)](https://www.npmjs.com/package/rax-listview) 2 | -------------------------------------------------------------------------------- /packages/rax-cli/src/generator/templates/src/index.js: -------------------------------------------------------------------------------- 1 | import {createElement, render} from 'rax'; 2 | import App from './App'; 3 | 4 | render(); 5 | -------------------------------------------------------------------------------- /packages/rax-components/README.md: -------------------------------------------------------------------------------- 1 | # rax-components [![npm](https://img.shields.io/npm/v/rax-components.svg)](https://www.npmjs.com/package/rax-components) 2 | -------------------------------------------------------------------------------- /packages/rax-scrollview/README.md: -------------------------------------------------------------------------------- 1 | # rax-scrollview [![npm](https://img.shields.io/npm/v/rax-scrollview.svg)](https://www.npmjs.com/package/rax-scrollview) 2 | -------------------------------------------------------------------------------- /packages/rax-textinput/README.md: -------------------------------------------------------------------------------- 1 | # rax-textinput [![npm](https://img.shields.io/npm/v/rax-textinput.svg)](https://www.npmjs.com/package/rax-textinput) 2 | -------------------------------------------------------------------------------- /packages/rax-touchable/README.md: -------------------------------------------------------------------------------- 1 | # rax-touchable [![npm](https://img.shields.io/npm/v/rax-touchable.svg)](https://www.npmjs.com/package/rax-touchable) 2 | -------------------------------------------------------------------------------- /packages/rax-recyclerview/README.md: -------------------------------------------------------------------------------- 1 | # rax-recyclerview [![npm](https://img.shields.io/npm/v/rax-recyclerview.svg)](https://www.npmjs.com/package/rax-recyclerview) 2 | -------------------------------------------------------------------------------- /packages/rax-redux/src/index.js: -------------------------------------------------------------------------------- 1 | import Provider from './components/Provider'; 2 | import connect from './components/connect'; 3 | 4 | export {Provider, connect}; 5 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "rax" 5 | ], 6 | "ignore": [ 7 | "src/generator/templates", 8 | "__mockc__" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.0.0-beta.37", 3 | "version": "0.2.2", 4 | "commands": { 5 | "publish": { 6 | "skipGit": true 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/rax-refreshcontrol/README.md: -------------------------------------------------------------------------------- 1 | # rax-refreshcontrol [![npm](https://img.shields.io/npm/v/rax-refreshcontrol.svg)](https://www.npmjs.com/package/rax-refreshcontrol) 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.swp 3 | .DS_STORE 4 | npm-debug.log 5 | lerna-debug.log 6 | npm-debug.log* 7 | lib/ 8 | dist/ 9 | build/ 10 | coverage/ 11 | node_modules/ 12 | examples/test 13 | -------------------------------------------------------------------------------- /packages/rax/src/check.js: -------------------------------------------------------------------------------- 1 | if (typeof window !== 'undefined') { 2 | if (window.Rax) { 3 | console.warn('Multiple (conflicting) copies of Rax loaded, make sure to use only one.'); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/runtime-shared/src/fontface.js: -------------------------------------------------------------------------------- 1 | class FontFace { 2 | constructor(family, source) { 3 | this.family = family; 4 | this.source = source; 5 | } 6 | } 7 | 8 | module.exports = FontFace; -------------------------------------------------------------------------------- /packages/element-loader/src/__mocks__/fs.js: -------------------------------------------------------------------------------- 1 | export default { 2 | readFileSync() { 3 | let content = { 4 | presets: ['rax'] 5 | }; 6 | return JSON.stringify(content); 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "6" 7 | - "7" 8 | 9 | before_script: 10 | - npm run setup 11 | 12 | script: 13 | - npm run lint:nofix 14 | - npm test 15 | -------------------------------------------------------------------------------- /packages/rax-redux/src/utils/wrapActionCreators.js: -------------------------------------------------------------------------------- 1 | import {bindActionCreators} from 'redux'; 2 | 3 | export default function wrapActionCreators(actionCreators) { 4 | return dispatch => bindActionCreators(actionCreators, dispatch); 5 | } 6 | -------------------------------------------------------------------------------- /packages/rax-cli/src/index.js: -------------------------------------------------------------------------------- 1 | var generate = require('./generator'); 2 | 3 | function init(projectDir, projectName, verbose) { 4 | generate(projectDir, projectName, verbose); 5 | } 6 | 7 | module.exports = { 8 | init: init, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/rax-redux/src/utils/storeShape.js: -------------------------------------------------------------------------------- 1 | import {PropTypes} from 'rax'; 2 | 3 | export default PropTypes.shape({ 4 | subscribe: PropTypes.func.isRequired, 5 | dispatch: PropTypes.func.isRequired, 6 | getState: PropTypes.func.isRequired 7 | }); 8 | -------------------------------------------------------------------------------- /packages/rax/src/findComponentInstance.js: -------------------------------------------------------------------------------- 1 | import instance from './vdom/instance'; 2 | 3 | function findComponentInstance(node) { 4 | if (node == null) { 5 | return null; 6 | } 7 | return instance.get(node); 8 | } 9 | 10 | export default findComponentInstance; 11 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "http-server", 5 | "deploy": "surge --project ./ --domain rax.taobaofed.org" 6 | }, 7 | "devDependencies": { 8 | "http-server": "^0.9.0", 9 | "surge": "latest" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/umd/webpack.config.js: -------------------------------------------------------------------------------- 1 | import RaxWebpackPlugin from '../../../index'; 2 | 3 | module.exports = { 4 | entry: { 5 | 'index.umd': './index', 6 | }, 7 | plugins: [ 8 | new RaxWebpackPlugin({ 9 | target: 'umd' 10 | }) 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/rax/src/debug/devtools.js: -------------------------------------------------------------------------------- 1 | import Hook from './hook'; 2 | 3 | /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 4 | if ( 5 | typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 6 | typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { 7 | __REACT_DEVTOOLS_GLOBAL_HOOK__.inject(Hook); 8 | } 9 | -------------------------------------------------------------------------------- /packages/universal-platform/src/index.js: -------------------------------------------------------------------------------- 1 | let OS; 2 | 3 | if (typeof navigator === 'object') { 4 | OS = navigator.platform.toLowerCase(); 5 | } else if (typeof WXEnvironment === 'object') { 6 | OS = WXEnvironment.platform; 7 | } 8 | 9 | export default { 10 | OS, 11 | select: obj => obj[OS] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/module/webpack.config.js: -------------------------------------------------------------------------------- 1 | import RaxWebpackPlugin from '../../../index'; 2 | 3 | module.exports = { 4 | entry: { 5 | 'index.module': './index', 6 | }, 7 | plugins: [ 8 | new RaxWebpackPlugin({ 9 | target: 'module', 10 | }) 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/rax/src/vdom/host.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Stateful things in runtime 3 | */ 4 | export default { 5 | component: null, 6 | mountID: 1, 7 | sandbox: true, 8 | // Roots 9 | rootComponents: {}, 10 | rootInstances: {}, 11 | // Inject 12 | hook: null, 13 | driver: null, 14 | monitor: null 15 | }; 16 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/factory/webpack.config.js: -------------------------------------------------------------------------------- 1 | import RaxWebpackPlugin from '../../../index'; 2 | 3 | module.exports = { 4 | entry: { 5 | 'index.factory': './index', 6 | }, 7 | plugins: [ 8 | new RaxWebpackPlugin({ 9 | target: 'factory' 10 | }) 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/function/webpack.config.js: -------------------------------------------------------------------------------- 1 | import RaxWebpackPlugin from '../../../index'; 2 | 3 | module.exports = { 4 | entry: { 5 | 'index.function': './index', 6 | }, 7 | plugins: [ 8 | new RaxWebpackPlugin({ 9 | target: 'function', 10 | }) 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/bundle-compatible/webpack.config.js: -------------------------------------------------------------------------------- 1 | import RaxWebpackPlugin from '../../../index'; 2 | 3 | module.exports = { 4 | entry: { 5 | 'index.bundle': './index', 6 | }, 7 | plugins: [ 8 | new RaxWebpackPlugin({ 9 | target: 'bundle', 10 | }) 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/rax/src/purecomponent.js: -------------------------------------------------------------------------------- 1 | import Component from './component'; 2 | 3 | /** 4 | * Pure component class. 5 | */ 6 | class PureComponent extends Component { 7 | constructor(props, context) { 8 | super(props, context); 9 | } 10 | 11 | isPureComponentClass() {} 12 | } 13 | 14 | export default PureComponent; 15 | -------------------------------------------------------------------------------- /scripts/authors: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Generate an AUTHORS file based on the output of git shortlog. It uses ABC 4 | # order, strips out leading spaces and numbers, then filters out specific 5 | # authors. 6 | 7 | git shortlog -se \ 8 | | perl -spe 's/^\s+\d+\s+//' \ 9 | | sed -e '/^CommitSyncScript.*$/d' \ 10 | > AUTHORS 11 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/bundle/webpack.config.js: -------------------------------------------------------------------------------- 1 | import RaxWebpackPlugin from '../../../index'; 2 | 3 | module.exports = { 4 | entry: { 5 | 'index.bundle': './index', 6 | }, 7 | plugins: [ 8 | new RaxWebpackPlugin({ 9 | target: 'bundle', 10 | bundle: 'bundle' 11 | }) 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /packages/rax-slider/src/index.js: -------------------------------------------------------------------------------- 1 | import {Component, createElement, PropTypes} from 'rax'; 2 | import {isWeex} from 'universal-env'; 3 | 4 | class Slider extends Component { 5 | 6 | render() { 7 | if (isWeex) { 8 | return ; 9 | } else { 10 | // TODO 11 | } 12 | } 13 | } 14 | 15 | export default Slider; 16 | -------------------------------------------------------------------------------- /packages/rax/src/unmountComponentAtNode.js: -------------------------------------------------------------------------------- 1 | import instance from './vdom/instance'; 2 | 3 | export default function unmountComponentAtNode(node) { 4 | let component = instance.get(node); 5 | 6 | if (!component) { 7 | return false; 8 | } 9 | 10 | instance.remove(node); 11 | component._internal.unmountComponent(); 12 | 13 | return true; 14 | }; 15 | -------------------------------------------------------------------------------- /packages/rax-webpack-plugin/src/__tests__/fixtures/factory-factoryGlobals/webpack.config.js: -------------------------------------------------------------------------------- 1 | import RaxWebpackPlugin from '../../../index'; 2 | 3 | module.exports = { 4 | entry: { 5 | 'index.factory': './index', 6 | }, 7 | plugins: [ 8 | new RaxWebpackPlugin({ 9 | target: 'factory', 10 | factoryGlobals: ['weex'], 11 | }) 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /packages/universal-stylesheet/src/index.js: -------------------------------------------------------------------------------- 1 | import flattenStyle from './flattenStyle'; 2 | 3 | const absoluteFillObject = { 4 | position: 'absolute', 5 | left: 0, 6 | right: 0, 7 | top: 0, 8 | bottom: 0, 9 | }; 10 | 11 | export default { 12 | hairlineWidth: 1, 13 | absoluteFillObject, 14 | 15 | flatten: flattenStyle, 16 | create: styles => styles 17 | }; 18 | -------------------------------------------------------------------------------- /packages/universal-env/README.md: -------------------------------------------------------------------------------- 1 | # universal-env [![npm](https://img.shields.io/npm/v/universal-env.svg)](https://www.npmjs.com/package/universal-env) 2 | 3 | > Judge runtime environment 4 | 5 | ## Install 6 | 7 | ```bash 8 | $ npm install universal-env --save 9 | ``` 10 | 11 | ## Usage 12 | 13 | ```js 14 | import {isWeex, isWeb, isReactNative, isNode} from 'universal-env'; 15 | ``` -------------------------------------------------------------------------------- /packages/rax/src/server/escapeText.js: -------------------------------------------------------------------------------- 1 | const ESCAPE_LOOKUP = { 2 | '&': '&', 3 | '>': '>', 4 | '<': '<', 5 | '"': '"', 6 | '\'': ''', 7 | }; 8 | 9 | const ESCAPE_REGEX = /[&><"']/g; 10 | 11 | function escaper(match) { 12 | return ESCAPE_LOOKUP[match]; 13 | } 14 | 15 | export default function escapeText(text) { 16 | return String(text).replace(ESCAPE_REGEX, escaper); 17 | } 18 | -------------------------------------------------------------------------------- /examples/hello/index.js: -------------------------------------------------------------------------------- 1 | import {createElement, Component, render} from 'rax'; 2 | import {Text} from 'rax-components'; 3 | 4 | class Hello extends Component { 5 | render() { 6 | return Hello {this.props.name}; 7 | } 8 | } 9 | 10 | const styles = { 11 | title: { 12 | color: '#ff4400', 13 | fontSize: 48, 14 | fontWeight: 'bold', 15 | } 16 | }; 17 | 18 | render(); 19 | -------------------------------------------------------------------------------- /packages/web-rax-framework/README.md: -------------------------------------------------------------------------------- 1 | # web-rax-framework 2 | 3 | ## Global API Rax Framework provide 4 | 5 | * `document` 6 | * fonts 7 | * add 8 | 9 | 10 | * `FontFace` 11 | ```js 12 | API: 13 | var iconFontFace = new FontFace('iconfont', 'url(http://at.alicdn.com/t/font_pkm0oq8is8fo5hfr.ttf)'); 14 | document.fonts.add(iconFontFace); 15 | 16 | ELEMENT: 17 | {'\uE601'} 18 | ``` 19 | -------------------------------------------------------------------------------- /packages/weex-builtin-globals-service-template/src/index.js: -------------------------------------------------------------------------------- 1 | const builtinGlobalsService = { 2 | 3 | create: (id, env, config) => { 4 | const builtinGlobals = { 5 | // jQuery: 'jquery' 6 | }; 7 | 8 | return { 9 | instance: { 10 | builtinGlobals 11 | } 12 | }; 13 | }, 14 | 15 | destroy: (id, env) => { 16 | } 17 | }; 18 | 19 | global.registerService('builtinGlobalsService', builtinGlobalsService); 20 | -------------------------------------------------------------------------------- /packages/runtime-shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "runtime-shared", 3 | "version": "0.2.2", 4 | "description": "Shared Runtime.", 5 | "license": "BSD-3-Clause", 6 | "main": "lib/index.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/alibaba/rax.git" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/alibaba/rax/issues" 13 | }, 14 | "homepage": "https://github.com/alibaba/rax#readme" 15 | } 16 | -------------------------------------------------------------------------------- /packages/weex-rax-framework/src/define.weex.js: -------------------------------------------------------------------------------- 1 | module.exports = function(modules) { 2 | function define(name, deps, factory) { 3 | if (deps instanceof Function) { 4 | factory = deps; 5 | deps = []; 6 | } 7 | 8 | modules[name] = { 9 | factory: factory, 10 | deps: deps, 11 | module: {exports: {}}, 12 | isInitialized: false, 13 | hasError: false, 14 | }; 15 | } 16 | 17 | return define; 18 | }; 19 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Before* submitting a pull request, please make sure the following is done... 2 | 3 | 1. Fork the repo and create your branch from `master`. 4 | 2. If you've added code that should be tested, add tests! 5 | 3. If you've changed APIs, update the documentation. 6 | 4. Ensure the test suite passes (`npm test`). 7 | 5. Make sure your code lints (`npm run lint`) - we've done our best to make sure these rules match our internal linting guidelines. 8 | -------------------------------------------------------------------------------- /examples/uikit/colors.js: -------------------------------------------------------------------------------- 1 | export default { 2 | primary: '#9E9E9E', 3 | primary1: '#4d86f7', 4 | primary2: '#6296f9', 5 | secondary: '#8F0CE8', 6 | secondary2: '#00B233', 7 | secondary3: '#00FF48', 8 | grey0: '#393e42', 9 | grey1: '#43484d', 10 | grey2: '#5e6977', 11 | grey3: '#86939e', 12 | grey4: '#bdc6cf', 13 | grey5: '#e1e8ee', 14 | dkGreyBg: '#232323', 15 | greyOutline: '#cbd2d9', 16 | searchBg: '#303337', 17 | disabled: '#dadee0', 18 | }; 19 | -------------------------------------------------------------------------------- /packages/rax-cli/README.md: -------------------------------------------------------------------------------- 1 | # rax-cli [![npm](https://img.shields.io/npm/v/rax-cli.svg)](https://www.npmjs.com/package/rax-cli) [![Dependency Status](https://david-dm.org/alibaba/rax.svg?path=packages/rax-cli)](https://david-dm.org/alibaba/rax.svg?path=packages/rax-cli) [![Known Vulnerabilities](https://snyk.io/test/npm/rax-cli/badge.svg)](https://snyk.io/test/npm/rax-cli) 2 | 3 | > The Rax CLI tools. 4 | 5 | ## Install 6 | 7 | ```sh 8 | $ npm install -g rax-cli 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/rax-cli/src/generator/templates/src/App.css: -------------------------------------------------------------------------------- 1 | .app { 2 | flex: 1; 3 | justify-content: center; 4 | align-items: center; 5 | } 6 | 7 | .appHeader { 8 | background-color: #222; 9 | height: 160; 10 | padding: 40; 11 | } 12 | 13 | .appBanner, .appIntro { 14 | text-align: center; 15 | } 16 | 17 | .appBanner { 18 | font-size: 80; 19 | color: white; 20 | } 21 | 22 | .appIntro { 23 | margin-top: 40; 24 | font-size: 40; 25 | line-height: 60; 26 | } 27 | -------------------------------------------------------------------------------- /packages/universal-env/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "universal-env", 3 | "version": "0.2.2", 4 | "description": "A universal environment utilities.", 5 | "license": "BSD-3-Clause", 6 | "main": "lib/index.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/alibaba/rax.git" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/alibaba/rax/issues" 13 | }, 14 | "homepage": "https://github.com/alibaba/rax#readme" 15 | } 16 | -------------------------------------------------------------------------------- /packages/universal-env/src/index.js: -------------------------------------------------------------------------------- 1 | // https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename 2 | export const isWeb = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); 3 | export const isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node); 4 | export const isWeex = typeof callNative === 'function'; 5 | export const isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined'; 6 | -------------------------------------------------------------------------------- /packages/universal-stylesheet/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "universal-stylesheet", 3 | "version": "0.2.2", 4 | "description": "A universal StyleSheet API.", 5 | "license": "BSD-3-Clause", 6 | "main": "lib/index.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/alibaba/rax.git" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/alibaba/rax/issues" 13 | }, 14 | "homepage": "https://github.com/alibaba/rax#readme" 15 | } 16 | -------------------------------------------------------------------------------- /packages/rax/src/vdom/root.js: -------------------------------------------------------------------------------- 1 | import Component from '../component'; 2 | 3 | let rootCounter = 1; 4 | 5 | class Root extends Component { 6 | rootID = rootCounter++; 7 | isRootComponent() {} 8 | render() { 9 | return this.props.children; 10 | } 11 | getPublicInstance() { 12 | return this.getRenderedComponent().getPublicInstance(); 13 | } 14 | getRenderedComponent() { 15 | return this._internal._renderedComponent; 16 | } 17 | } 18 | 19 | export default Root; 20 | -------------------------------------------------------------------------------- /packages/universal-perf/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "universal-perf", 3 | "version": "0.2.2", 4 | "description": "A universal Perf tools.", 5 | "license": "BSD-3-Clause", 6 | "main": "lib/index.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/alibaba/rax.git" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/alibaba/rax/issues" 13 | }, 14 | "homepage": "https://github.com/alibaba/rax#readme", 15 | "dependencies": {} 16 | } 17 | -------------------------------------------------------------------------------- /packages/universal-platform/src/__tests__/index.js: -------------------------------------------------------------------------------- 1 | 2 | jest.autoMockOff(); 3 | 4 | describe('OS', () => { 5 | Object.defineProperty(navigator, 'platform', { 6 | value: 'MacIntel' 7 | }); 8 | 9 | it('should use navigator platform', () => { 10 | const Platform = require('../index'); 11 | const selectOS = Platform.select({ 12 | macintel: 'test' 13 | }); 14 | 15 | expect(Platform.OS).toEqual('macintel'); 16 | expect(selectOS).toEqual('test'); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /website/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 23 |

404

24 | Go Home 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/uikit/Divider.js: -------------------------------------------------------------------------------- 1 | import {createElement} from 'rax'; 2 | import {View} from 'rax-components'; 3 | import StyleSheet from 'universal-stylesheet'; 4 | import colors from './colors'; 5 | 6 | function Divider({style}) { 7 | return ( 8 | 9 | ); 10 | } 11 | 12 | const styles = StyleSheet.create({ 13 | container: { 14 | height: StyleSheet.hairlineWidth, 15 | backgroundColor: colors.grey5 16 | } 17 | }); 18 | 19 | export default Divider; 20 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Docs 2 | 3 | ## Quick Start 4 | * [Getting Started](./getting-started.md) 5 | * [Hello World](./tutorial.md) 6 | * [Key Concepts](./concepts.md) 7 | * [JSX](./jsx.md) 8 | * [Networking](./networking.md) 9 | * [Components, Props and State](./components-props-and-state.md) 10 | * [Publishing Project](./publishing.md) 11 | * [Top Level APIs](./top-level-api.md) 12 | * [Differences with React](./difference-with-react.md) 13 | 14 | ## Advanced Guides 15 | * [Driver Specification](./driver-spec.md) 16 | -------------------------------------------------------------------------------- /packages/rax-video/src/__tests__/Video.weex.js: -------------------------------------------------------------------------------- 1 | import {createElement} from 'rax'; 2 | import renderer from 'rax-test-renderer'; 3 | import Video from '../'; 4 | 5 | jest.mock('universal-env', () => { 6 | return { 7 | isWeex: true 8 | }; 9 | }); 10 | 11 | describe('Video in weex', () => { 12 | it('render tag Video', () => { 13 | const component = renderer.create( 14 |