Socket
Socket
Sign inDemoInstall

nuke-components

Package Overview
Dependencies
Maintainers
3
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-components - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

1

docs/image.md

@@ -26,3 +26,2 @@ # 图片

<Image source={{uri: '//img.alicdn.com/tps/TB1l8ZsNpXXXXaQXVXXXXXXXXXX-160-280.jpg'}} style={{width: '160rem',height: '280rem',}} resizeMode={'cover'}/>
</View>

@@ -29,0 +28,0 @@ )

9

HISTORY.md
# Changelog
## 0.1.1 / 2016-11-09
* [[595b15e](http://gitlab.alibaba-inc.com/nuke/nuke-components/commit/595b15e47675d9a3a8ff1a002b8a6bec26fab65c)] - `feat` 同步更新
* [[f15091c](http://gitlab.alibaba-inc.com/nuke/nuke-components/commit/f15091ca108105a383f7474f72435d1a4769ae40)] - `docs` 测试
## 0.1.0 / 2016-11-09
* [[27f5856](http://gitlab.alibaba-inc.com/nuke/nuke-components/commit/27f58568db4373faaa437af9f12f8addcee6202c)] - `feat` 暴露lib目录
## 0.0.31 / 2016-10-30
* [[210f993](http://gitlab.alibaba-inc.com/nuke/nuke-components/commit/210f9932bd9894c2d71764601ca19d54d2b644c8)] - `break` nuke分库

@@ -17,9 +17,9 @@ /* @jsx createElement */

var _View = require('./View');
var _view = require('./view');
var _View2 = _interopRequireDefault(_View);
var _view2 = _interopRequireDefault(_view);
var _ImageResizeMode = require('./ImageResizeMode');
var _imageresizemode = require('./imageresizemode');
var _ImageResizeMode2 = _interopRequireDefault(_ImageResizeMode);
var _imageresizemode2 = _interopRequireDefault(_imageresizemode);

@@ -90,3 +90,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

return (0, _weexRx.createElement)(
_View2.default,
_view2.default,
{ style: nativeProps.style },

@@ -107,3 +107,3 @@ (0, _weexRx.createElement)(ImageElement, imageProps),

Image.resizeMode = _ImageResizeMode2.default;
Image.resizeMode = _imageresizemode2.default;

@@ -110,0 +110,0 @@

@@ -8,51 +8,51 @@ 'use strict';

var _View2 = require('./View');
var _view = require('./view');
var _View3 = _interopRequireDefault(_View2);
var _view2 = _interopRequireDefault(_view);
var _Text2 = require('./Text');
var _text = require('./text');
var _Text3 = _interopRequireDefault(_Text2);
var _text2 = _interopRequireDefault(_text);
var _Image2 = require('./Image');
var _image = require('./image');
var _Image3 = _interopRequireDefault(_Image2);
var _image2 = _interopRequireDefault(_image);
var _TextInput2 = require('./TextInput');
var _textinput = require('./textinput');
var _TextInput3 = _interopRequireDefault(_TextInput2);
var _textinput2 = _interopRequireDefault(_textinput);
var _Switch2 = require('./Switch');
var _switch = require('./switch');
var _Switch3 = _interopRequireDefault(_Switch2);
var _switch2 = _interopRequireDefault(_switch);
var _Video2 = require('./Video');
var _video = require('./video');
var _Video3 = _interopRequireDefault(_Video2);
var _video2 = _interopRequireDefault(_video);
var _ScrollView2 = require('./ScrollView');
var _scrollView = require('./scrollView');
var _ScrollView3 = _interopRequireDefault(_ScrollView2);
var _scrollView2 = _interopRequireDefault(_scrollView);
var _TouchableHighlight2 = require('./TouchableHighlight');
var _touchablehighlight = require('./touchablehighlight');
var _TouchableHighlight3 = _interopRequireDefault(_TouchableHighlight2);
var _touchablehighlight2 = _interopRequireDefault(_touchablehighlight);
var _RecyclerView2 = require('./RecyclerView');
var _recyclerview = require('./recyclerview');
var _RecyclerView3 = _interopRequireDefault(_RecyclerView2);
var _recyclerview2 = _interopRequireDefault(_recyclerview);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.View = _View3.default;
exports.Text = _Text3.default;
exports.Image = _Image3.default;
exports.TextInput = _TextInput3.default;
exports.Switch = _Switch3.default;
exports.Video = _Video3.default;
exports.ScrollView = _ScrollView3.default;
exports.TouchableHighlight = _TouchableHighlight3.default;
exports.TouchableOpacity = _TouchableHighlight3.default;
exports.TouchableWithoutFeedback = _TouchableHighlight3.default;
exports.TouchableNativeFeedback = _TouchableHighlight3.default;
exports.RecyclerView = _RecyclerView3.default;
exports.View = _view2.default;
exports.Text = _text2.default;
exports.Image = _image2.default;
exports.TextInput = _textinput2.default;
exports.Switch = _switch2.default;
exports.Video = _video2.default;
exports.ScrollView = _scrollView2.default;
exports.TouchableHighlight = _touchablehighlight2.default;
exports.TouchableOpacity = _touchablehighlight2.default;
exports.TouchableWithoutFeedback = _touchablehighlight2.default;
exports.TouchableNativeFeedback = _touchablehighlight2.default;
exports.RecyclerView = _recyclerview2.default;

@@ -15,5 +15,5 @@ /* @jsx createElement */

var _TouchableHighlight = require('./TouchableHighlight');
var _touchablehighlight = require('./touchablehighlight');
var _TouchableHighlight2 = _interopRequireDefault(_TouchableHighlight);
var _touchablehighlight2 = _interopRequireDefault(_touchablehighlight);

@@ -20,0 +20,0 @@ var _nukeCore = require('nuke-core');

@@ -15,9 +15,9 @@ 'use strict';

var _View = require('./View');
var _view = require('./view');
var _View2 = _interopRequireDefault(_View);
var _view2 = _interopRequireDefault(_view);
var _ScrollView = require('./ScrollView');
var _scrollview = require('./scrollview');
var _ScrollView2 = _interopRequireDefault(_ScrollView);
var _scrollview2 = _interopRequireDefault(_scrollview);

@@ -52,3 +52,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

} else {
return (0, _weexRx.createElement)(_View2.default, this.props);
return (0, _weexRx.createElement)(_view2.default, this.props);
}

@@ -76,3 +76,3 @@ }

} else {
return (0, _weexRx.createElement)(_View2.default, this.props);
return (0, _weexRx.createElement)(_view2.default, this.props);
}

@@ -157,3 +157,3 @@ }

} else {
return (0, _weexRx.createElement)(_ScrollView2.default, _extends({}, props, { ref: 'scrollview' }));
return (0, _weexRx.createElement)(_scrollview2.default, _extends({}, props, { ref: 'scrollview' }));
}

@@ -160,0 +160,0 @@ }

@@ -15,5 +15,5 @@ 'use strict';

var _View = require('./View');
var _view = require('./view');
var _View2 = _interopRequireDefault(_View);
var _view2 = _interopRequireDefault(_view);

@@ -148,3 +148,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var contentContainer = (0, _weexRx.createElement)(
_View2.default,
_view2.default,
{

@@ -195,3 +195,3 @@ ref: 'contentContainer',

return (0, _weexRx.createElement)(
_View2.default,
_view2.default,
_extends({}, this.props, { ref: 'scroller', style: scrollerStyle, onScroll: handleScroll }),

@@ -243,3 +243,2 @@ contentContainer

baseHorizontal: {
flex: 1,
flexDirection: 'row'

@@ -246,0 +245,0 @@ },

@@ -24,2 +24,5 @@ /* @jsx createElement */

var isWeex = _nukeCore.env.isWeex;
var DEFAULT_WIDTH = '100rem';
var DEFAULT_HEIGHT = '60rem';
var noop = function noop() {};

@@ -29,38 +32,50 @@ var Switch = function (_Component) {

function Switch() {
var _ref;
function Switch(props) {
_classCallCheck(this, Switch);
var _temp, _this, _ret;
var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this, props));
_classCallCheck(this, Switch);
_initialiseProps.call(_this);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
var checked = void 0,
indeterminate = void 0;
if ('checked' in props) {
checked = props.checked;
} else {
checked = props.defaultChecked;
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Switch.__proto__ || Object.getPrototypeOf(Switch)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
value: _this.props.value
}, _this.handleClick = function (e) {
if (_this.props.disabled) {
return null;
}
var newVal = !_this.state.value;
_this.props.onValueChange && _this.props.onValueChange.call(_this, newVal);
_this.setState({
value: newVal
});
var oldValue = _this.props.value;
setTimeout(function () {
if (_this.props.value == oldValue) {
_this.setState({
value: _this.props.value
});
}
}, 200);
}, _temp), _possibleConstructorReturn(_this, _ret);
if ('indeterminate' in props) {
indeterminate = props.indeterminate;
} else {
indeterminate = props.defaultIndeterminate;
}
_this.state = {
checked: checked,
indeterminate: indeterminate
};
return _this;
}
_createClass(Switch, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
//
if ('checked' in nextProps) {
this.setState({ checked: nextProps.checked });
}
if ('indeterminate' in nextProps) {
this.setState({ indeterminate: nextProps.indeterminate });
}
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.componentDidUpdate();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {}
}, {
key: 'getStyles',

@@ -70,12 +85,12 @@ value: function getStyles() {

span: {
width: DEFAULT_WIDTH,
height: DEFAULT_HEIGHT,
borderRadius: '40rem',
position: 'relative',
display: 'inline-block',
margin: 2,
height: 30,
width: 50,
margin: '4rem',
cursor: 'default', // pointer will cause a grey background color on chrome
verticalAlign: 'middle',
borderRadius: 20,
borderColor: '#dfdfdf',
borderWidth: 1,
borderWidth: '1px',
borderStyle: 'solid',

@@ -106,4 +121,4 @@ WebkitUserSelect: 'none',

top: 0,
width: 30,
height: 30,
width: '60rem',
height: '60rem',
backgroundColor: this.props.thumbTintColor,

@@ -115,3 +130,3 @@ borderRadius: '100%',

checkedSmall: {
WebkitTransform: 'translateX(20px)'
WebkitTransform: 'translateX(40rem)'
},

@@ -126,9 +141,8 @@ uncheckedSmall: {

value: function render() {
if (isWeex) {
var nativeProps = {
style: _extends({}, styles.initial, this.props.style),
checked: this.state.value,
checked: this.state.checked,
disabled: this.props.disabled,
onChange: this.props.onValueChange
onChange: this.handleClick
};

@@ -139,4 +153,4 @@

var _styles = this.getStyles();
var spancss = this.state.value ? _extends({}, _styles.span, _styles.checkedSpan) : _extends({}, _styles.span, _styles.uncheckedSpan);
var smallcss = this.state.value ? _extends({}, _styles.small, _styles.checkedSmall) : _extends({}, _styles.small, _styles.uncheckedSmall);
var spancss = this.state.checked ? _extends({}, _styles.span, _styles.checkedSpan) : _extends({}, _styles.span, _styles.uncheckedSpan);
var smallcss = this.state.checked ? _extends({}, _styles.small, _styles.checkedSmall) : _extends({}, _styles.small, _styles.uncheckedSmall);
spancss = this.props.disabled ? _extends({}, spancss, _styles.disabledSpan) : spancss;

@@ -157,12 +171,44 @@

Switch.defaultProps = {
onValueChange: noop,
defaultChecked: false,
defaultIndeterminate: false,
onTintColor: '#00e158',
thumbTintColor: '#ffffff',
tintColor: '#ffffff'
thumbTintColor: '#fff',
tintColor: '#fff'
};
var _initialiseProps = function _initialiseProps() {
var _this2 = this;
this.handleClick = function (e) {
if (_this2.props.disabled) {
return null;
}
var _props = _this2.props,
disabled = _props.disabled,
onValueChange = _props.onValueChange;
var checked = !_this2.state.checked;
if (!('checked' in _this2.props)) {
_this2.setState({
checked: checked
});
}
if (!('indeterminate' in _this2.props)) {
_this2.setState({
indeterminate: false
});
onValueChange(checked, e);
} else {
onValueChange(checked, false, e);
}
};
};
var styles = {
initial: {
width: '100rem', // default width
height: '60rem' }
width: DEFAULT_WIDTH,
height: DEFAULT_HEIGHT
}
};

@@ -169,0 +215,0 @@

@@ -17,5 +17,5 @@ /* @jsx createElement */

var _View = require('./View');
var _view = require('./view');
var _View2 = _interopRequireDefault(_View);
var _view2 = _interopRequireDefault(_view);

@@ -51,3 +51,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

return (0, _weexRx.createElement)(_View2.default, props);
return (0, _weexRx.createElement)(_view2.default, props);
}

@@ -54,0 +54,0 @@ }]);

@@ -15,10 +15,4 @@ /* @jsx createElement */

var _TouchableHighlight = require('./TouchableHighlight');
var _TouchableHighlight2 = _interopRequireDefault(_TouchableHighlight);
var _nukeCore = require('nuke-core');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -25,0 +19,0 @@

{
"name": "nuke-components",
"version": "0.1.0",
"version": "0.1.1",
"description": "nuke原件库",

@@ -26,2 +26,4 @@ "main": "lib/index",

"build": "nuke-bin build",
"prepublish": "nuke-bin build",
"publish": "nuke-bin changelog && npm publish",
"test": "nuke-bin test",

@@ -28,0 +30,0 @@ "lint": "eslint '@(src|docs)/**/*.@(js|jsx|md)' || true"

@@ -7,4 +7,4 @@ /* @jsx createElement */

import {env} from 'nuke-core'; const isWeex = env.isWeex;
import View from './View';
import ImageResizeMode from './ImageResizeMode';
import View from './view';
import ImageResizeMode from './imageresizemode';

@@ -11,0 +11,0 @@ class Image extends Component {

@@ -1,12 +0,12 @@

export View from './View';
export Text from './Text';
export Image from './Image';
export TextInput from './TextInput';
export Switch from './Switch';
export Video from './Video';
export ScrollView from './ScrollView';
export TouchableHighlight from './TouchableHighlight';
export TouchableOpacity from './TouchableHighlight';
export TouchableWithoutFeedback from './TouchableHighlight';
export TouchableNativeFeedback from './TouchableHighlight';
export RecyclerView from './RecyclerView';
export View from './view';
export Text from './text';
export Image from './image';
export TextInput from './textinput';
export Switch from './switch';
export Video from './video';
export ScrollView from './scrollView';
export TouchableHighlight from './touchablehighlight';
export TouchableOpacity from './touchablehighlight';
export TouchableWithoutFeedback from './touchablehighlight';
export TouchableNativeFeedback from './touchablehighlight';
export RecyclerView from './recyclerview';

@@ -6,3 +6,3 @@ /* @jsx createElement */

import {Component, createElement} from 'weex-rx';
import TouchableHighlight from './TouchableHighlight';
import TouchableHighlight from './touchablehighlight';
import {env} from 'nuke-core'; const isWeex = env.isWeex;

@@ -9,0 +9,0 @@

@@ -6,4 +6,4 @@ /* @jsx createElement */

const isWeex=env.isWeex;
import View from './View';
import ScrollView from './ScrollView';
import View from './view';
import ScrollView from './scrollview';

@@ -10,0 +10,0 @@ const DEFAULT_END_REACHED_THRESHOLD = 500;

@@ -5,3 +5,3 @@ /* @jsx createElement */

import {env} from 'nuke-core';
import View from './View';
import View from './view';
const isWeex = env.isWeex;

@@ -215,3 +215,2 @@ const isWeb = env.isWeb;

baseHorizontal: {
flex: 1,
flexDirection: 'row',

@@ -218,0 +217,0 @@ },

@@ -7,34 +7,71 @@ /* @jsx createElement */

import {env} from 'nuke-core'; const isWeex = env.isWeex;
const DEFAULT_WIDTH = '100rem';
const DEFAULT_HEIGHT = '60rem';
const noop = () => {};
class Switch extends Component {
constructor(props) {
super(props);
let checked, indeterminate;
if ('checked' in props) {
checked = props.checked;
} else {
checked = props.defaultChecked;
}
static defaultProps = {
onTintColor: '#00e158',
thumbTintColor: '#ffffff',
tintColor: '#ffffff'
}
if ('indeterminate' in props) {
indeterminate = props.indeterminate;
} else {
indeterminate = props.defaultIndeterminate;
}
this.state = {
checked,
indeterminate
};
}
static defaultProps = {
onValueChange: noop,
defaultChecked: false,
defaultIndeterminate:false,
onTintColor: '#00e158',
thumbTintColor: '#fff',
tintColor: '#fff'
}
state = {
value: this.props.value,
};
componentWillReceiveProps(nextProps) {
//
if ('checked' in nextProps) {
this.setState({ checked: nextProps.checked});
}
if ('indeterminate' in nextProps) {
this.setState({ indeterminate: nextProps.indeterminate});
}
}
componentDidMount() {
this.componentDidUpdate();
}
componentDidUpdate() {
}
handleClick = (e) => {
if (this.props.disabled) {
return null;
return null;
}
const { disabled, onValueChange } = this.props;
const checked =!this.state.checked;
if (!('checked' in this.props)) {
this.setState({
checked
});
}
var newVal = !this.state.value;
this.props.onValueChange && this.props.onValueChange.call(this, newVal);
this.setState({
value: newVal
});
var oldValue = this.props.value;
setTimeout(() => {
if (this.props.value == oldValue) {
if (!('indeterminate' in this.props)) {
this.setState({
value: this.props.value
indeterminate: false
});
}
}, 200);
onValueChange(checked, e);
} else {
onValueChange(checked, false, e);
}
};

@@ -45,12 +82,12 @@

span: {
width: DEFAULT_WIDTH,
height: DEFAULT_HEIGHT,
borderRadius: '40rem',
position: 'relative',
display: 'inline-block',
margin: 2,
height: 30,
width: 50,
margin: '4rem',
cursor: 'default', // pointer will cause a grey background color on chrome
verticalAlign: 'middle',
borderRadius: 20,
borderColor: '#dfdfdf',
borderWidth: 1,
borderWidth: '1px',
borderStyle: 'solid',

@@ -81,4 +118,4 @@ WebkitUserSelect: 'none',

top: 0,
width: 30,
height: 30,
width: '60rem',
height: '60rem',
backgroundColor: this.props.thumbTintColor,

@@ -90,3 +127,3 @@ borderRadius: '100%',

checkedSmall: {
WebkitTransform: 'translateX(20px)'
WebkitTransform: 'translateX(40rem)'
},

@@ -98,5 +135,4 @@ uncheckedSmall: {

}
render() {
if (isWeex) {

@@ -108,5 +144,5 @@ let nativeProps = {

},
checked: this.state.value,
checked: this.state.checked,
disabled: this.props.disabled,
onChange: this.props.onValueChange,
onChange: this.handleClick
};

@@ -119,4 +155,4 @@

let styles = this.getStyles();
let spancss = this.state.value ? {...styles.span, ...styles.checkedSpan} : {...styles.span, ...styles.uncheckedSpan};
let smallcss = this.state.value ? {...styles.small, ...styles.checkedSmall} : {...styles.small, ...styles.uncheckedSmall};
let spancss = this.state.checked ? {...styles.span, ...styles.checkedSpan} : {...styles.span, ...styles.uncheckedSpan};
let smallcss = this.state.checked ? {...styles.small, ...styles.checkedSmall} : {...styles.small, ...styles.uncheckedSmall};
spancss = this.props.disabled ? {...spancss, ...styles.disabledSpan} : spancss;

@@ -136,4 +172,4 @@

initial: {
width: '100rem', // default width
height: '60rem', // default height
width: DEFAULT_WIDTH,
height: DEFAULT_HEIGHT,
},

@@ -140,0 +176,0 @@ };

@@ -7,3 +7,3 @@ /* @jsx createElement */

import {env} from 'nuke-core'; const isWeex = env.isWeex;
import View from './View';
import View from './view';

@@ -10,0 +10,0 @@ class TouchableHighlight extends Component {

@@ -6,3 +6,2 @@ /* @jsx createElement */

import {Component, createElement} from 'weex-rx';
import TouchableHighlight from './TouchableHighlight';
import {env} from 'nuke-core'; const isWeex = env.isWeex;

@@ -9,0 +8,0 @@

/** @jsx createElement */
import {createElement, Component} from 'weex-rx';
import { View, Text} from 'nuke-components';
import Button from 'nuke-demo';
import { View, Text,Image,ScrollView,TouchableHighlight,Switch,TextInput} from 'nuke-components';
import {mount} from 'nuke-mounter';

@@ -12,24 +11,55 @@

}
press() {
alert('4444444')
press(){
console.log(1);
}
render() {
return (
<View>
<View style={{flexDirection:'row',marginBottom:'20rem'}}>
<Button onPress={this.press.bind(this)} type="normal">normal</Button>
<Button onPress={this.press.bind(this)} type="primary">primary</Button>
<Button onPress={this.press.bind(this)} type="secondary">secondary</Button>
</View>
<View>
<Button onPress={this.press.bind(this)} block="true" type="normal">block normal</Button>
</View>
<View>
<View style={{backgroundColor:'grey',height:'200rem'}}>
</View>
<View style={{height:'200rem'}}>
<Image source={{uri: '//img.alicdn.com/tps/TB1l8ZsNpXXXXaQXVXXXXXXXXXX-160-280.jpg'}} style={{width: '160rem',height: '280rem',}} resizeMode={'cover'}/>
</View>
<ScrollView style={{height:200}} onEndReachedThreshold={300} onEndReached={()=>{}}>
<View>第1个</View>
<View>第2个</View>
<View>第3个</View>
<View>第4个</View>
<View>第5个</View>
<View>第6个</View>
<View>第7个</View>
<View>第8个</View>
<View>第9个</View>
<View>第10个</View>
<View>第11个</View>
<View>第12个</View>
</ScrollView>
<TouchableHighlight onPress={this.press.bind(this)}>
<View style={{backgroundColor:'blue',height:'30rem',justifyContent:'center',alignItems:'center'}}>
<Text style={{color:'#ffffff'}}>摸我</Text>
);
</View>
</TouchableHighlight>
<Switch onTintColor={'green'} tintColor={'#ffffff'} thumbTintColor={'blue'}
value={true}/>
<Switch
value={false}/>
<Text style={{color:'#ffffff'}}>Hello, Nuke</Text>
<TextInput
placeholder="试着输入一些内容"
autoFocus multiline
onFocus={() => console.log('onFocus')}
onBlur={() => console.log('onBlur')}
onInput={() => console.log('onInput')}
style={{
width: '200rem',
height: '200rem',
border: '1px solid # 000'
}}
/>
</View>
)
}
}
mount(<App/>, 'body');
mount(<App/>, 'body');
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc