Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit5176afd

Browse files
committed
use redux diff-logger
1 parent50656aa commit5176afd

File tree

14 files changed

+340
-17
lines changed

14 files changed

+340
-17
lines changed

‎lib/options/configureStore.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎lib/options/configureStore.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
"atom-plugin-command-line":"1.0.2",
3333
"coderoad-cli":"0.10.0",
3434
"marked":"0.3.6",
35-
"material-ui":"0.15.4",
35+
"material-ui":"0.16.0",
3636
"node-file-exists":"1.1.0",
3737
"react":"15.3.2",
3838
"react-dom":"15.3.2",
3939
"react-redux":"4.4.5",
4040
"react-router-sans-urls":"0.1.2",
4141
"react-tap-event-plugin":"1.0.0",
4242
"redux":"3.6.0",
43-
"redux-logger":"2.6.1",
43+
"redux-logger":"2.7.0",
4444
"redux-thunk":"2.1.0",
4545
"reselect":"2.5.4"
4646
},
@@ -49,8 +49,8 @@
4949
"electron-chromedriver":"^1.4.0",
5050
"eslint":"^3.6.1",
5151
"eslint-plugin-react":"^6.3.0",
52-
"jest":"^15.1.1",
53-
"jest-cli":"^15.1.1",
52+
"jest":"^16.0.1",
53+
"jest-cli":"^16.0.1",
5454
"react-addons-test-utils":"15.3.2",
5555
"react-test-renderer":"15.3.2",
5656
"redux-mock-store":"^1.2.1",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
importRadiumfrom'radium';
2+
import*asReactfrom'react';
3+
4+
import{Markdown}from'../index';
5+
import{Card,CardHeader,CardText}from'material-ui/Card';
6+
7+
conststyles={
8+
card:{
9+
margin:'5px',
10+
},
11+
};
12+
13+
@Radium()
14+
constContentCard:React.StatelessComponent<{
15+
title:string,content?:string
16+
}>=({title, content})=>(
17+
<Cardstyle={styles.card}>
18+
{title ?<CardHeadertitle={title}/> :null}
19+
<CardText>
20+
<Markdownchildren={content||''}/>
21+
</CardText>
22+
</Card>
23+
);
24+
exportdefaultContentCard;
25+
26+
// ContentCard.propTypes = {
27+
// title: React.PropTypes.string,
28+
// content: React.PropTypes.string.optional,
29+
// };
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import*asReactfrom'react';
2+
3+
importhighlightfrom'./syntax-highlighter';
4+
5+
constCodeBlock:React.StatelessComponent<{
6+
children:string,style?:React.CSSProperties,lang:string
7+
}>=({style, children, lang})=>(
8+
<pre>
9+
<code
10+
style={style ?style :{}}
11+
dangerouslySetInnerHTML={{__html:highlight(children,lang)}}
12+
/>
13+
</pre>
14+
);
15+
exportdefaultCodeBlock;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import*asmarkedfrom'marked';
2+
3+
importhighlightfrom'./syntax-highlighter';
4+
5+
constoptions={
6+
breaks:true,
7+
gfm:true,
8+
highlight,
9+
tables:true,
10+
sanitize:true,
11+
smartLists:true,
12+
};
13+
14+
exportdefaultfunction(text:string):string{
15+
returntypeoftext!=='string' ?'' :marked(text.toString(),options);
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import*asReactfrom'react';
2+
3+
importformatTextfrom'./formatText';
4+
5+
constMarkdown:React.StatelessComponent<{
6+
children:string,style?:React.CSSProperties
7+
}>=({style, children})=>(
8+
<span
9+
className='cr-markdown'
10+
style={style ?style :{}}
11+
dangerouslySetInnerHTML={{__html:formatText(children)}}
12+
/>
13+
);
14+
exportdefaultMarkdown;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import{editor}from'../../../index';
2+
3+
exportdefaultfunctionhighlight(text:string,lang:string):string{
4+
constscopeName=`source.${lang}`;
5+
// get grammar
6+
constgrammar=editor.grammar.getFromScope(scopeName);
7+
// no grammar, return text
8+
if(!grammar){
9+
returntext;
10+
}
11+
// get tokens
12+
constlineTokens=editor.grammar.tokenizeLines(grammar,text);
13+
if(lineTokens.length>0){
14+
constlastLineTokens=lineTokens[lineTokens.length-1];
15+
if(lastLineTokens.length===1&&lastLineTokens[0].value===''){
16+
lineTokens.pop();
17+
}
18+
}
19+
lethtml='<pre class="editor editor-colors">';
20+
21+
lineTokens.forEach(line=>{
22+
html+='<div class="line">';
23+
line.forEach(({value, scopes})=>{
24+
// account for spaces
25+
if(!value){
26+
value=' ';
27+
}
28+
// wrap text with class spans
29+
scopes.forEach(scope=>{
30+
html+=`<span class="${scope.replace(/\./g,' ')}">`;
31+
});
32+
// text
33+
html+=`${value}`;
34+
// closing tags
35+
scopes.forEach(scope=>{
36+
html+='</span>';
37+
});
38+
});
39+
});
40+
html+='</div></pre>';
41+
returnhtml;
42+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import*asReactfrom'react';
2+
import{connect}from'react-redux';
3+
4+
import{routeSet}from'../../actions';
5+
importRaisedButtonfrom'material-ui/RaisedButton';
6+
7+
classRouteButtonextendsReact.Component<{
8+
label:string,route:string,routeSet:any,style:React.CSSProperties
9+
},{}>{
10+
publicrender(){
11+
const{label, route, style, routeSet}=this.props;
12+
return(
13+
<RaisedButton
14+
label={label}
15+
style={style||{}}
16+
onTouchTap={routeSet.bind(this,route)}
17+
secondary={true}
18+
/>
19+
);
20+
}
21+
}
22+
23+
// RouteButton.propTypes = {
24+
// label: React.PropTypes.string,
25+
// route: React.PropTypes.string,
26+
// routeSet: React.PropTypes.func.optional,
27+
// style: React.PropTypes.object.optional,
28+
// };
29+
30+
constmapStateToProps=(state,props)=>({
31+
label:props.label,
32+
route:props.route,
33+
style:props.style||{}
34+
});
35+
constmapDispatchToProps={routeSet};
36+
37+
exportdefaultconnect(mapStateToProps,mapDispatchToProps)(RouteButton);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import*asReactfrom'react';
2+
3+
interfaceIStyles{
4+
editor:React.CSSProperties;
5+
};
6+
7+
conststyles:IStyles={
8+
editor:{
9+
textAlign:'left',
10+
},
11+
};
12+
13+
exportdefaultclassTextEditorextendsReact.Component<{
14+
name:string,text?:string,lang:string,onSave?:()=>any,
15+
placeholder?:string,
16+
},{}>{
17+
18+
// create a new TextEditor
19+
publiced=atom.workspace.buildTextEditor();
20+
publicget():string{
21+
returnthis.ed.getText();
22+
}
23+
publicrender(){
24+
return<divid={this.props.name}style={styles.editor}/>;
25+
}
26+
privatecomponentDidMount(){
27+
const{name, text, lang, placeholder}=this.props;
28+
// specify language
29+
this.ed.setGrammar(
30+
atom.grammars.grammarForScopeName(`source.${lang}`)
31+
);
32+
if(text){
33+
this.ed.setText(text||'');
34+
}
35+
if(placeholder){
36+
this.ed.setPlaceholderText(placeholder);
37+
}
38+
// append editor to rendered div
39+
document.querySelector(`#${name}`).appendChild(this.ed.getElement());
40+
}
41+
}

‎src/options/configureStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const configureStore = ({reducer, devMode}) => {
88

99
// use logger if devMode
1010
if(devMode){
11-
constlogger=(createLoggerasany)();
11+
constlogger=(createLoggerasany)({diff:true});
1212
middlewares.push(logger);
1313
}else{
1414
process.env.NODE_ENV='production';

‎src/typings/globals/radium/index.d.ts

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Generated by typings
2+
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/092e7f33ba65b4162419b7c5d56e8f1a55ffdbf9/radium/radium.d.ts
3+
declare module'radium'{
4+
import*asReactfrom'react';
5+
6+
7+
namespaceRadium{
8+
interfaceStyleRules{
9+
[index:string]:React.CSSProperties;
10+
}
11+
12+
/**
13+
* Style component properties
14+
*/
15+
exportinterfaceStyleProps{
16+
/**
17+
* An object of styles, or an object of CSS rules to render. Each key of the rules object is a CSS
18+
* selector and the value is an object of styles. If rules is empty, the component will render nothing.
19+
*/
20+
rules:React.CSSProperties|StyleRules;
21+
/**
22+
* A string that any included selectors in rules will be appended to.
23+
* Use to scope styles in the component to a particular element. A good use case might be to generate a unique
24+
* ID for a component to scope any styles to the particular component that owns the <Style> component instance.
25+
*/
26+
scopeSelector?:string;
27+
}
28+
29+
/**
30+
* <Style />
31+
*/
32+
exportclassStyleextendsReact.Component<StyleProps,any>{
33+
}
34+
35+
/**
36+
* StyleRoot component properties
37+
*/
38+
exportinterfaceStyleRootPropsextendsReact.HTMLProps<StyleRoot>{
39+
}
40+
/**
41+
* <StyleRoot />
42+
*/
43+
exportclassStyleRootextendsReact.Component<StyleRootProps,any>{
44+
}
45+
46+
/**
47+
* Radium configuration
48+
*/
49+
exportinterfaceRadiumConfig{
50+
/**
51+
* Allow to replace matchMedia function that Radium uses. The default one is window.matchMedia
52+
*@param mediaQuery
53+
*/
54+
matchMedia?:(mediaQuery:string)=>MediaQueryList;
55+
/**
56+
* Set the user agent passed to inline-style-prefixer to perform prefixing on style objects.
57+
* Mainly used during server rendering
58+
*/
59+
userAgent?:string;
60+
/**
61+
* List of plugins
62+
*/
63+
plugins?:Array<any>;
64+
}
65+
66+
/**
67+
* Query Radium's knowledge of the browser state for a given element key.
68+
* This is particularly useful if you would like to set styles for one element when another element is in a particular state,
69+
* e.g. show a message when a button is hovered.
70+
*
71+
* Note that the target element specified by elementKey must have the state you'd like to check defined in
72+
* its style object so that Radium knows to add the handlers. It can be empty, e.g. ':hover': {}.
73+
*@param state you'll usually pass this.state, but sometimes you may want to pass a previous state, like in shouldComponentUpdate, componentWillUpdate, and componentDidUpdate
74+
*@param elementKey if you used multiple elements, pass the same key="" or ref="". If you only have one element, you can leave it blank ('main' will be inferred)
75+
*@param value one of the following: :active, :focus, and :hover
76+
*/
77+
exportfunctiongetState(state:any,elementKey:string|void,value:":active"|":focus"|":hover"):boolean;
78+
79+
/**
80+
* Create a keyframes animation for use in an inline style.
81+
*@param keyframes
82+
*@param name
83+
*/
84+
exportfunctionkeyframes(keyframes:StyleRules,name?:string):Object;
85+
86+
// Radium 0.17 Test mode
87+
/**
88+
* Used to control internal Radium state and behavior during tests. It is only available in non-production builds.
89+
*/
90+
interfaceRadiumTestMode{
91+
/**
92+
* Clears the global Radium state, currently only the cache of media query listeners.
93+
*/
94+
clearState():void;
95+
/**
96+
* Enables "test mode", which doesn’t throw or warn as much. Currently it just doesn’t throw when using addCSS without StyleRoot.
97+
*/
98+
enable():void;
99+
/**
100+
* Disables "test mode"
101+
*/
102+
disable():void;
103+
}
104+
105+
varTestMode:RadiumTestMode;
106+
107+
}
108+
//@Radium decorator
109+
functionRadium<TElementextendsFunction>(component:TElement):TElement;
110+
functionRadium(config:Radium.RadiumConfig):(component?:any)=>any;
111+
112+
export=Radium;
113+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"resolution":"main",
3+
"tree": {
4+
"src":"https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/092e7f33ba65b4162419b7c5d56e8f1a55ffdbf9/radium/radium.d.ts",
5+
"raw":"registry:dt/radium#0.18.1+20160907102602",
6+
"typings":"https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/092e7f33ba65b4162419b7c5d56e8f1a55ffdbf9/radium/radium.d.ts"
7+
}
8+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp