Skip to content

Commit 7687d00

Browse files
committed
init
0 parents  commit 7687d00

11 files changed

+4612
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.cache
2+
node_modules

dev.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import jsxSync from './index'
2+
import vueJsx from 'babel-plugin-transform-vue-jsx'
3+
import Prism from 'prismjs'
4+
import 'prismjs/themes/prism-okaidia.css'
5+
import 'prismjs/components/prism-javascript'
6+
import 'prismjs/components/prism-jsx'
7+
8+
let code = `
9+
function a() {
10+
return (
11+
<div>
12+
<component visible$sync={this.test}>I am newbie</component>
13+
</div>
14+
)
15+
}`
16+
17+
let result = Babel.transform(code, {
18+
plugins: [
19+
vueJsx,
20+
jsxSync
21+
]
22+
})
23+
24+
let codeDom = document.querySelector('#code')
25+
let transformedCode = document.querySelector('#transformed-code')
26+
let ast = document.querySelector('#ast')
27+
28+
function prismCode(code, lang) {
29+
var hl = Prism.highlight(code, Prism.languages[lang])
30+
return '<pre data-lang="' + lang + '"><code class="lang-' + lang + '">' + hl + '</code></pre>'
31+
}
32+
33+
codeDom.innerHTML = prismCode(code, 'jsx')
34+
transformedCode.innerHTML = prismCode(result.code, 'javascript')
+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/**
2+
* okaidia theme for JavaScript, CSS and HTML
3+
* Loosely based on Monokai textmate theme by http://www.monokai.nl/
4+
* @author ocodia
5+
*/
6+
7+
code[class*="language-"],
8+
pre[class*="language-"] {
9+
color: #f8f8f2;
10+
background: none;
11+
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
12+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
13+
text-align: left;
14+
white-space: pre;
15+
word-spacing: normal;
16+
word-break: normal;
17+
word-wrap: normal;
18+
line-height: 1.5;
19+
20+
-moz-tab-size: 4;
21+
-o-tab-size: 4;
22+
tab-size: 4;
23+
24+
-webkit-hyphens: none;
25+
-moz-hyphens: none;
26+
-ms-hyphens: none;
27+
hyphens: none;
28+
}
29+
30+
/* Code blocks */
31+
pre[class*="language-"] {
32+
padding: 1em;
33+
margin: .5em 0;
34+
overflow: auto;
35+
border-radius: 0.3em;
36+
}
37+
38+
:not(pre) > code[class*="language-"],
39+
pre[class*="language-"] {
40+
background: #272822;
41+
}
42+
43+
/* Inline code */
44+
:not(pre) > code[class*="language-"] {
45+
padding: .1em;
46+
border-radius: .3em;
47+
white-space: normal;
48+
}
49+
50+
.token.comment,
51+
.token.prolog,
52+
.token.doctype,
53+
.token.cdata {
54+
color: slategray;
55+
}
56+
57+
.token.punctuation {
58+
color: #f8f8f2;
59+
}
60+
61+
.namespace {
62+
opacity: .7;
63+
}
64+
65+
.token.property,
66+
.token.tag,
67+
.token.constant,
68+
.token.symbol,
69+
.token.deleted {
70+
color: #f92672;
71+
}
72+
73+
.token.boolean,
74+
.token.number {
75+
color: #ae81ff;
76+
}
77+
78+
.token.selector,
79+
.token.attr-name,
80+
.token.string,
81+
.token.char,
82+
.token.builtin,
83+
.token.inserted {
84+
color: #a6e22e;
85+
}
86+
87+
.token.operator,
88+
.token.entity,
89+
.token.url,
90+
.language-css .token.string,
91+
.style .token.string,
92+
.token.variable {
93+
color: #f8f8f2;
94+
}
95+
96+
.token.atrule,
97+
.token.attr-value,
98+
.token.function {
99+
color: #e6db74;
100+
}
101+
102+
.token.keyword {
103+
color: #66d9ef;
104+
}
105+
106+
.token.regex,
107+
.token.important {
108+
color: #fd971f;
109+
}
110+
111+
.token.important,
112+
.token.bold {
113+
font-weight: bold;
114+
}
115+
.token.italic {
116+
font-style: italic;
117+
}
118+
119+
.token.entity {
120+
cursor: help;
121+
}

0 commit comments

Comments
 (0)