mirror of
https://github.com/ritz078/transform.git
synced 2026-11-26 02:33:50 +03:00
Merge pull request #1 from transform-it/master
Merging latest code changes
This commit is contained in:
41 files changed
+3842
-2201
No files matched your search
+20
-1
@@ -136,6 +136,25 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "shakyShane",
|
||||
"name": "Shane Osbourne",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/1643522?v=4",
|
||||
"profile": "https://medium.com/@shakyShane",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "pd4d10",
|
||||
"name": "Rongjian Zhang",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/9524411?v=4",
|
||||
"profile": "https://github.com/pd4d10",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"repoType": "github"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"presets": ["next/babel"],
|
||||
"plugins": ["transform-react-remove-prop-types"]
|
||||
"presets": ["next/babel", "@babel/preset-flow"],
|
||||
"plugins": ["transform-react-remove-prop-types", "lodash", "@babel/plugin-proposal-decorators"]
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import { Controlled } from "react-codemirror2";
|
||||
import greenlet from "greenlet";
|
||||
import cn from "classnames";
|
||||
|
||||
require("codemirror-graphql/mode");
|
||||
require("codemirror/mode/javascript/javascript");
|
||||
require("codemirror/mode/xml/xml");
|
||||
require("codemirror/mode/jsx/jsx");
|
||||
require("codemirror/mode/css/css");
|
||||
require("codemirror/mode/rust/rust");
|
||||
require("codemirror/mode/sql/sql");
|
||||
require("codemirror/mode/clike/clike");
|
||||
require("codemirror/mode/go/go");
|
||||
require("codemirror/mode/yaml/yaml");
|
||||
|
||||
function noop() {}
|
||||
|
||||
const prettierParsers = {
|
||||
css: "postcss",
|
||||
javascript: "babylon",
|
||||
jsx: "babylon",
|
||||
graphql: "graphql",
|
||||
json: "json",
|
||||
typescript: "typescript",
|
||||
flow: "flow"
|
||||
};
|
||||
|
||||
function prettify(code, mode = "json", parsers) {
|
||||
let prettier;
|
||||
|
||||
try {
|
||||
importScripts("https://bundle.run/prettier@1.6.1");
|
||||
prettier = self.prettier;
|
||||
} catch (e) {
|
||||
throw new Error("prettier not available");
|
||||
}
|
||||
return prettier
|
||||
? prettier.format(code, {
|
||||
parser: parsers[mode],
|
||||
printWidth: 70,
|
||||
semi: false
|
||||
})
|
||||
: code;
|
||||
}
|
||||
|
||||
const worker = greenlet(prettify);
|
||||
|
||||
export default class extends PureComponent {
|
||||
static defaultProps = {
|
||||
onChange: noop,
|
||||
onBeforeChange: noop,
|
||||
autoPrettify: true,
|
||||
allowPrettify: true
|
||||
};
|
||||
|
||||
state = {
|
||||
value: "",
|
||||
isPrettierAvailable: true
|
||||
};
|
||||
|
||||
prettifyCode = async (props = this.props) => {
|
||||
try {
|
||||
const prettified = props.value
|
||||
? await worker(props.value, props.mode, prettierParsers)
|
||||
: props.value;
|
||||
|
||||
this.setState({
|
||||
value: prettified
|
||||
});
|
||||
} catch (e) {
|
||||
this.setState({
|
||||
value: props.value,
|
||||
isPrettierAvailable: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
autoPrettify = props => {
|
||||
if (!props.autoPrettify) {
|
||||
this.setState({
|
||||
value: props.value
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.prettifyCode(props);
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.autoPrettify(this.props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.value !== this.props.value) {
|
||||
this.autoPrettify(nextProps);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
options,
|
||||
onChange,
|
||||
onBeforeChange,
|
||||
mode,
|
||||
allowPrettify
|
||||
} = this.props;
|
||||
const { value } = this.state;
|
||||
|
||||
const buttonClass = cn("btn top-right", {
|
||||
disabled: !this.state.isPrettierAvailable
|
||||
});
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<style>{`
|
||||
.top-right {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 9px;
|
||||
}
|
||||
`}</style>
|
||||
{allowPrettify &&
|
||||
prettierParsers[mode] && (
|
||||
<button
|
||||
onClick={() => this.prettifyCode(this.props)}
|
||||
className={buttonClass}
|
||||
>
|
||||
Prettify
|
||||
</button>
|
||||
)}
|
||||
<Controlled
|
||||
value={value}
|
||||
options={options}
|
||||
onChange={onChange}
|
||||
onBeforeChange={onBeforeChange}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
+94
-162
@@ -3,32 +3,8 @@ import cn from "classnames";
|
||||
import isBrowser from "is-in-browser";
|
||||
import copy from "copy-text-to-clipboard";
|
||||
import unfetch from "unfetch";
|
||||
import loadWorker from "../utils/loadWorker";
|
||||
|
||||
let CodeMirror;
|
||||
if (isBrowser) {
|
||||
CodeMirror = require("react-codemirror2").UnControlled;
|
||||
|
||||
require("codemirror-graphql/mode");
|
||||
require("codemirror/mode/javascript/javascript");
|
||||
require("codemirror/mode/xml/xml");
|
||||
require("codemirror/mode/jsx/jsx");
|
||||
require("codemirror/mode/css/css");
|
||||
require("codemirror/mode/rust/rust");
|
||||
require("codemirror/mode/sql/sql");
|
||||
require("codemirror/mode/clike/clike");
|
||||
require("codemirror/mode/go/go");
|
||||
}
|
||||
|
||||
const prettierParsers = {
|
||||
css: "postcss",
|
||||
javascript: "babylon",
|
||||
jsx: "babylon",
|
||||
graphql: "graphql",
|
||||
json: "json",
|
||||
typescript: "typescript",
|
||||
flow: "flow"
|
||||
};
|
||||
import { List } from "react-content-loader";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const modeMapping = {
|
||||
javascript: {
|
||||
@@ -51,15 +27,17 @@ const modeMapping = {
|
||||
typescript: true
|
||||
},
|
||||
mysql: "text/x-mysql",
|
||||
scala: "text/x-scala"
|
||||
scala: "text/x-scala",
|
||||
jsx: "text/jsx",
|
||||
yaml: "text/x-yaml"
|
||||
};
|
||||
|
||||
type Props = {
|
||||
leftMode: ?string,
|
||||
rightMode: ?string,
|
||||
resultValue: string,
|
||||
onCheckboxChange: Function,
|
||||
checkboxText: ?string,
|
||||
onCheckboxChange?: Function,
|
||||
checkboxText?: string,
|
||||
pathname: string,
|
||||
initialCheckboxValue: ?boolean,
|
||||
leftTitle: string,
|
||||
@@ -75,6 +53,13 @@ type Props = {
|
||||
extensions: ?(string[])
|
||||
};
|
||||
|
||||
const codeMirrorOptions = {
|
||||
lineNumbers: true,
|
||||
theme: "chrome-devtools",
|
||||
lineWrapping: true,
|
||||
scrollbarStyle: null
|
||||
};
|
||||
|
||||
function UploadIcon() {
|
||||
return (
|
||||
<svg
|
||||
@@ -105,6 +90,19 @@ function ClearIcon() {
|
||||
);
|
||||
}
|
||||
|
||||
function Stubs({ numberOfStubs = 3 }) {
|
||||
return (
|
||||
<div style={{ padding: 30 }}>
|
||||
{[...new Array(numberOfStubs)].map((x, i) => <List key={i} />)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const CodeMirror = dynamic(import("./CodeMirror"), {
|
||||
ssr: false,
|
||||
loading: () => <Stubs />
|
||||
});
|
||||
|
||||
export default class ConversionPanel extends PureComponent {
|
||||
props: Props;
|
||||
|
||||
@@ -116,8 +114,7 @@ export default class ConversionPanel extends PureComponent {
|
||||
value: props.defaultText,
|
||||
splitValue: "",
|
||||
info: "",
|
||||
infoType: "",
|
||||
isPrettierAvailable: true
|
||||
infoType: ""
|
||||
};
|
||||
}
|
||||
|
||||
@@ -136,33 +133,8 @@ export default class ConversionPanel extends PureComponent {
|
||||
const { defaultText, splitValue } = this.props;
|
||||
|
||||
this.onChange(defaultText, splitValue);
|
||||
|
||||
const { worker, promiseWorker } = loadWorker("prettier.js");
|
||||
this.worker = worker;
|
||||
this.promiseWorker = promiseWorker;
|
||||
|
||||
this.worker.onmessage = this.setPrettierAvailability;
|
||||
}
|
||||
|
||||
setPrettierAvailability = ({ data }) => {
|
||||
if (!data.available || this.state.isPrettierAvailable === data.available) {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
isPrettierAvailable: data.available
|
||||
});
|
||||
};
|
||||
|
||||
passCodeToWorker = (code, mode, section) => {
|
||||
this.promiseWorker.postMessage({ code, mode, section }).then(response => {
|
||||
const { available, prettyCode, section } = response;
|
||||
this.setState({
|
||||
isPrettierAvailable: available,
|
||||
[section]: prettyCode
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
clearText = () => {
|
||||
this.setState({
|
||||
value: ""
|
||||
@@ -185,7 +157,7 @@ export default class ConversionPanel extends PureComponent {
|
||||
};
|
||||
|
||||
onChange = async (newValue, leftSplitValue) => {
|
||||
const { prettifyRightPanel, rightMode } = this.props;
|
||||
const { leftMode } = this.props;
|
||||
|
||||
const nValue = newValue || this.state.value;
|
||||
const splitValue =
|
||||
@@ -194,16 +166,18 @@ export default class ConversionPanel extends PureComponent {
|
||||
: this.state.splitValue;
|
||||
|
||||
try {
|
||||
let code = await this.props.getTransformedValue(nValue, splitValue);
|
||||
// Convert JS to JSON
|
||||
const json =
|
||||
leftMode === "json"
|
||||
? JSON.stringify(eval("(" + nValue + ")", null, 2))
|
||||
: nValue;
|
||||
let code = IN_BROWSER
|
||||
? await this.props.getTransformedValue(json, splitValue)
|
||||
: "";
|
||||
code = code.prettyCode || code;
|
||||
if (prettifyRightPanel) {
|
||||
this.passCodeToWorker(code, rightMode, "resultValue");
|
||||
} else {
|
||||
this.setState({
|
||||
resultValue: code
|
||||
});
|
||||
}
|
||||
|
||||
this.setState({
|
||||
resultValue: code,
|
||||
info: "",
|
||||
infoType: ""
|
||||
});
|
||||
@@ -229,25 +203,8 @@ export default class ConversionPanel extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
prettifyCode = () => {
|
||||
if (!this.state.isPrettierAvailable) return;
|
||||
const { leftMode } = this.props;
|
||||
const { value } = this.state;
|
||||
|
||||
this.passCodeToWorker(value, leftMode, "value");
|
||||
};
|
||||
|
||||
prettifySplitCode = () => {
|
||||
if (!this.state.isPrettierAvailable) return;
|
||||
const { splitMode } = this.props;
|
||||
const { splitValue } = this.state;
|
||||
|
||||
this.passCodeToWorker(splitValue, splitMode, "splitValue");
|
||||
};
|
||||
|
||||
copyCode = () => {
|
||||
const { resultValue } = this.state;
|
||||
|
||||
copy(resultValue);
|
||||
|
||||
this.setState({
|
||||
@@ -256,12 +213,6 @@ export default class ConversionPanel extends PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
getPrettifyClass = () => {
|
||||
return cn("btn", {
|
||||
disabled: !this.state.isPrettierAvailable
|
||||
});
|
||||
};
|
||||
|
||||
loadFile = e => {
|
||||
const file = e.target.files[0];
|
||||
const reader = new FileReader();
|
||||
@@ -285,7 +236,8 @@ export default class ConversionPanel extends PureComponent {
|
||||
splitMode,
|
||||
showFetchButton,
|
||||
fetchButtonText,
|
||||
extensions
|
||||
extensions,
|
||||
prettifyRightPanel
|
||||
} = this.props;
|
||||
const { infoType, resultValue, value, info, splitValue } = this.state;
|
||||
|
||||
@@ -293,14 +245,7 @@ export default class ConversionPanel extends PureComponent {
|
||||
split: splitLeft
|
||||
});
|
||||
|
||||
const codeMirrorOptions = {
|
||||
lineNumbers: true,
|
||||
theme: "chrome-devtools",
|
||||
lineWrapping: true,
|
||||
scrollbarStyle: null
|
||||
};
|
||||
|
||||
// hide success footer bannner after 2 seconds. Let other types be visible until fixed.
|
||||
// hide success footer banner after 2 seconds. Let other types be visible until fixed.
|
||||
clearTimeout(this.footerTimeout);
|
||||
if (infoType === "success") {
|
||||
this.footerTimeout = setTimeout(
|
||||
@@ -368,34 +313,10 @@ export default class ConversionPanel extends PureComponent {
|
||||
|
||||
.info {
|
||||
color: white;
|
||||
font: 14px/normal "Monaco", "Menlo", "Ubuntu Mono", "Consolas",
|
||||
font: 14px / normal "Monaco", "Menlo", "Ubuntu Mono", "Consolas",
|
||||
"source-code-pro", monospace;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background-color: #2196f3;
|
||||
font-size: 14px;
|
||||
padding: 7px 14px;
|
||||
z-index: 9;
|
||||
border: 0;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
color: #fff;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.btn.disabled {
|
||||
background-color: #e0e0e0;
|
||||
pointer-events: none;
|
||||
color: #7b7b7b;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background-color: #0490ff;
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 50px;
|
||||
background-color: white;
|
||||
@@ -547,6 +468,30 @@ export default class ConversionPanel extends PureComponent {
|
||||
margin-right: 4px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background-color: #2196f3;
|
||||
font-size: 14px;
|
||||
padding: 7px 14px;
|
||||
z-index: 9;
|
||||
border: 0;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
color: #fff;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.btn.disabled {
|
||||
background-color: #e0e0e0;
|
||||
pointer-events: none;
|
||||
color: #7b7b7b;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background-color: #0490ff;
|
||||
}
|
||||
`}</style>
|
||||
|
||||
<div className="content-wrapper">
|
||||
@@ -562,31 +507,25 @@ export default class ConversionPanel extends PureComponent {
|
||||
</button>
|
||||
)}
|
||||
|
||||
{prettierParsers[leftMode] && (
|
||||
<button
|
||||
className={this.getPrettifyClass()}
|
||||
onClick={this.prettifyCode}
|
||||
>
|
||||
Prettify
|
||||
</button>
|
||||
)}
|
||||
<div />
|
||||
</div>
|
||||
|
||||
<div className="clear" onClick={this.clearText}>
|
||||
{" "}
|
||||
<ClearIcon />
|
||||
</div>
|
||||
|
||||
{isBrowser && (
|
||||
<CodeMirror
|
||||
onChange={(editor, metadata, value) => this.onChange(value)}
|
||||
value={value}
|
||||
options={{
|
||||
mode: modeMapping[leftMode] || leftMode,
|
||||
...codeMirrorOptions
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<CodeMirror
|
||||
onBeforeChange={(editor, metadata, value) =>
|
||||
this.onChange(value)
|
||||
}
|
||||
value={value}
|
||||
options={{
|
||||
mode: modeMapping[leftMode] || leftMode,
|
||||
...codeMirrorOptions
|
||||
}}
|
||||
mode={leftMode}
|
||||
autoPrettify={false}
|
||||
/>
|
||||
|
||||
{extensions &&
|
||||
extensions.length > 0 && (
|
||||
@@ -606,17 +545,9 @@ export default class ConversionPanel extends PureComponent {
|
||||
<div className="panel">
|
||||
<div className="header">
|
||||
<h4 className="title">{splitTitle}</h4>
|
||||
{prettierParsers[splitMode] && (
|
||||
<button
|
||||
className={this.getPrettifyClass()}
|
||||
onClick={this.prettifySplitCode}
|
||||
>
|
||||
Prettify
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<CodeMirror
|
||||
onChange={(editor, metadata, value) =>
|
||||
onBeforeChange={(editor, metadata, value) =>
|
||||
this.onChange(this.state.value, value)
|
||||
}
|
||||
value={splitValue}
|
||||
@@ -624,6 +555,7 @@ export default class ConversionPanel extends PureComponent {
|
||||
mode: modeMapping[splitMode] || splitMode,
|
||||
...codeMirrorOptions
|
||||
}}
|
||||
mode={splitMode}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -647,18 +579,18 @@ export default class ConversionPanel extends PureComponent {
|
||||
Copy
|
||||
</button>
|
||||
</div>
|
||||
{isBrowser && (
|
||||
<CodeMirror
|
||||
value={resultValue}
|
||||
options={{
|
||||
readOnly: true,
|
||||
mode: modeMapping[rightMode] || rightMode,
|
||||
...codeMirrorOptions,
|
||||
lineNumbers: false
|
||||
}}
|
||||
onChange={() => {}}
|
||||
/>
|
||||
)}
|
||||
<CodeMirror
|
||||
value={resultValue}
|
||||
options={{
|
||||
readOnly: true,
|
||||
mode: modeMapping[rightMode] || rightMode,
|
||||
...codeMirrorOptions,
|
||||
lineNumbers: false
|
||||
}}
|
||||
mode={rightMode}
|
||||
autoPrettify={prettifyRightPanel}
|
||||
allowPrettify={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+20
-54
@@ -1,24 +1,12 @@
|
||||
import React, { PureComponent, Component } from "react";
|
||||
import React, { PureComponent } from "react";
|
||||
import isBrowser from "is-in-browser";
|
||||
import Link from "next/link";
|
||||
import Head from "next/head";
|
||||
import NProgress from "nprogress";
|
||||
import Router from "next/router";
|
||||
import GithubCorner from "react-github-corner";
|
||||
import FuzzyPicker, { FuzzyWrapper } from "react-fuzzy-picker";
|
||||
import Collapse, { Panel } from "rc-collapse";
|
||||
import findIndex from "lodash/findIndex";
|
||||
import { categorizedRoutes, routes, activeRouteData } from "../utils/routes";
|
||||
|
||||
NProgress.configure({ showSpinner: false });
|
||||
|
||||
Router.onRouteChangeStart = url => {
|
||||
if (url.indexOf("code=") === -1) {
|
||||
NProgress.start();
|
||||
}
|
||||
};
|
||||
Router.onRouteChangeComplete = () => NProgress.done();
|
||||
Router.onRouteChangeError = () => NProgress.done();
|
||||
import { categorizedRoutes, routes } from "../utils/routes";
|
||||
|
||||
function Logo() {
|
||||
return (
|
||||
@@ -94,13 +82,24 @@ export default class Layout extends PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
routes.forEach(({ path }) => Router.prefetch(path));
|
||||
Layout.loadCarbonAds();
|
||||
}
|
||||
|
||||
componentWillReceiveProps({ pathname }) {
|
||||
this.setKey(pathname);
|
||||
}
|
||||
|
||||
static loadCarbonAds() {
|
||||
// const script = document.createElement("script");
|
||||
//
|
||||
// script.src =
|
||||
// "//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=transformnowsh";
|
||||
// script.async = true;
|
||||
// script.id = "_carbonads_js";
|
||||
//
|
||||
// document.getElementById("carbonads_nav").appendChild(script);
|
||||
}
|
||||
|
||||
setKey = pathname => {
|
||||
this.setState({
|
||||
activeKey: `${findIndex(
|
||||
@@ -117,44 +116,8 @@ export default class Layout extends PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { label, desc, title } = activeRouteData(this.props.pathname);
|
||||
|
||||
return (
|
||||
<div className="main-wrapper">
|
||||
<Head>
|
||||
<title>{title || label}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/png" href="/static/favicon.png" />
|
||||
<meta
|
||||
name="google-site-verification"
|
||||
content="bjJSOEahdert-7mwVScrwTTUVR3nSe0bEj5YjevUNn0"
|
||||
/>
|
||||
<meta name="description" content={desc} />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-mfizz/2.4.1/font-mfizz.min.css"
|
||||
/>
|
||||
<link rel="stylesheet" href="/static/styles.css" />
|
||||
<link rel="manifest" href="/static/manifest.json" />
|
||||
<meta name="theme-color" content="#2196f3" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="application-name" content="Transform" />
|
||||
<meta name="apple-mobile-web-app-title" content="Transform" />
|
||||
<meta name="theme-color" content="#2196f3" />
|
||||
<meta name="msapplication-navbutton-color" content="#2196f3" />
|
||||
<meta
|
||||
name="apple-mobile-web-app-status-bar-style"
|
||||
content="black-translucent"
|
||||
/>
|
||||
<meta name="msapplication-starturl" content="./" />
|
||||
<meta name="msapplication-TileColor" content="#2196f3" />
|
||||
<meta
|
||||
name="msapplication-TileImage"
|
||||
content="/static/images/icons/icon-144x144.png"
|
||||
/>
|
||||
</Head>
|
||||
<style jsx>{`
|
||||
.sidebar {
|
||||
height: 100vh;
|
||||
@@ -248,8 +211,9 @@ export default class Layout extends PureComponent {
|
||||
.Collapsible__trigger {
|
||||
color: whitesmoke;
|
||||
font-family: "Lato", sans-serif;
|
||||
line-height: 44px;
|
||||
line-height: 34px;
|
||||
cursor: pointer;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.Collapsible__trigger a:hover {
|
||||
@@ -281,10 +245,10 @@ export default class Layout extends PureComponent {
|
||||
display: block;
|
||||
color: #fff;
|
||||
font-family: "Lato";
|
||||
line-height: 44px;
|
||||
line-height: 34px;
|
||||
padding-left: 20px;
|
||||
background-color: #3c3c3c;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
}
|
||||
`}</style>
|
||||
@@ -342,6 +306,8 @@ export default class Layout extends PureComponent {
|
||||
</Collapse>
|
||||
</div>
|
||||
|
||||
{/*<div id="carbonads_nav" />*/}
|
||||
|
||||
<div className="footer">
|
||||
Created by{" "}
|
||||
<a
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function({ pathname }) {
|
||||
const { packageName, packageUrl } = activeRouteData(pathname);
|
||||
|
||||
return (
|
||||
<a className="powered-by">
|
||||
<div className="powered-by">
|
||||
<style jsx>{`
|
||||
a {
|
||||
display: inline-block;
|
||||
@@ -66,6 +66,6 @@ export default function({ pathname }) {
|
||||
<i className="icon-npm" />
|
||||
<span>{packageName}</span>
|
||||
</a>
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+35
-32
@@ -1,16 +1,11 @@
|
||||
const BabiliPlugin = require("babili-webpack-plugin");
|
||||
const webpack = require("webpack");
|
||||
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
|
||||
const { ANALYZE } = process.env;
|
||||
const glob = require("glob");
|
||||
const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin");
|
||||
const LodashModuleReplacementPlugin = require("lodash-webpack-plugin");
|
||||
|
||||
module.exports = {
|
||||
webpack: (config, { dev }) => {
|
||||
config.plugins = config.plugins.filter(
|
||||
plugin => plugin.constructor.name !== "UglifyJsPlugin"
|
||||
);
|
||||
|
||||
webpack: (config, { dev, isServer }) => {
|
||||
config.node = {
|
||||
fs: "empty"
|
||||
};
|
||||
@@ -20,31 +15,35 @@ module.exports = {
|
||||
use: ["style-loader", "css-loader"]
|
||||
});
|
||||
|
||||
config.plugins.push(new webpack.DefinePlugin({ IN_BROWSER: true }));
|
||||
config.plugins.push(
|
||||
new LodashModuleReplacementPlugin({
|
||||
collections: true,
|
||||
shorthands: true
|
||||
}),
|
||||
new webpack.DefinePlugin({ IN_BROWSER: !isServer })
|
||||
);
|
||||
|
||||
config.resolve.alias = {
|
||||
"babel-core": "babel-standalone"
|
||||
};
|
||||
|
||||
if (!dev) {
|
||||
config.plugins.push(new BabiliPlugin());
|
||||
|
||||
config.plugins.push(
|
||||
new SWPrecacheWebpackPlugin({
|
||||
minify: true,
|
||||
staticFileGlobsIgnorePatterns: [/\.next\//],
|
||||
staticFileGlobs: [
|
||||
"static/**/*" // Precache all static files by default
|
||||
],
|
||||
runtimeCaching: [
|
||||
{
|
||||
handler: "networkFirst",
|
||||
urlPattern: /^https?.*/
|
||||
}
|
||||
]
|
||||
})
|
||||
);
|
||||
}
|
||||
// if (!dev) {
|
||||
// config.plugins.push(
|
||||
// new SWPrecacheWebpackPlugin({
|
||||
// minify: true,
|
||||
// staticFileGlobsIgnorePatterns: [/\.next\//],
|
||||
// staticFileGlobs: [
|
||||
// "static/**/*" // Precache all static files by default
|
||||
// ],
|
||||
// runtimeCaching: [
|
||||
// {
|
||||
// handler: "networkFirst",
|
||||
// urlPattern: /^https?.*/
|
||||
// }
|
||||
// ]
|
||||
// })
|
||||
// );
|
||||
// }
|
||||
|
||||
if (ANALYZE) {
|
||||
config.plugins.push(
|
||||
@@ -61,11 +60,15 @@ module.exports = {
|
||||
|
||||
exportPathMap() {
|
||||
const pathMap = {};
|
||||
glob.sync("pages/**/*.js", { ignore: "pages/_document.js" }).forEach(s => {
|
||||
const path = s.split(/(pages|\.)/)[2].replace(/^\/index$/, "/");
|
||||
console.log(path);
|
||||
pathMap[path] = { page: path };
|
||||
});
|
||||
glob
|
||||
.sync("pages/**/*.js", {
|
||||
ignore: ["pages/_document.js", "pages/_app.js"]
|
||||
})
|
||||
.forEach(s => {
|
||||
const path = s.split(/(pages|\.)/)[2].replace(/^\/index$/, "/");
|
||||
console.log(path);
|
||||
pathMap[path] = { page: path };
|
||||
});
|
||||
return pathMap;
|
||||
}
|
||||
};
|
||||
+30
-17
@@ -5,13 +5,13 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "next start",
|
||||
"build":
|
||||
"rm -rf out && next build && next export -o transform && cp ./.next/service-worker.js ./transform/service-worker.js",
|
||||
"build": "next build",
|
||||
"export": "next export -o transform",
|
||||
"dev": "next dev",
|
||||
"addContributor": "all-contributors add",
|
||||
"analyze": "cross-env ANALYZE=1 next build",
|
||||
"format": "prettier --write **/*.js",
|
||||
"deploy": "yarn build && cd transform && now",
|
||||
"deploy": "yarn build && yarn export && cd transform && now",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"precommit": "lint-staged"
|
||||
},
|
||||
@@ -38,47 +38,60 @@
|
||||
"babel-plugin-object-styles-to-template": "^0.1.2",
|
||||
"babel-standalone": "^6.26.0",
|
||||
"classnames": "^2.2.5",
|
||||
"codemirror": "^5.33.0",
|
||||
"codemirror": "^5.37.0",
|
||||
"codemirror-graphql": "^0.6.11",
|
||||
"copy-text-to-clipboard": "^1.0.4",
|
||||
"css-in-js-generator": "^0.3.0-alpha.2",
|
||||
"generate-schema": "^2.5.1",
|
||||
"gofmt.js": "^0.0.2",
|
||||
"greenlet": "^0.1.2",
|
||||
"is-in-browser": "^1.1.3",
|
||||
"is-svg": "^2.1.0",
|
||||
"is-svg": "^3.0.0",
|
||||
"json-schema-faker": "^0.5.0-rc11",
|
||||
"json-schema-to-typescript": "^4.6.5",
|
||||
"json-schema-to-typescript": "4.6.5",
|
||||
"json-ts": "^1.6.4",
|
||||
"json2yaml": "^1.1.0",
|
||||
"jsx-to-json": "^0.2.3",
|
||||
"lodash": "^4.17.4",
|
||||
"next": "4.2.1",
|
||||
"markdown": "^0.5.0",
|
||||
"next": "6.0.0-canary.6",
|
||||
"nprogress": "^0.2.0",
|
||||
"promise-worker": "^1.1.1",
|
||||
"prop-types": "^15.6.0",
|
||||
"rc-collapse": "^1.7.7",
|
||||
"rc-collapse": "^1.9.0",
|
||||
"react": "16.2.0",
|
||||
"react-codemirror2": "^3.0.7",
|
||||
"react-codemirror2": "4.2.1",
|
||||
"react-content-loader": "^3.1.1",
|
||||
"react-dom": "16.2.0",
|
||||
"react-fuzzy-picker": "0.6.0",
|
||||
"react-github-corner": "^2.0.0",
|
||||
"react-fuzzy-picker": "0.7.0",
|
||||
"react-github-corner": "^2.3.0",
|
||||
"stringify-object": "^3.2.1",
|
||||
"transform-css-to-js": "^0.1.1",
|
||||
"transform-graphql-type-annotations": "^0.1.1",
|
||||
"transform-json-types": "^0.3.0",
|
||||
"transform-json-types": "^0.4.1",
|
||||
"transform-svg-to-native": "^0.1.3",
|
||||
"unfetch": "^3.0.0",
|
||||
"xml-js": "^1.6.1"
|
||||
"xml-js": "^1.6.2",
|
||||
"yaml": "^0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-decorators": "^7.0.0-beta.44",
|
||||
"@babel/preset-flow": "^7.0.0-beta.44",
|
||||
"all-contributors-cli": "^4.10.1",
|
||||
"babel-plugin-lodash": "^3.3.2",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.10",
|
||||
"babili-webpack-plugin": "^0.1.2",
|
||||
"cross-env": "^5.1.4",
|
||||
"css-loader": "^0.28.7",
|
||||
"glob": "^7.1.2",
|
||||
"husky": "^0.14.3",
|
||||
"lint-staged": "^6.0.0",
|
||||
"prettier": "^1.9.2",
|
||||
"style-loader": "^0.19.1",
|
||||
"lint-staged": "^7.0.5",
|
||||
"lodash-webpack-plugin": "^0.11.5",
|
||||
"prettier": "^1.12.1",
|
||||
"style-loader": "^0.21.0",
|
||||
"sw-precache-webpack-plugin": "^0.11.4",
|
||||
"webpack-bundle-analyzer": "^2.9.0",
|
||||
"worker-loader": "^1.0.0"
|
||||
"worker-loader": "^1.0.0",
|
||||
"workerize-loader": "^1.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import App, { Container } from "next/app";
|
||||
import React from "react";
|
||||
import Head from "next/head";
|
||||
import Router, { withRouter } from "next/router";
|
||||
import Layout from "../components/Layout";
|
||||
import NProgress from "nprogress";
|
||||
import { routes, activeRouteData } from "../utils/routes";
|
||||
|
||||
NProgress.configure({ showSpinner: false });
|
||||
|
||||
Router.onRouteChangeStart = url => {
|
||||
if (url.indexOf("code=") === -1) {
|
||||
NProgress.start();
|
||||
}
|
||||
};
|
||||
Router.onRouteChangeComplete = () => NProgress.done();
|
||||
Router.onRouteChangeError = () => NProgress.done();
|
||||
|
||||
class MyApp extends App {
|
||||
static async getInitialProps({ Component, router, ctx }) {
|
||||
let pageProps = {};
|
||||
|
||||
if (Component.getInitialProps) {
|
||||
pageProps = await Component.getInitialProps(ctx);
|
||||
}
|
||||
|
||||
return { pageProps };
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
routes.forEach(({ path }) => Router.prefetch(path));
|
||||
}
|
||||
|
||||
render() {
|
||||
const { Component, pageProps, router } = this.props;
|
||||
|
||||
const { label, desc, title } = activeRouteData(router.pathname) || {};
|
||||
|
||||
return (
|
||||
<Layout pathname={router.pathname}>
|
||||
<Head>
|
||||
<title>{title || label}</title>
|
||||
<link rel="icon" type="image/png" href="/static/favicon.png" />
|
||||
<meta
|
||||
name="google-site-verification"
|
||||
content="bjJSOEahdert-7mwVScrwTTUVR3nSe0bEj5YjevUNn0"
|
||||
/>
|
||||
<meta name="description" content={desc} />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-mfizz/2.4.1/font-mfizz.min.css"
|
||||
/>
|
||||
<link rel="stylesheet" href="/static/styles.css" />
|
||||
<link rel="manifest" href="/static/manifest.json" />
|
||||
<meta name="theme-color" content="#2196f3" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="application-name" content="Transform" />
|
||||
<meta name="apple-mobile-web-app-title" content="Transform" />
|
||||
<meta name="theme-color" content="#2196f3" />
|
||||
<meta name="msapplication-navbutton-color" content="#2196f3" />
|
||||
<meta
|
||||
name="apple-mobile-web-app-status-bar-style"
|
||||
content="black-translucent"
|
||||
/>
|
||||
<meta name="msapplication-starturl" content="./" />
|
||||
<meta name="msapplication-TileColor" content="#2196f3" />
|
||||
<meta
|
||||
name="msapplication-TileImage"
|
||||
content="/static/images/icons/icon-144x144.png"
|
||||
/>
|
||||
</Head>
|
||||
<Container>
|
||||
<Component url={router} {...pageProps} />
|
||||
</Container>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withRouter(MyApp);
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { PureComponent, Fragment } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
@@ -118,7 +118,7 @@ ${group.replace(/[\r\n]+/g, "\n\n")}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="CSS"
|
||||
rightTitle="Emotion"
|
||||
@@ -130,7 +130,7 @@ ${group.replace(/[\r\n]+/g, "\n\n")}
|
||||
extensions={null}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { PureComponent, Fragment } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import loadWorker from "../utils/loadWorker";
|
||||
@@ -38,7 +38,7 @@ export default class extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="CSS"
|
||||
rightTitle="JavaScript"
|
||||
@@ -54,7 +54,7 @@ export default class extends PureComponent {
|
||||
extensions={null}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { PureComponent, Fragment } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import { dummySchema, dummyQuery } from "../utils/graphql-schema";
|
||||
@@ -19,7 +19,7 @@ export default class extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="Schema"
|
||||
rightTitle="Flow"
|
||||
@@ -36,7 +36,7 @@ export default class extends PureComponent {
|
||||
prettifyRightPanel={false}
|
||||
extensions={null}
|
||||
/>
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import { dummySchema, dummyQuery } from "../utils/graphql-schema";
|
||||
@@ -19,7 +19,7 @@ export default class Json2Ts extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="Schema"
|
||||
rightTitle="TypeScript Definition"
|
||||
@@ -36,7 +36,7 @@ export default class Json2Ts extends PureComponent {
|
||||
prettifyRightPanel={false}
|
||||
extensions={null}
|
||||
/>
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
+17
-20
@@ -1,6 +1,5 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import HTMLtoJSX from "@tsuyoshiwada/htmltojsx";
|
||||
import Layout from "../components/Layout";
|
||||
import HTMLtoJSX from "htmltojsx";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import isSvg from "is-svg";
|
||||
import svgo from "transform-svg-to-native/dist/svgo";
|
||||
@@ -35,24 +34,22 @@ export default class Css2Js extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
url={this.props.url}
|
||||
leftTitle="HTML/SVG"
|
||||
rightTitle="JSX"
|
||||
leftMode="html"
|
||||
rightMode="jsx"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"html_to_jsx"}
|
||||
defaultText={defaultText}
|
||||
checkboxText="Optimize SVG"
|
||||
extensions={[".svg", ".html"]}
|
||||
initialCheckboxValue={this.state.shouldOptimize}
|
||||
onCheckboxChange={(checked: boolean, cb: Function) =>
|
||||
this.setState({ shouldOptimize: checked }, cb)
|
||||
}
|
||||
/>
|
||||
</Layout>
|
||||
<ConversionPanel
|
||||
url={this.props.url}
|
||||
leftTitle="HTML/SVG"
|
||||
rightTitle="JSX"
|
||||
leftMode="html"
|
||||
rightMode="jsx"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"html_to_jsx"}
|
||||
defaultText={defaultText}
|
||||
checkboxText="Optimize SVG"
|
||||
extensions={[".svg", ".html"]}
|
||||
initialCheckboxValue={this.state.shouldOptimize}
|
||||
onCheckboxChange={(checked: boolean, cb: Function) =>
|
||||
this.setState({ shouldOptimize: checked }, cb)
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
+26
-23
@@ -1,5 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
import merge from "lodash/merge";
|
||||
import loadWorker from "../utils/loadWorker";
|
||||
@@ -26,33 +25,37 @@ export default class Main extends PureComponent {
|
||||
|
||||
componentDidMount() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register("/service-worker.js")
|
||||
.then(registration => {
|
||||
console.log("service worker registration successful");
|
||||
})
|
||||
.catch(err => {
|
||||
console.warn("service worker registration failed");
|
||||
});
|
||||
// navigator.serviceWorker
|
||||
// .register("/service-worker.js")
|
||||
// .then(registration => {
|
||||
// console.log("service worker registration successful");
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.warn("service worker registration failed");
|
||||
// });
|
||||
|
||||
navigator.serviceWorker.getRegistrations().then(function(registrations) {
|
||||
for (let registration of registrations) {
|
||||
registration.unregister();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="PropTypes"
|
||||
leftMode="json"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"prop_types"}
|
||||
defaultText={defaultText}
|
||||
onCheckboxChange={(checked, cb) =>
|
||||
this.setState({ isImmutable: checked }, cb)
|
||||
}
|
||||
checkboxText="Immutable Proptypes"
|
||||
/>
|
||||
</Layout>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="PropTypes"
|
||||
leftMode="json"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"prop_types"}
|
||||
defaultText={defaultText}
|
||||
onCheckboxChange={(checked, cb) =>
|
||||
this.setState({ isImmutable: checked }, cb)
|
||||
}
|
||||
checkboxText="Immutable Proptypes"
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
+11
-14
@@ -1,5 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import stringify from "stringify-object";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import text from "../utils/dummy-object-json";
|
||||
@@ -13,19 +12,17 @@ export default class extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
leftTitle="JS Object"
|
||||
rightTitle="JSON"
|
||||
url={this.props.url}
|
||||
leftMode="json"
|
||||
rightMode="json"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"js_to_json"}
|
||||
defaultText={defaultText}
|
||||
extensions={null}
|
||||
/>
|
||||
</Layout>
|
||||
<ConversionPanel
|
||||
leftTitle="JS Object"
|
||||
rightTitle="JSON"
|
||||
url={this.props.url}
|
||||
leftMode="json"
|
||||
rightMode="json"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"js_to_json"}
|
||||
defaultText={defaultText}
|
||||
extensions={null}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import json from "../utils/dummy-json-schema";
|
||||
import loadWorker from "../utils/loadWorker";
|
||||
@@ -22,23 +21,21 @@ export default class Json2Ts extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON Schema"
|
||||
rightTitle="Rust Serde"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={json}
|
||||
leftMode="javascript"
|
||||
rightMode="rust"
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
checkboxText="Snake Case"
|
||||
initialCheckboxValue={this.state.snakeCase}
|
||||
onCheckboxChange={(checked: boolean, cb: Function) =>
|
||||
this.setState({ snakeCase: checked }, cb)
|
||||
}
|
||||
/>
|
||||
</Layout>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON Schema"
|
||||
rightTitle="Rust Serde"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={json}
|
||||
leftMode="javascript"
|
||||
rightMode="rust"
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
checkboxText="Snake Case"
|
||||
initialCheckboxValue={this.state.snakeCase}
|
||||
onCheckboxChange={(checked: boolean, cb: Function) =>
|
||||
this.setState({ snakeCase: checked }, cb)
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { PureComponent, Fragment } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import { compile } from "json-schema-to-typescript";
|
||||
@@ -10,7 +10,7 @@ export default class Json2Ts extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON Schema"
|
||||
rightTitle="TypeScript Interface"
|
||||
@@ -23,7 +23,7 @@ export default class Json2Ts extends PureComponent {
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { PureComponent, Fragment } from "react";
|
||||
import { bigquery } from "generate-schema";
|
||||
import stringify from "stringify-object";
|
||||
import Layout from "../components/Layout";
|
||||
@@ -14,7 +14,7 @@ export default class Json2Ts extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="Big Query Schema"
|
||||
@@ -26,7 +26,7 @@ export default class Json2Ts extends PureComponent {
|
||||
url={this.props.url}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import React, { PureComponent, Fragment } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
import transform from "transform-json-types";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
|
||||
export default class Json2Ts extends PureComponent {
|
||||
getTransformedValue = code => transform(code);
|
||||
getTransformedValue = code => transform(code, { mode: "flow" });
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="Flow Types"
|
||||
@@ -22,7 +22,8 @@ export default class Json2Ts extends PureComponent {
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
</Layout>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
@@ -11,7 +11,7 @@ export default class extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="Go Struct"
|
||||
@@ -24,7 +24,7 @@ export default class extends PureComponent {
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import plugin from "../utils/babel-plugin-js-to-mobx-state-tree";
|
||||
import Layout from "../components/Layout";
|
||||
import { transform } from "babel-standalone";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
|
||||
@@ -18,17 +17,15 @@ export default class Main extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="MobX-State-Tree Model"
|
||||
url={this.props.url}
|
||||
leftMode="json"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"mobx_state_tree_model"}
|
||||
defaultText={defaultText}
|
||||
/>
|
||||
</Layout>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="MobX-State-Tree Model"
|
||||
url={this.props.url}
|
||||
leftMode="json"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"mobx_state_tree_model"}
|
||||
defaultText={defaultText}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import { mongoose } from "generate-schema";
|
||||
import stringify from "stringify-object";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
import defaultText from "../utils/dummy-object-json";
|
||||
@@ -14,7 +13,7 @@ export default class Json2Ts extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="Mongoose Schema"
|
||||
@@ -27,7 +26,7 @@ export default class Json2Ts extends PureComponent {
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import { mysql } from "generate-schema";
|
||||
import Layout from "../components/Layout";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
@@ -13,7 +12,7 @@ export default class Json2Ts extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="MySQL Table Schema"
|
||||
@@ -26,7 +25,7 @@ export default class Json2Ts extends PureComponent {
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
+16
-19
@@ -1,5 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
import transform from "transform-json-types";
|
||||
@@ -16,24 +15,22 @@ export default class Json2Ts extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="Rust Serde"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"ts_interface"}
|
||||
defaultText={defaultText}
|
||||
leftMode="json"
|
||||
rightMode="rust"
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
checkboxText="Snake Case"
|
||||
initialCheckboxValue={this.state.snakeCase}
|
||||
onCheckboxChange={(checked: boolean, cb: Function) =>
|
||||
this.setState({ snakeCase: checked }, cb)
|
||||
}
|
||||
/>
|
||||
</Layout>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="Rust Serde"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"ts_interface"}
|
||||
defaultText={defaultText}
|
||||
leftMode="json"
|
||||
rightMode="rust"
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
checkboxText="Snake Case"
|
||||
initialCheckboxValue={this.state.snakeCase}
|
||||
onCheckboxChange={(checked: boolean, cb: Function) =>
|
||||
this.setState({ snakeCase: checked }, cb)
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
import transform from "transform-json-types";
|
||||
@@ -11,19 +10,17 @@ export default class extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="Scala Case Class"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"scala_case_class"}
|
||||
defaultText={defaultText}
|
||||
leftMode="json"
|
||||
rightMode="scala"
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
</Layout>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="Scala Case Class"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"scala_case_class"}
|
||||
defaultText={defaultText}
|
||||
leftMode="json"
|
||||
rightMode="scala"
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
import transform from "transform-json-types";
|
||||
import { json2ts } from "json-ts";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
|
||||
export default class Json2Ts extends PureComponent {
|
||||
getTransformedValue = code =>
|
||||
transform(code, {
|
||||
lang: "typescript"
|
||||
json2ts(code, {
|
||||
prefix: ""
|
||||
});
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="TypeScript Interface"
|
||||
@@ -25,7 +25,8 @@ export default class Json2Ts extends PureComponent {
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
</Layout>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
import { stringify } from "json2yaml";
|
||||
|
||||
const defaultText = `{
|
||||
"foo": "bar",
|
||||
"baz": [
|
||||
"qux",
|
||||
"quxx"
|
||||
],
|
||||
"corge": null,
|
||||
"grault": 1,
|
||||
"garply": true,
|
||||
"waldo": "false",
|
||||
"fred": "undefined",
|
||||
"emptyarr": []
|
||||
}`;
|
||||
|
||||
export default class extends PureComponent {
|
||||
getTransformedValue = code => stringify(JSON.parse(code));
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="YAML"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={defaultText}
|
||||
leftMode="json"
|
||||
rightMode="yaml"
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
import worker from "workerize-loader?inline!../workers/jsx-to-js-object";
|
||||
|
||||
const defaultText = `<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.1">
|
||||
<rect width="200" height="100" stroke="black" stroke-width="6" fill="green"/>
|
||||
</svg>`;
|
||||
|
||||
export default class extends PureComponent {
|
||||
getTransformedValue = async code => {
|
||||
const result = await worker().transform(code);
|
||||
if (result.code) {
|
||||
return result.value;
|
||||
} else {
|
||||
throw new Error(result.value);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="JSX"
|
||||
rightTitle="JS Object"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={defaultText}
|
||||
leftMode="jsx"
|
||||
rightMode="json"
|
||||
url={this.props.url}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
import { markdown } from "markdown";
|
||||
|
||||
// Example text from https://en.wikipedia.org/wiki/Markdown#Example
|
||||
const defaultText = `Heading
|
||||
=======
|
||||
|
||||
## Sub-heading
|
||||
|
||||
Paragraphs are separated
|
||||
by a blank line.
|
||||
|
||||
Two spaces at the end of a line
|
||||
produces a line break.
|
||||
|
||||
Text attributes _italic_,
|
||||
**bold**, \`monospace\`.
|
||||
|
||||
Horizontal rule:
|
||||
|
||||
---
|
||||
|
||||
Bullet list:
|
||||
|
||||
* apples
|
||||
* oranges
|
||||
* pears
|
||||
|
||||
Numbered list:
|
||||
|
||||
1. wash
|
||||
2. rinse
|
||||
3. repeat
|
||||
|
||||
A [link](http://example.com).
|
||||
|
||||

|
||||
|
||||
> Markdown uses email-style > characters for blockquoting.
|
||||
`;
|
||||
|
||||
export default class extends PureComponent {
|
||||
getTransformedValue = text => markdown.toHTML(text);
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="Markdown"
|
||||
rightTitle="HTML"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={defaultText}
|
||||
leftMode="markdown"
|
||||
rightMode="html"
|
||||
url={this.props.url}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import merge from "lodash/merge";
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import loadWorker from "../utils/loadWorker";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
|
||||
@@ -33,7 +31,7 @@ export default class Main extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="Object Styles"
|
||||
rightTitle="Template Literal"
|
||||
@@ -43,7 +41,7 @@ export default class Main extends PureComponent {
|
||||
defaultText={defaultText}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import convertSvgString from "transform-svg-to-native";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import isSvg from "is-svg";
|
||||
import svgo from "transform-svg-to-native/dist/svgo";
|
||||
|
||||
const defaultText = `<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.1">
|
||||
<rect width="200" height="100" stroke="black" stroke-width="6" fill="green"/>
|
||||
@@ -22,19 +20,17 @@ export default class Svg2ReactNative extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
url={this.props.url}
|
||||
leftTitle="SVG"
|
||||
rightTitle="JSX"
|
||||
leftMode="html"
|
||||
rightMode="jsx"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"svg_to_react_native"}
|
||||
defaultText={defaultText}
|
||||
extensions={[".svg", ".html"]}
|
||||
/>
|
||||
</Layout>
|
||||
<ConversionPanel
|
||||
url={this.props.url}
|
||||
leftTitle="SVG"
|
||||
rightTitle="JSX"
|
||||
leftMode="html"
|
||||
rightMode="jsx"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={"svg_to_react_native"}
|
||||
defaultText={defaultText}
|
||||
extensions={[".svg", ".html"]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import { xml2json } from "xml-js";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
|
||||
@@ -29,7 +28,7 @@ export default class extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="XML"
|
||||
rightTitle="JSON"
|
||||
@@ -47,7 +46,7 @@ export default class extends PureComponent {
|
||||
extensions={null}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import React, { Fragment, PureComponent } from "react";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
import yaml from "yaml";
|
||||
|
||||
const defaultText = `---
|
||||
foo: "bar"
|
||||
baz:
|
||||
- "qux"
|
||||
- "quxx"
|
||||
corge: null
|
||||
grault: 1
|
||||
garply: true
|
||||
waldo: "false"
|
||||
fred: "undefined"
|
||||
emptyarr: []
|
||||
emptyobj: {}
|
||||
`;
|
||||
|
||||
export default class extends PureComponent {
|
||||
getTransformedValue = code => JSON.stringify(yaml.eval(code));
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Fragment>
|
||||
<ConversionPanel
|
||||
leftTitle="YAML"
|
||||
rightTitle="JSON"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={defaultText}
|
||||
leftMode="yaml"
|
||||
rightMode="json"
|
||||
url={this.props.url}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,28 +5,6 @@
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
- [JSON to PropTypes](https://transform.now.sh)
|
||||
- [HTML to JSX](https://transform.now.sh/html-to-jsx)
|
||||
- [CSS to JS Objects](https://transform.now.sh/css-to-js)
|
||||
- [JSON to Flow Types](https://transform.now.sh/json-to-flow-types)
|
||||
- [JSON to TypeScript Interface](https://transform.now.sh/json-to-ts-interface)
|
||||
- [JSON to MobX-State-Tree Model](https://transform.now.sh/json-to-mobx-state-tree)
|
||||
- [JSON to Rust Serde](https://transform.now.sh/json-to-rust-serde)
|
||||
- [JSON to Mongoose Schema](https://transform.now.sh/json-to-mongoose)
|
||||
- [JSON to Big Query Schema](https://transform.now.sh/json-to-big-query)
|
||||
- [JSON to MySQL](https://transform.now.sh/json-to-mysql)
|
||||
- [JSON to Scala Case Class](https://transform.now.sh/json-to-scala-case-class)
|
||||
- [GraphQL to TypeScript](https://transform.now.sh/graphql-to-typescript)
|
||||
- [GraphQL to Flow](https://transform.now.sh/graphql-to-flow)
|
||||
- [XML to JSON](https://transform.now.sh/xml-to-json)
|
||||
- [Object Styles to template literal](https://transform.now.sh/object-styles-to-template-literal)
|
||||
|
||||
## Code Structure
|
||||
- Create a new route - Add a file `new-pathname.js` in `pages` folder.
|
||||
- Update path info in `utils/routes.js`
|
||||
- Use ConversionPanel - This Component takes the conversionMethod and renders the Ace Editors.
|
||||
|
||||
## Development
|
||||
|
||||
- Fork the repo
|
||||
@@ -50,6 +28,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
|
||||
| [<img src="https://avatars3.githubusercontent.com/u/5389035?v=4" width="100px;"/><br /><sub><b>Ritesh Kumar</b></sub>](http://riteshkr.com)<br />[📖](https://github.com/ritz078/transform-www/commits?author=ritz078 "Documentation") [💻](https://github.com/ritz078/transform-www/commits?author=ritz078 "Code") [🤔](#ideas-ritz078 "Ideas, Planning, & Feedback") [👀](#review-ritz078 "Reviewed Pull Requests") | [<img src="https://avatars2.githubusercontent.com/u/47542?v=4" width="100px;"/><br /><sub><b>Florian Gilcher</b></sub>](http://asquera.de)<br />[💻](https://github.com/ritz078/transform-www/commits?author=skade "Code") | [<img src="https://avatars1.githubusercontent.com/u/20063?v=4" width="100px;"/><br /><sub><b>Pascal Hertleif</b></sub>](http://pascalhertleif.de/)<br />[💻](https://github.com/ritz078/transform-www/commits?author=killercup "Code") | [<img src="https://avatars3.githubusercontent.com/u/534610?v=4" width="100px;"/><br /><sub><b>Lado Lomidze</b></sub>](http://landish.github.io)<br />[💻](https://github.com/ritz078/transform-www/commits?author=Landish "Code") | [<img src="https://avatars1.githubusercontent.com/u/13787614?v=4" width="100px;"/><br /><sub><b>Mattia Manzati</b></sub>](https://github.com/mattiamanzati)<br />[💻](https://github.com/ritz078/transform-www/commits?author=mattiamanzati "Code") | [<img src="https://avatars3.githubusercontent.com/u/12202757?v=4" width="100px;"/><br /><sub><b>Mohammad Rajabifard</b></sub>](https://tarino.ir)<br />[🤔](#ideas-morajabi "Ideas, Planning, & Feedback") [💻](https://github.com/ritz078/transform-www/commits?author=morajabi "Code") | [<img src="https://avatars0.githubusercontent.com/u/3108160?v=4" width="100px;"/><br /><sub><b>Raathigeshan Kugarajan</b></sub>](http://raathigesh.com/)<br />[💻](https://github.com/ritz078/transform-www/commits?author=Raathigesh "Code") |
|
||||
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/5554486?v=4" width="100px;"/><br /><sub><b>Gyandeep Singh</b></sub>](https://gyandeeps.com)<br />[💻](https://github.com/ritz078/transform-www/commits?author=gyandeeps "Code") | [<img src="https://avatars2.githubusercontent.com/u/1128849?v=4" width="100px;"/><br /><sub><b>Matt Holt</b></sub>](https://matt.life)<br />[💻](https://github.com/ritz078/transform-www/commits?author=mholt "Code") | [<img src="https://avatars0.githubusercontent.com/u/2767425?v=4" width="100px;"/><br /><sub><b>sreenivas alapati</b></sub>](https://medium.com/@sreenivas)<br />[💻](https://github.com/ritz078/transform-www/commits?author=cg-cnu "Code") | [<img src="https://avatars2.githubusercontent.com/u/1761758?v=4" width="100px;"/><br /><sub><b>Boris Cherny</b></sub>](https://performancejs.com)<br />[💻](https://github.com/ritz078/transform-www/commits?author=bcherny "Code") | [<img src="https://avatars0.githubusercontent.com/u/448?v=4" width="100px;"/><br /><sub><b>Mark Lussier</b></sub>](http://www.twitter.com/intabulas)<br />[💻](https://github.com/ritz078/transform-www/commits?author=intabulas "Code") | [<img src="https://avatars3.githubusercontent.com/u/383212?v=4" width="100px;"/><br /><sub><b>Brice BERNARD</b></sub>](https://github.com/brikou)<br />[💻](https://github.com/ritz078/transform-www/commits?author=brikou "Code") | [<img src="https://avatars2.githubusercontent.com/u/1174278?v=4" width="100px;"/><br /><sub><b>Satyajit Sahoo</b></sub>](https://twitter.com/@satya164)<br />[💻](https://github.com/ritz078/transform-www/commits?author=satya164 "Code") |
|
||||
| [<img src="https://avatars3.githubusercontent.com/u/1643522?v=4" width="100px;"/><br /><sub><b>Shane Osbourne</b></sub>](https://medium.com/@shakyShane)<br />[💻](https://github.com/ritz078/transform-www/commits?author=shakyShane "Code") | [<img src="https://avatars0.githubusercontent.com/u/9524411?v=4" width="100px;"/><br /><sub><b>Rongjian Zhang</b></sub>](https://github.com/pd4d10)<br />[💻](https://github.com/ritz078/transform-www/commits?author=pd4d10 "Code") |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
||||
+295
-105
@@ -1,4 +1,4 @@
|
||||
@import url('https://fonts.googleapis.com/css?family=Lato');
|
||||
@import url("https://fonts.googleapis.com/css?family=Lato");
|
||||
|
||||
.rc-collapse {
|
||||
background-color: #f7f7f7;
|
||||
@@ -9,13 +9,13 @@
|
||||
}
|
||||
|
||||
.rc-collapse > .rc-collapse-item > .rc-collapse-header {
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rc-collapse > .rc-collapse-item > .rc-collapse-header .arrow {
|
||||
display: inline-block;
|
||||
content: '\20';
|
||||
content: "\20";
|
||||
width: 0;
|
||||
height: 0;
|
||||
font-size: 0;
|
||||
@@ -33,6 +33,7 @@
|
||||
}
|
||||
.rc-collapse-content {
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.rc-collapse-content-inactive {
|
||||
@@ -48,7 +49,6 @@
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
|
||||
/* Make clicks pass-through */
|
||||
#nprogress {
|
||||
pointer-events: none;
|
||||
@@ -74,7 +74,7 @@
|
||||
width: 100px;
|
||||
height: 100%;
|
||||
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
|
||||
opacity: 1.0;
|
||||
opacity: 1;
|
||||
|
||||
-webkit-transform: rotate(3deg) translate(0px, -4px);
|
||||
-ms-transform: rotate(3deg) translate(0px, -4px);
|
||||
@@ -144,7 +144,7 @@
|
||||
padding-top: 300px;
|
||||
padding-top: 25vh;
|
||||
z-index: 100;
|
||||
font-family: 'Lato';
|
||||
font-family: "Lato";
|
||||
}
|
||||
.fuzzy-picker-background .fuzzy-picker {
|
||||
width: 600px;
|
||||
@@ -163,16 +163,26 @@
|
||||
font-size: 16px;
|
||||
user-select: none;
|
||||
}
|
||||
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-label {
|
||||
.fuzzy-picker-background
|
||||
.fuzzy-picker
|
||||
.fuzzy-picker-top-text
|
||||
.fuzzy-picker-label {
|
||||
float: left;
|
||||
}
|
||||
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-instructions {
|
||||
.fuzzy-picker-background
|
||||
.fuzzy-picker
|
||||
.fuzzy-picker-top-text
|
||||
.fuzzy-picker-instructions {
|
||||
float: right;
|
||||
}
|
||||
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-instructions span {
|
||||
.fuzzy-picker-background
|
||||
.fuzzy-picker
|
||||
.fuzzy-picker-top-text
|
||||
.fuzzy-picker-instructions
|
||||
span {
|
||||
margin: 0.35em;
|
||||
}
|
||||
.fuzzy-picker-background .fuzzy-picker input[type=text] {
|
||||
.fuzzy-picker-background .fuzzy-picker input[type="text"] {
|
||||
border: 1px solid #dedede;
|
||||
border-radius: 2px;
|
||||
outline: none;
|
||||
@@ -203,7 +213,8 @@
|
||||
|
||||
.CodeMirror {
|
||||
/* Set height, width, borders, and global font properties here */
|
||||
font: 14px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
font: 14px / normal "Monaco", "Menlo", "Ubuntu Mono", "Consolas",
|
||||
"source-code-pro", monospace;
|
||||
height: 300px;
|
||||
color: black;
|
||||
direction: ltr;
|
||||
@@ -219,7 +230,8 @@
|
||||
padding: 0 4px; /* Horizontal padding of content */
|
||||
}
|
||||
|
||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
.CodeMirror-scrollbar-filler,
|
||||
.CodeMirror-gutter-filler {
|
||||
background-color: white; /* The little square between H and V scrollbars */
|
||||
}
|
||||
|
||||
@@ -230,7 +242,8 @@
|
||||
background-color: #f7f7f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.CodeMirror-linenumbers {}
|
||||
.CodeMirror-linenumbers {
|
||||
}
|
||||
.CodeMirror-linenumber {
|
||||
padding: 0 3px 0 5px;
|
||||
min-width: 20px;
|
||||
@@ -239,8 +252,12 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.CodeMirror-guttermarker { color: black; }
|
||||
.CodeMirror-guttermarker-subtle { color: #999; }
|
||||
.CodeMirror-guttermarker {
|
||||
color: black;
|
||||
}
|
||||
.CodeMirror-guttermarker-subtle {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* CURSOR */
|
||||
|
||||
@@ -271,79 +288,162 @@
|
||||
background-color: #7e7;
|
||||
}
|
||||
@-moz-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
0% {
|
||||
}
|
||||
50% {
|
||||
background-color: transparent;
|
||||
}
|
||||
100% {
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
0% {
|
||||
}
|
||||
50% {
|
||||
background-color: transparent;
|
||||
}
|
||||
100% {
|
||||
}
|
||||
}
|
||||
@keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
0% {
|
||||
}
|
||||
50% {
|
||||
background-color: transparent;
|
||||
}
|
||||
100% {
|
||||
}
|
||||
}
|
||||
|
||||
/* Can style cursor different in overwrite (non-insert) mode */
|
||||
.CodeMirror-overwrite .CodeMirror-cursor {}
|
||||
.CodeMirror-overwrite .CodeMirror-cursor {
|
||||
}
|
||||
|
||||
.cm-tab { display: inline-block; text-decoration: inherit; }
|
||||
.cm-tab {
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
.CodeMirror-rulers {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: -50px; bottom: -20px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: -50px;
|
||||
bottom: -20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.CodeMirror-ruler {
|
||||
border-left: 1px solid #ccc;
|
||||
top: 0; bottom: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-chrome-devtools .cm-header {color: blue;}
|
||||
.cm-s-chrome-devtools .cm-quote {color: #090;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
.cm-s-chrome-devtools .cm-header {
|
||||
color: blue;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-quote {
|
||||
color: #090;
|
||||
}
|
||||
.cm-negative {
|
||||
color: #d44;
|
||||
}
|
||||
.cm-positive {
|
||||
color: #292;
|
||||
}
|
||||
.cm-header,
|
||||
.cm-strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
.cm-em {
|
||||
font-style: italic;
|
||||
}
|
||||
.cm-link {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.cm-strikethrough {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.cm-s-chrome-devtools .cm-keyword {color: #708;}
|
||||
.cm-s-chrome-devtools .cm-atom {color: #219;}
|
||||
.cm-s-chrome-devtools .cm-number {color: #164;}
|
||||
.cm-s-chrome-devtools .cm-def {color: #00f;}
|
||||
.cm-s-chrome-devtools .cm-keyword {
|
||||
color: #708;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-atom {
|
||||
color: #219;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-number {
|
||||
color: #164;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-def {
|
||||
color: #00f;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-variable,
|
||||
.cm-s-chrome-devtools .cm-punctuation,
|
||||
.cm-s-chrome-devtools .cm-property,
|
||||
.cm-s-chrome-devtools .cm-operator {}
|
||||
.cm-s-chrome-devtools .cm-variable-2 {color: #05a;}
|
||||
.cm-s-chrome-devtools .cm-variable-3, .cm-s-chrome-devtools .cm-type {color: #085;}
|
||||
.cm-s-chrome-devtools .cm-comment {color: #a50;}
|
||||
.cm-s-chrome-devtools .cm-string {color: #a11;}
|
||||
.cm-s-chrome-devtools .cm-string-2 {color: #f50;}
|
||||
.cm-s-chrome-devtools .cm-meta {color: #555;}
|
||||
.cm-s-chrome-devtools .cm-qualifier {color: #555;}
|
||||
.cm-s-chrome-devtools .cm-builtin {color: #30a;}
|
||||
.cm-s-chrome-devtools .cm-bracket {color: #997;}
|
||||
.cm-s-chrome-devtools .cm-hr {color: #999;}
|
||||
.cm-s-chrome-devtools .cm-link {color: #00c;}
|
||||
.cm-s-chrome-devtools .cm-operator {
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-variable-2 {
|
||||
color: #05a;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-variable-3,
|
||||
.cm-s-chrome-devtools .cm-type {
|
||||
color: #085;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-comment {
|
||||
color: #a50;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-string {
|
||||
color: #a11;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-string-2 {
|
||||
color: #f50;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-meta {
|
||||
color: #555;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-qualifier {
|
||||
color: #555;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-builtin {
|
||||
color: #30a;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-bracket {
|
||||
color: #997;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-hr {
|
||||
color: #999;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-link {
|
||||
color: #00c;
|
||||
}
|
||||
|
||||
.cm-s-chrome-devtools .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
.cm-s-chrome-devtools .cm-error {
|
||||
color: #f00;
|
||||
}
|
||||
.cm-invalidchar {
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
.CodeMirror-composing { border-bottom: 2px solid; }
|
||||
.CodeMirror-composing {
|
||||
border-bottom: 2px solid;
|
||||
}
|
||||
|
||||
/* Default styles for common addons */
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
||||
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {
|
||||
color: #0f0;
|
||||
}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
||||
color: #f22;
|
||||
}
|
||||
.CodeMirror-matchingtag {
|
||||
background: rgba(255, 150, 0, 0.3);
|
||||
}
|
||||
.CodeMirror-activeline-background {
|
||||
background: #e8f2ff;
|
||||
}
|
||||
|
||||
/* STOP */
|
||||
|
||||
@@ -360,7 +460,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
overflow: scroll !important; /* Things will break if this is overridden */
|
||||
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
margin-bottom: -30px; margin-right: -30px;
|
||||
margin-bottom: -30px;
|
||||
margin-right: -30px;
|
||||
padding-bottom: 30px;
|
||||
height: 100%;
|
||||
outline: none; /* Prevent dragging from highlighting the element */
|
||||
@@ -374,30 +475,39 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||
before actual scrolling happens, thus preventing shaking and
|
||||
flickering artifacts. */
|
||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
.CodeMirror-vscrollbar,
|
||||
.CodeMirror-hscrollbar,
|
||||
.CodeMirror-scrollbar-filler,
|
||||
.CodeMirror-gutter-filler {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
display: none;
|
||||
}
|
||||
.CodeMirror-vscrollbar {
|
||||
right: 0; top: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.CodeMirror-hscrollbar {
|
||||
bottom: 0; left: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.CodeMirror-scrollbar-filler {
|
||||
right: 0; bottom: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.CodeMirror-gutter-filler {
|
||||
left: 0; bottom: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-gutters {
|
||||
position: absolute; left: 0; top: 0;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
min-height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
@@ -416,7 +526,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
}
|
||||
.CodeMirror-gutter-background {
|
||||
position: absolute;
|
||||
top: 0; bottom: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-elt {
|
||||
@@ -424,8 +535,12 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
cursor: default;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
|
||||
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
|
||||
.CodeMirror-gutter-wrapper ::selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper ::-moz-selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.CodeMirror-lines {
|
||||
cursor: text;
|
||||
@@ -433,7 +548,9 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
}
|
||||
.CodeMirror pre {
|
||||
/* Reset some styles that the rest of the page might have set */
|
||||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
border-width: 0;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
@@ -458,7 +575,10 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
|
||||
.CodeMirror-linebackground {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: 0; bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
@@ -468,9 +588,12 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.CodeMirror-widget {}
|
||||
.CodeMirror-widget {
|
||||
}
|
||||
|
||||
.CodeMirror-rtl pre { direction: rtl; }
|
||||
.CodeMirror-rtl pre {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.CodeMirror-code {
|
||||
outline: none;
|
||||
@@ -498,7 +621,9 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.CodeMirror-measure pre { position: static; }
|
||||
.CodeMirror-measure pre {
|
||||
position: static;
|
||||
}
|
||||
|
||||
div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
@@ -513,19 +638,35 @@ div.CodeMirror-dragcursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-selected { background: #d9d9d9; }
|
||||
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||
.CodeMirror-crosshair { cursor: crosshair; }
|
||||
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
||||
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
||||
.CodeMirror-selected {
|
||||
background: #d9d9d9;
|
||||
}
|
||||
.CodeMirror-focused .CodeMirror-selected {
|
||||
background: #d7d4f0;
|
||||
}
|
||||
.CodeMirror-crosshair {
|
||||
cursor: crosshair;
|
||||
}
|
||||
.CodeMirror-line::selection,
|
||||
.CodeMirror-line > span::selection,
|
||||
.CodeMirror-line > span > span::selection {
|
||||
background: #d7d4f0;
|
||||
}
|
||||
.CodeMirror-line::-moz-selection,
|
||||
.CodeMirror-line > span::-moz-selection,
|
||||
.CodeMirror-line > span > span::-moz-selection {
|
||||
background: #d7d4f0;
|
||||
}
|
||||
|
||||
.cm-searching {
|
||||
background-color: #ffa;
|
||||
background-color: rgba(255, 255, 0, .4);
|
||||
background-color: rgba(255, 255, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Used to force a border model for a node */
|
||||
.cm-force-border { padding-right: .1px; }
|
||||
.cm-force-border {
|
||||
padding-right: 0.1px;
|
||||
}
|
||||
|
||||
@media print {
|
||||
/* Hide the cursor when printing */
|
||||
@@ -535,64 +676,113 @@ div.CodeMirror-dragcursors {
|
||||
}
|
||||
|
||||
/* See issue #2901 */
|
||||
.cm-tab-wrap-hack:after { content: ''; }
|
||||
.cm-tab-wrap-hack:after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* Help users use markselection to safely style text background */
|
||||
span.CodeMirror-selectedtext { background: none; }
|
||||
span.CodeMirror-selectedtext {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.cm-s-chrome-devtools {
|
||||
background: #FFFFFF;
|
||||
color: #000000;
|
||||
background: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
.cm-s-chrome-devtools .CodeMirror-lines {
|
||||
padding: 8px 0;
|
||||
padding: 8px 0;
|
||||
}
|
||||
.cm-s-chrome-devtools .CodeMirror-gutters {
|
||||
background-color: #FFFFFF;
|
||||
padding-right: 14px;
|
||||
z-index: 3;
|
||||
background-color: #ffffff;
|
||||
padding-right: 14px;
|
||||
z-index: 3;
|
||||
border: none;
|
||||
border-right: 1px solid #eeeeee;
|
||||
}
|
||||
.cm-s-chrome-devtools div.CodeMirror-cursor {
|
||||
border-left: 3px solid #000000;
|
||||
border-left: 3px solid #000000;
|
||||
}
|
||||
.cm-s-chrome-devtools .CodeMirror-activeline-background {
|
||||
background: #0000001A;
|
||||
background: #0000001a;
|
||||
}
|
||||
.cm-s-chrome-devtools .CodeMirror-selected {
|
||||
background: #BAD6FD;
|
||||
background: #bad6fd;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-string {
|
||||
color: #C41A16;
|
||||
color: #c41a16;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-number {
|
||||
color: null;
|
||||
color: null;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-keyword {
|
||||
color: #AA0D91;
|
||||
color: #aa0d91;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-atom {
|
||||
color: null;
|
||||
color: null;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-variable {
|
||||
color: #000000;
|
||||
color: #000000;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-comment {
|
||||
color: #007400;
|
||||
color: #007400;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-variable-2 {
|
||||
color: #881280;
|
||||
color: #881280;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-property {
|
||||
color: null;
|
||||
color: null;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-operator {
|
||||
color: #AA0D91;
|
||||
color: #aa0d91;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-tag {
|
||||
color: #AA0D91
|
||||
color: #aa0d91;
|
||||
}
|
||||
.cm-s-chrome-devtools .cm-attribute {
|
||||
color: #866A04
|
||||
}
|
||||
color: #866a04;
|
||||
}
|
||||
|
||||
#carbonads {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding: 1em;
|
||||
text-align: center;
|
||||
font-family: Verdana, "Helvetica Neue", Helvetica, sans-serif;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #313131;
|
||||
}
|
||||
|
||||
#carbonads a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#carbonads a:hover {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#carbonads span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
max-width: 200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.carbon-img {
|
||||
display: block;
|
||||
margin: 0 auto 8px;
|
||||
}
|
||||
|
||||
.carbon-text {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.carbon-poweredby {
|
||||
display: block;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
}
|
||||
+30
-2
@@ -80,6 +80,13 @@ export const categorizedRoutes = [
|
||||
packageUrl:
|
||||
"https://github.com/satya164/babel-plugin-object-styles-to-template",
|
||||
packageName: "babel-plugin-object-styles-to-template"
|
||||
},
|
||||
{
|
||||
label: "JSX to JS Object",
|
||||
path: "/jsx-to-js-object",
|
||||
desc: "An online REPL to convert JSX to Object representation.",
|
||||
packageUrl: "https://www.npmjs.com/package/jsx-to-json",
|
||||
packageName: "jsx-to-json"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -205,8 +212,8 @@ export const categorizedRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
category: "XML",
|
||||
iconName: "icon-html",
|
||||
category: "Others",
|
||||
iconName: "",
|
||||
content: [
|
||||
{
|
||||
label: "XML to JSON",
|
||||
@@ -214,6 +221,27 @@ export const categorizedRoutes = [
|
||||
desc: "An online REPL to generate basic JSON from a XML.",
|
||||
packageName: "xml-js",
|
||||
packageUrl: "https://github.com/nashwaan/xml-js"
|
||||
},
|
||||
{
|
||||
label: "JSON to YAML",
|
||||
path: "/json-to-yaml",
|
||||
desc: "An online REPL to convert JSON to YAML.",
|
||||
packageName: "json2yaml",
|
||||
packageUrl: "https://github.com/jeffsu/json2yaml"
|
||||
},
|
||||
{
|
||||
label: "YAML to JSON",
|
||||
path: "/yaml-to-json",
|
||||
desc: "An online REPL to convert YAML to JSON.",
|
||||
packageName: "yaml",
|
||||
packageUrl: "https://github.com/tj/js-yaml"
|
||||
},
|
||||
{
|
||||
label: "Markdown to HTML",
|
||||
path: "/markdown-to-html",
|
||||
desc: "An online REPL to convert Markdown to HTML.",
|
||||
packageName: "markdown",
|
||||
packageUrl: "https://github.com/evilstreak/markdown-js"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { jsxToJson } from "jsx-to-json";
|
||||
import stringify from "stringify-object";
|
||||
|
||||
export function transform(code) {
|
||||
try {
|
||||
return { value: stringify(eval(jsxToJson(code))), code: 1 };
|
||||
} catch (e) {
|
||||
return { value: e.message, code: 0 };
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { transform } from "babel-standalone";
|
||||
import convert from "babel-plugin-object-styles-to-template";
|
||||
import immutablePropsPlugin from "../utils/babel-plugin-js-to-immutable-prop-types";
|
||||
import registerPromiseWorker from "promise-worker/register";
|
||||
|
||||
registerPromiseWorker(
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import registerPromiseWorker from "promise-worker/register";
|
||||
|
||||
try {
|
||||
importScripts("https://bundle.run/prettier@1.6.1");
|
||||
} catch (e) {
|
||||
self.postMessage({ available: false });
|
||||
}
|
||||
|
||||
const prettierParsers = {
|
||||
css: "postcss",
|
||||
javascript: "babylon",
|
||||
jsx: "babylon",
|
||||
graphql: "graphql",
|
||||
json: "json",
|
||||
typescript: "typescript",
|
||||
flow: "flow"
|
||||
};
|
||||
|
||||
if (self.prettier) {
|
||||
postMessage({ available: true });
|
||||
}
|
||||
|
||||
function getPrettyCode(data) {
|
||||
const { code, mode, section } = data;
|
||||
|
||||
const prettyCode =
|
||||
self.prettier && prettierParsers[mode] && code
|
||||
? self.prettier.format(code, {
|
||||
parser: prettierParsers[mode],
|
||||
printWidth: 70
|
||||
})
|
||||
: code;
|
||||
|
||||
return { available: !!self.prettier, prettyCode, section };
|
||||
}
|
||||
|
||||
registerPromiseWorker(
|
||||
message =>
|
||||
new Promise(resolve => {
|
||||
resolve(getPrettyCode(message));
|
||||
})
|
||||
);
|
||||
|
||||
onmessage = function({ data }) {
|
||||
postMessage(getPrettyCode(data));
|
||||
};
|
||||
Reference in new issue
Block a user