format code

This commit is contained in:
ritz078
2020-06-06 04:48:09 +05:30
parent d19a261563
commit 6150ff308f
79 changed files with 311 additions and 307 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import React from "react";
export default function () {
export default function() {
return (
<svg
data-name="Layer 1"
+1 -1
View File
@@ -1,6 +1,6 @@
import React from "react";
export default function () {
export default function() {
return (
<svg
data-name="Layer 1"
+2 -2
View File
@@ -1,6 +1,6 @@
import React from "react";
export default function () {
export default function() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -12,7 +12,7 @@ export default function () {
xmlSpace="preserve"
height={20}
style={{
marginRight: 10,
marginRight: 10
}}
>
<style dangerouslySetInnerHTML={{ __html: ".st0{fill:#C12127;}" }} />
+8 -8
View File
@@ -12,7 +12,7 @@ let prettierWorker;
function getEditorLanguage(lang: Language) {
const mapping = {
flow: "typescript",
flow: "typescript"
};
return mapping[lang] || lang;
@@ -42,7 +42,7 @@ export interface ConversionPanelProps {
settings?: any;
}
const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function ({
const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function({
splitEditorProps,
editorProps,
resultEditorProps,
@@ -57,7 +57,7 @@ const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function
settings,
editorDefaultValue,
splitEditorDefaultValue,
resultSettingsElement,
resultSettingsElement
}) {
const [value, setValue] = useData(editorDefaultValue || editorLanguage);
const [splitValue, setSplitValue] = useData(
@@ -79,7 +79,7 @@ const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function
packageName && packageUrl
? {
name: packageName,
url: packageUrl,
url: packageUrl
}
: undefined;
}
@@ -92,12 +92,12 @@ const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function
const result = await transformer({
value,
splitEditorValue: splitTitle ? splitValue : undefined,
splitEditorValue: splitTitle ? splitValue : undefined
});
const prettyResult = await prettierWorker.send({
value: result,
language: resultLanguage,
language: resultLanguage
});
setResult(prettyResult);
setMessage("");
@@ -172,8 +172,8 @@ const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function
<Spinner
css={{
"& circle": {
stroke: "#0e7ccf",
},
stroke: "#0e7ccf"
}
}}
size={32}
/>
+18 -18
View File
@@ -11,7 +11,7 @@ import {
Spinner,
TextInput,
toaster,
Tooltip,
Tooltip
} from "evergreen-ui";
import React, { useCallback, useEffect, useRef, useState } from "react";
import dynamic from "next/dynamic";
@@ -64,10 +64,10 @@ const Monaco = dynamic(() => import("../components/Monaco"), {
>
<Spinner />
</Pane>
),
)
});
export default function ({
export default function({
editable = true,
title,
settingElement,
@@ -82,7 +82,7 @@ export default function ({
defaultValue,
onChange,
id,
packageDetails,
packageDetails
}: EditorPanelProps) {
const [showSettingsDialogue, setSettingsDialog] = useState(false);
const [showPreview, setPreviewVisibility] = useState(true);
@@ -96,10 +96,10 @@ export default function ({
codeLens: false,
fontFamily: "Menlo, Consolas, monospace, sans-serif",
minimap: {
enabled: false,
enabled: false
},
quickSuggestions: false,
lineNumbers: "on",
lineNumbers: "on"
};
const _toggleSettingsDialog = useCallback(
@@ -126,7 +126,7 @@ export default function ({
{settingElement({
toggle: _toggleSettingsDialog,
open: showSettingsDialogue,
open: showSettingsDialogue
})}
</>
),
@@ -146,19 +146,19 @@ export default function ({
}, []);
const { getRootProps } = useDropzone({
onDrop: (files) => onFilePicked(files),
onDrop: files => onFilePicked(files),
disabled: !editable,
accept: acceptFiles,
onDropRejected: () =>
toaster.danger("This file type is not supported.", {
id,
}),
id
})
});
const copyValue = useCallback(() => {
copy(value);
toaster.success("Copied to clipboard.", {
id,
id
});
}, [value]);
@@ -166,7 +166,7 @@ export default function ({
prettierWorker
.send({
language,
value,
value
})
.then(setValue);
}, [language, value]);
@@ -176,7 +176,7 @@ export default function ({
}, [showPreview]);
const fetchFile = useCallback(
(close) => {
close => {
(async () => {
if (!fetchingUrl) return;
const res = await fetch(fetchingUrl);
@@ -229,7 +229,7 @@ export default function ({
<FilePicker
width={"100%"}
name="filepicker"
onChange={(files) => onFilePicked(files, close)}
onChange={files => onFilePicked(files, close)}
accept={acceptFiles}
/>
@@ -293,7 +293,7 @@ export default function ({
<a
href={packageDetails.url}
style={{
display: "inline-flex",
display: "inline-flex"
}}
target="_blank"
>
@@ -327,21 +327,21 @@ export default function ({
display: "flex",
flexDirection: "column",
flex: 1,
overflow: "hidden",
overflow: "hidden"
}}
{...getRootProps()}
>
{topNotifications &&
topNotifications({
isSettingsOpen: showSettingsDialogue,
toggleSettings: _toggleSettingsDialog,
toggleSettings: _toggleSettingsDialog
})}
<Monaco
language={language}
value={value}
options={options}
onChange={(value) => {
onChange={value => {
setValue(value);
onChange(value);
}}
+5 -5
View File
@@ -5,7 +5,7 @@ import { Dialog, Heading, Pane, Switch, TextInput, Select } from "evergreen-ui";
export enum InputType {
SWITCH = 1,
TEXT_INPUT,
SELECT,
SELECT
}
interface FormProps<T> {
@@ -30,7 +30,7 @@ const Form = <T extends object>({
title,
formsFields,
open,
toggle,
toggle
}: FormProps<T> & { children?: React.ReactNode }) => {
return (
<Formik
@@ -41,11 +41,11 @@ const Form = <T extends object>({
title={title}
isShown={open}
onCloseComplete={toggle}
onConfirm={(close) => {
onConfirm={close => {
props.submitForm();
close();
}}
onCancel={(close) => {
onCancel={close => {
props.resetForm();
close();
}}
@@ -120,7 +120,7 @@ const Form = <T extends object>({
</Dialog>
);
}}
onSubmit={(values) => {
onSubmit={values => {
onSubmit(values);
}}
/>
+7 -7
View File
@@ -5,12 +5,12 @@ import { lightEditor } from "@utils/theme";
languages.typescript.typescriptDefaults.setDiagnosticsOptions({
noSemanticValidation: true,
noSyntaxValidation: true,
noSyntaxValidation: true
});
// @ts-ignore
self.MonacoEnvironment = {
getWorkerUrl: function (_moduleId, label) {
getWorkerUrl: function(_moduleId, label) {
if (label === "json") {
return `/static/monaco/json.worker.js`;
}
@@ -24,7 +24,7 @@ self.MonacoEnvironment = {
return `/static/monaco/typescript.worker.js`;
}
return `/static/monaco/editor.worker.js`;
},
}
};
function noop() {}
@@ -57,7 +57,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
language: "javascript",
options: {},
editorDidMount: noop,
theme: "light",
theme: "light"
};
public reLayout = () => {
@@ -115,7 +115,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
this.editor = editor.create(this.containerElement.current, {
value,
language,
...options,
...options
});
editor.defineTheme("light", lightEditor);
@@ -130,7 +130,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
editorDidMount(editor) {
this.props.editorDidMount(editor);
editor.onDidChangeModelContent((event) => {
editor.onDidChangeModelContent(event => {
const value = editor.getValue();
// Only invoking when user input changed
@@ -146,7 +146,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
const fixedHeight = processSize(height);
const style = {
width: fixedWidth,
height: fixedHeight,
height: fixedHeight
};
return (
+6 -6
View File
@@ -6,13 +6,13 @@ import { useRouter } from "next/router";
import SearchBox from "@components/Searchbox";
import loadScript from "load-script";
export default function () {
export default function() {
const router = useRouter();
useEffect(() => {
if (!IS_DEV)
loadScript("https://codefund.io/properties/367/funder.js", {
async: true,
async: true
});
}, []);
@@ -36,7 +36,7 @@ export default function () {
flexDirection="column"
paddingBottom={10}
>
{categorizedRoutes.map((route) => {
{categorizedRoutes.map(route => {
return (
<Fragment key={route.category}>
<Pane paddingX={10} marginTop={15} marginBottom={2}>
@@ -53,7 +53,7 @@ export default function () {
<Link key={a.label} href={a.path} prefetch={false}>
<a
style={{
textDecoration: "none",
textDecoration: "none"
}}
>
<Pane
@@ -67,8 +67,8 @@ export default function () {
}
css={{
"&:hover": {
backgroundColor: "#f5f5f5",
},
backgroundColor: "#f5f5f5"
}
}}
>
<Text fontSize={13}>{a.label}</Text>
+4 -4
View File
@@ -6,18 +6,18 @@ import { useRouter } from "next/router";
const SearchBox: React.FunctionComponent<{}> = () => {
const router = useRouter();
const onSearchSelect = useCallback((changedItem) => {
const route = routes.find((route) => changedItem === route.searchTerm);
const onSearchSelect = useCallback(changedItem => {
const route = routes.find(route => changedItem === route.searchTerm);
router.push(route.path);
}, []);
return (
<Autocomplete
onChange={onSearchSelect}
items={routes.map((a) => a.searchTerm)}
items={routes.map(a => a.searchTerm)}
width="100%"
>
{(props) => {
{props => {
const { getInputProps, getRef, inputValue } = props;
return (
<SearchInput
+5 -5
View File
@@ -23,7 +23,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
formFields,
optimizedValue,
settings,
setSettings,
setSettings
}) => {
const getSettingsPanel = useCallback<EditorPanelProps["settingElement"]>(
({ open, toggle }) => {
@@ -73,14 +73,14 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
}
/>
),
previewElement: (value) => (
previewElement: value => (
<Pane display="flex" flexDirection="row" flex={1}>
<Pane display={"flex"} flex={1} position="relative">
<img
style={{
flex: 1,
width: "100%",
borderRight: "1px solid #eee",
borderRight: "1px solid #eee"
}}
src={svgToDataUrl(value)}
alt="original"
@@ -101,7 +101,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
<img
style={{
flex: 1,
width: "100%",
width: "100%"
}}
src={svgToDataUrl(optimizedValue)}
alt="optimized"
@@ -120,7 +120,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
</Pane>
</Pane>
),
acceptFiles: "image/svg+xml",
acceptFiles: "image/svg+xml"
}}
/>
);
+1 -1
View File
@@ -1,5 +1,5 @@
export enum BabelTransforms {
JSON_TO_PROPTYPES = 1,
OBJECT_STYLES_TO_TEMPLATE,
JSON_TO_MOBX_TREE,
JSON_TO_MOBX_TREE
}
+1 -1
View File
@@ -3,7 +3,7 @@ export const json = JSON.stringify(
userId: 1,
id: 1,
title: "delectus aut autem",
completed: false,
completed: false
},
null,
2
+1 -1
View File
@@ -12,5 +12,5 @@ export enum GraphqlTransforms {
TO_TYPESCRIPT_RESOLVERS_SIGNATURE,
TO_FLOW_RESOLVERS_SIGNATURE,
TO_URQL,
TO_TYPESCRIPT_MONGODB,
TO_TYPESCRIPT_MONGODB
}
+6 -6
View File
@@ -40,7 +40,7 @@ export const nativeRequiredSettings = {
removeXMLProcInst: false,
removeComments: true,
removeMetadata: true,
removeDimensions: false,
removeDimensions: false
};
export const defaultSettings = {
@@ -73,7 +73,7 @@ export const defaultSettings = {
removeRasterImages: true,
mergePaths: true,
convertShapeToPath: true,
sortAttrs: true,
sortAttrs: true
};
export const defaultNativeSettings = omit(
@@ -81,15 +81,15 @@ export const defaultNativeSettings = omit(
Object.keys(nativeRequiredSettings)
);
export const formFields = (settings) =>
export const formFields = settings =>
Object.keys(settings).map((property: keyof Settings) => ({
label: lowerCase(property),
type: InputType.SWITCH,
key: property,
...(property !== "optimizeSvg"
? {
isDisabled: (values) => !values.optimizeSvg,
props: { paddingLeft: 20, borderLeft: "2px solid #FDF8F3" },
isDisabled: values => !values.optimizeSvg,
props: { paddingLeft: 20, borderLeft: "2px solid #FDF8F3" }
}
: {}),
: {})
}));
+1 -1
View File
@@ -22,7 +22,7 @@ export function useLocalStorage(key, initialValue) {
// Return a wrapped version of useState's setter function that ...
// ... persists the new value to sessionStorage.
const setValue = (value) => {
const setValue = value => {
try {
// Allow value to be a function so we have same API as useState
const valueToStore =
+1 -1
View File
@@ -24,7 +24,7 @@ export function useSessionStorage(key, initialValue) {
// Return a wrapped version of useState's setter function that ...
// ... persists the new value to sessionStorage.
const setValue = (value) => {
const setValue = value => {
try {
// Allow value to be a function so we have same API as useState
const valueToStore =
+6 -6
View File
@@ -21,7 +21,7 @@ const logo = (
height="19px"
viewBox="0 0 306 62"
style={{
marginTop: -4,
marginTop: -4
}}
>
<path
@@ -41,10 +41,10 @@ function renderHeadWay() {
const HW_config = {
selector: ".transform-changelog", // CSS selector where to inject the badge
account: "J0B24x",
trigger: ".transform-changelog",
trigger: ".transform-changelog"
};
(function (src) {
(function(src) {
const tag = document.createElement("script");
tag.async = false;
tag.src = src;
@@ -60,7 +60,7 @@ function renderHeadWay() {
export default class extends App {
timer: any;
private stopProgress = (pathname) => {
private stopProgress = pathname => {
reactGa && reactGa.pageview(pathname);
clearTimeout(this.timer);
NProgress.done();
@@ -126,7 +126,7 @@ export default class extends App {
height={40}
className="transform-changelog"
css={{
color: "#fff !important",
color: "#fff !important"
}}
>
Changelog
@@ -136,7 +136,7 @@ export default class extends App {
appearance="minimal"
height={40}
css={{
color: "#fff !important",
color: "#fff !important"
}}
>
GitHub
+1 -1
View File
@@ -15,7 +15,7 @@ export default class MyDocument extends Document<DocumentProps> {
return {
...page,
css,
hydrationScript,
hydrationScript
};
}
+2 -2
View File
@@ -21,12 +21,12 @@ export default (req: NextApiRequest, res: NextApiResponse) => {
emitDeclarationOnly: true,
jsx: ts.JsxEmit.React,
skipDefaultLibCheck: true,
skipLibCheck: true,
skipLibCheck: true
};
const host = ts.createCompilerHost(options);
host.getSourceFile = (filename) => {
host.getSourceFile = filename => {
if (filename === "file.ts") {
return ts.createSourceFile(filename, tsCode, undefined);
}
+1 -1
View File
@@ -10,7 +10,7 @@ export default (req: NextApiRequest, res: NextApiResponse) => {
path: filePath,
expose: "all",
jsDoc: "extended",
type: "*",
type: "*"
};
const schema = tsj.createGenerator(config).createSchema(config.type);
+3 -3
View File
@@ -5,13 +5,13 @@ import PostCssWorker from "@workers/postcss.worker";
import { useSettings } from "@hooks/useSettings";
let postCssWorker;
export default function () {
export default function() {
const name = "CSS to JS";
// TODO
const [settings, setSettings] = useSettings(name, {
reactNativeCompatible: false,
cleanPropertyNames: false,
cleanPropertyNames: false
});
const transformer = useCallback<Transformer>(async ({ value }) => {
@@ -29,7 +29,7 @@ export default function () {
editorLanguage="css"
resultLanguage="javascript"
editorProps={{
acceptFiles: "text/css",
acceptFiles: "text/css"
}}
/>
);
+3 -3
View File
@@ -4,12 +4,12 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function () {
export default function() {
const transformer = useCallback(
({ value }) =>
request("/api/flow-to-typescript", {
value,
declarationOnly: true,
declarationOnly: true
}),
[]
);
@@ -28,7 +28,7 @@ export default function () {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
),
)
}}
/>
);
+3 -3
View File
@@ -4,12 +4,12 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function () {
export default function() {
const transformer = useCallback(
({ value }) =>
request("/api/flow-to-typescript", {
value,
declarationOnly: false,
declarationOnly: false
}),
[]
);
@@ -28,7 +28,7 @@ export default function () {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
),
)
}}
/>
);
+4 -4
View File
@@ -9,10 +9,10 @@ import { Select } from "evergreen-ui";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
export default function () {
export default function() {
const [output, setOutput] = useState(
GraphqlTransforms.TO_REACT_APOLLO.toString(10)
);
@@ -24,7 +24,7 @@ export default function () {
return graphqlWorker.send({
type: parseInt(output, 10),
value,
document: splitEditorValue,
document: splitEditorValue
});
},
[output]
@@ -35,7 +35,7 @@ export default function () {
settings={output}
transformer={transformer}
resultTitle={
<Select value={output} onChange={(e) => setOutput(e.target.value)}>
<Select value={output} onChange={e => setOutput(e.target.value)}>
<option value={GraphqlTransforms.TO_REACT_APOLLO}>
TypeScript React Apollo
</option>
+3 -3
View File
@@ -8,10 +8,10 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
export default function () {
export default function() {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
@@ -19,7 +19,7 @@ export default function () {
return graphqlWorker.send({
type: GraphqlTransforms.TO_FLOW,
value,
document: splitEditorValue,
document: splitEditorValue
});
},
[]
+3 -3
View File
@@ -8,16 +8,16 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_FRAGMENT_MATCHER,
value,
value
});
}, []);
+3 -3
View File
@@ -8,17 +8,17 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker, prettierWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_INTROSPECTION_JSON,
value,
extension: "json",
extension: "json"
});
}, []);
+3 -3
View File
@@ -8,16 +8,16 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_JAVA,
value,
value
});
}, []);
+5 -5
View File
@@ -9,16 +9,16 @@ import { Select } from "evergreen-ui";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
const langMap = {
[GraphqlTransforms.TO_FLOW_RESOLVERS_SIGNATURE]: "flow",
[GraphqlTransforms.TO_TYPESCRIPT_RESOLVERS_SIGNATURE]: "typescript",
[GraphqlTransforms.TO_JAVA_RESOLVERS_SIGNATURE]: "java",
[GraphqlTransforms.TO_JAVA_RESOLVERS_SIGNATURE]: "java"
};
export default function () {
export default function() {
const [output, setOutput] = useState(
GraphqlTransforms.TO_TYPESCRIPT_RESOLVERS_SIGNATURE.toString(10)
);
@@ -34,7 +34,7 @@ export default function () {
output ===
GraphqlTransforms.TO_TYPESCRIPT_RESOLVERS_SIGNATURE.toString(10)
? splitEditorValue
: undefined,
: undefined
});
},
[output]
@@ -45,7 +45,7 @@ export default function () {
settings={output}
transformer={transformer}
resultTitle={
<Select value={output} onChange={(e) => setOutput(e.target.value)}>
<Select value={output} onChange={e => setOutput(e.target.value)}>
<option value={GraphqlTransforms.TO_TYPESCRIPT_RESOLVERS_SIGNATURE}>
TypeScript Resolvers Signature
</option>
+3 -3
View File
@@ -8,17 +8,17 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_SCHEMA_AST,
value,
extension: "graphql",
extension: "graphql"
});
}, []);
+3 -3
View File
@@ -8,17 +8,17 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_TYPESCRIPT_MONGODB,
value,
extension: "ts",
extension: "ts"
});
}, []);
+3 -3
View File
@@ -8,10 +8,10 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql",
acceptFiles: ".graphql, .gql"
};
export default function () {
export default function() {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
@@ -19,7 +19,7 @@ export default function () {
return graphqlWorker.send({
type: GraphqlTransforms.TO_TYPESCRIPT,
value,
document: splitEditorValue,
document: splitEditorValue
});
},
[]
+8 -6
View File
@@ -18,21 +18,21 @@ const formFields = [
{
type: InputType.SWITCH,
key: "createClass",
label: "Create Class",
label: "Create Class"
},
{
type: InputType.TEXT_INPUT,
key: "outputClassName",
label: "Output Class Name",
},
label: "Output Class Name"
}
];
export default function () {
export default function() {
const name = "HTML to JSX";
const [settings, setSettings] = useSettings(name, {
createClass: false,
outputClassName: "TransformedComponent",
outputClassName: "TransformedComponent"
});
const [_isSvg, setSvg] = useState(false);
@@ -92,7 +92,9 @@ export default function () {
</>
}
/>
) : undefined,
) : (
undefined
)
}}
/>
);
+8 -8
View File
@@ -9,33 +9,33 @@ const formFields = [
{
key: "tabs",
type: InputType.SWITCH,
label: "Use Tabs",
label: "Use Tabs"
},
{
key: "commas",
type: InputType.SWITCH,
label: "Commas",
label: "Commas"
},
{
key: "doubleQuotes",
type: InputType.SWITCH,
label: "Use double quotes",
label: "Use double quotes"
},
{
key: "fragment",
type: InputType.SWITCH,
label: "Use Fragment",
},
label: "Use Fragment"
}
];
const defaultSettings = {
tabs: true,
commas: true,
doubleQuotes: false,
fragment: false,
fragment: false
};
export default function () {
export default function() {
const name = "HTML to Pug";
const [settings, setSettings] = useSettings(name, defaultSettings);
@@ -57,7 +57,7 @@ export default function () {
({ value }) =>
request("/api/html-to-pug", {
value,
settings,
settings
}),
[settings]
);
+3 -3
View File
@@ -10,7 +10,7 @@ import SvgrWorker from "@workers/svgr.worker";
import SvgoWorker from "@workers/svgo.worker";
let prettier, svgo, svgr;
export default function () {
export default function() {
const name = "SVG to JSX";
const [settings, setSettings] = useState(defaultSettings);
const [optimizedValue, setOptimizedValue] = useState("");
@@ -27,14 +27,14 @@ export default function () {
if (settings.optimizeSvg) {
_value = await svgo.send({
value,
settings,
settings
});
}
setOptimizedValue(_value);
_value = await svgr.send({
value: _value,
value: _value
});
return _value;
+1 -1
View File
@@ -2,7 +2,7 @@ import ConversionPanel from "@components/ConversionPanel";
import { useCallback } from "react";
import * as React from "react";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(eval("(" + value + ")"), null, 2);
}, []);
+2 -2
View File
@@ -3,12 +3,12 @@ import * as React from "react";
import { useCallback } from "react";
import toOpenApi from "@openapi-contrib/json-schema-to-openapi-schema";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(
async ({ value }) =>
JSON.stringify(
toOpenApi(JSON.parse(value), {
cloneSchema: true,
cloneSchema: true
}),
null,
2
+2 -2
View File
@@ -3,10 +3,10 @@ import * as React from "react";
import { useCallback } from "react";
import { compile } from "json-schema-to-typescript";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
return compile(JSON.parse(value), "MySchema", {
bannerComment: "",
bannerComment: ""
});
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import gs from "generate-schema";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(gs.bigquery(JSON.parse(value)), null, 2);
}, []);
+6 -6
View File
@@ -11,27 +11,27 @@ const formFields = [
{
type: InputType.TEXT_INPUT,
key: "namespace",
label: "Namespace",
label: "Namespace"
},
{
type: InputType.TEXT_INPUT,
key: "prefix",
label: "prefix",
label: "prefix"
},
{
type: InputType.TEXT_INPUT,
key: "rootName",
label: "Root Name",
},
label: "Root Name"
}
];
const defaultSettings = {
namespace: "",
prefix: "I",
rootName: "RootObject",
rootName: "RootObject"
};
export default function () {
export default function() {
const name = "json-to-flow";
const [settings, setSettings] = useSettings(name, defaultSettings);
+1 -1
View File
@@ -2,7 +2,7 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
return JSON.stringify(JSON.parse(value || "{}"), null, 2)
.replace(/\{/gm, "bson.M{")
+1 -1
View File
@@ -4,7 +4,7 @@ import * as React from "react";
import jsonToGo from "json-to-go";
import gofmt from "gofmt.js";
export default function () {
export default function() {
const transformer = useCallback(({ value }) => {
return gofmt(jsonToGo(value).go);
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { jsonToSchema } from "@walmartlabs/json-to-simple-graphql-schema/lib";
export default function () {
export default function() {
const transformer = useCallback(({ value }) => {
return jsonToSchema({ jsonInput: value }).value;
}, []);
+2 -2
View File
@@ -3,10 +3,10 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
const code = transform(value, {
lang: "io-ts",
lang: "io-ts"
});
return `import * as t from "io-ts";\n\n${code}`;
+1 -1
View File
@@ -3,7 +3,7 @@ import * as React from "react";
import { useCallback } from "react";
import { convert } from "@assets/vendor/json-to-jsdoc";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
return convert(value);
}, []);
+2 -2
View File
@@ -2,14 +2,14 @@ import ConversionPanel from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
const { run } = await import("json_typegen_wasm");
return run(
"Root",
value,
JSON.stringify({
output_mode: "json_schema",
output_mode: "json_schema"
})
);
}, []);
+2 -2
View File
@@ -2,14 +2,14 @@ import ConversionPanel from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
const { run } = await import("json_typegen_wasm");
return run(
"Root",
value,
JSON.stringify({
output_mode: "kotlin",
output_mode: "kotlin"
})
);
}, []);
+2 -2
View File
@@ -6,13 +6,13 @@ import { getWorker } from "@utils/workerWrapper";
import { BabelTransforms } from "@constants/babelTransforms";
let babelWorker;
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
babelWorker = babelWorker || getWorker(BabelWorker);
return babelWorker.send({
type: BabelTransforms.JSON_TO_MOBX_TREE,
value,
value
});
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import gs from "generate-schema";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(gs.mongoose(JSON.parse(value)), null, 2);
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import gs from "generate-schema";
export default function () {
export default function() {
const transformer = useCallback(({ value }) => {
return gs.mysql(JSON.parse(value));
}, []);
+2 -2
View File
@@ -4,12 +4,12 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import { getWorker } from "@utils/workerWrapper";
import { BabelTransforms } from "@constants/babelTransforms";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
const Worker = require("@workers/babel.worker");
return getWorker(Worker).send({
value,
type: BabelTransforms.JSON_TO_PROPTYPES,
type: BabelTransforms.JSON_TO_PROPTYPES
});
}, []);
+8 -8
View File
@@ -18,19 +18,19 @@ const formFields = [
"SCREAMING_SNAKE_CASE",
"kebab-case",
"SCREAMING-KEBAB-CASE",
"UPPERCASE",
].map((value) => ({
"UPPERCASE"
].map(value => ({
label: value,
value,
})),
},
value
}))
}
];
const defaultSettings = {
property_name_format: "camelCase",
property_name_format: "camelCase"
};
export default function () {
export default function() {
const name = "json-to-rust-serde";
const [settings, setSettings] = useSettings(name, defaultSettings);
@@ -43,7 +43,7 @@ export default function () {
value,
JSON.stringify({
output_mode: "rust",
property_name_format: settings.property_name_format,
property_name_format: settings.property_name_format
})
);
},
+2 -2
View File
@@ -3,10 +3,10 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
const code = transform(value, {
lang: "sarcastic",
lang: "sarcastic"
});
return `import is from "sarcastic";\n\n${code}`;
+2 -2
View File
@@ -3,10 +3,10 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(async ({ value }) => {
return transform(value, {
lang: "scala",
lang: "scala"
});
}, []);
+2 -2
View File
@@ -2,14 +2,14 @@ import ConversionPanel from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
const { run } = await import("json_typegen_wasm");
return run(
"Root",
value,
JSON.stringify({
output_mode: "typescript",
output_mode: "typescript"
})
);
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { compact } from "jsonld";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
const jsonLd = await compact(
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { expand } from "jsonld";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
const jsonLd = await expand(JSON.parse(value));
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { flatten } from "jsonld";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
const jsonLd = await flatten(
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { frame } from "jsonld";
export default function () {
export default function() {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
const jsonLd = await frame(
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { normalize } from "jsonld";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
return normalize(JSON.parse(value));
}, []);
+2 -2
View File
@@ -3,10 +3,10 @@ import { useCallback } from "react";
import * as React from "react";
import { toRDF } from "jsonld";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
return (toRDF(JSON.parse(value), {
format: "application/n-quads",
format: "application/n-quads"
}) as unknown) as Promise<string>;
}, []);
+3 -3
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { markdown } from "markdown";
export default function () {
export default function() {
const transformer = useCallback(({ value }) => {
return markdown.toHTML(value);
}, []);
@@ -16,9 +16,9 @@ export default function () {
resultTitle="HTML"
resultLanguage={"html"}
resultEditorProps={{
previewElement: (value) => (
previewElement: value => (
<div dangerouslySetInnerHTML={{ __html: value }} />
),
)
}}
/>
);
+7 -7
View File
@@ -17,21 +17,21 @@ const formFields = [
{
label: "Transpile css tags",
key: "css",
type: InputType.SWITCH,
type: InputType.SWITCH
},
{
label: "Transpile styled tags",
key: "styled",
type: InputType.SWITCH,
},
type: InputType.SWITCH
}
];
let babelWorker;
export default function () {
export default function() {
const name = "object-styles-to-template-literal";
const [settings, setSettings] = useSettings(name, {
css: true,
styled: true,
styled: true
});
const transformer = useCallback<Transformer>(
@@ -41,7 +41,7 @@ export default function () {
return babelWorker.send({
value,
type: BabelTransforms.OBJECT_STYLES_TO_TEMPLATE,
settings,
settings
});
},
[settings]
@@ -79,7 +79,7 @@ export default function () {
settings.styled ? "" : ",styled"
} tags transpilation. Change it in settings.`}
/>
),
)
}}
settings={settings}
/>
+12 -10
View File
@@ -7,7 +7,7 @@ import { Pane, Heading, Link } from "evergreen-ui";
import {
defaultNativeSettings,
formFields,
nativeRequiredSettings,
nativeRequiredSettings
} from "@constants/svgoConfig";
import isSvg from "is-svg";
import { getWorker } from "@utils/workerWrapper";
@@ -21,7 +21,7 @@ if (IN_BROWSER) {
}
let svgo, _babelWorker, svgr;
export default function () {
export default function() {
const name = "SVG to React Native";
const [value, setValue] = useState("");
const [url, setUrl] = useState("");
@@ -30,11 +30,13 @@ export default function () {
const snackSession = useRef<any>();
useEffect(() => {
(async function () {
(async function() {
snackSession.current = new SnackSession({
files: { "App.js": { contents: "", type: "CODE" } },
sessionId: Math.random().toString(36).substr(2, 8),
sdkVersion: "37.0.0",
sessionId: Math.random()
.toString(36)
.substr(2, 8),
sdkVersion: "37.0.0"
});
snackSession.current.startAsync();
@@ -48,9 +50,9 @@ export default function () {
}, []);
useEffect(() => {
(async function () {
(async function() {
await snackSession.current.sendCodeAsync({
"App.js": { contents: value, type: "CODE" },
"App.js": { contents: value, type: "CODE" }
});
})();
}, [value]);
@@ -66,8 +68,8 @@ export default function () {
value,
settings: {
...(settings.optimizeSvg ? settings : {}),
...nativeRequiredSettings,
},
...nativeRequiredSettings
}
});
// set optimized value in state to be used by preview.
@@ -77,7 +79,7 @@ export default function () {
_value = await svgr.send({
native: true,
value: _value,
value: _value
});
setValue(_value);
+2 -2
View File
@@ -4,7 +4,7 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function () {
export default function() {
const transformer = useCallback(
({ value }) => request("/api/typescript-to-flow", value),
[]
@@ -23,7 +23,7 @@ export default function () {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
),
)
}}
/>
);
+2 -2
View File
@@ -4,7 +4,7 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function () {
export default function() {
const transformer = useCallback(
({ value }) => request("/api/typescript-to-json-schema", value),
[]
@@ -24,7 +24,7 @@ export default function () {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
),
)
}}
/>
);
@@ -4,13 +4,13 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function () {
export default function() {
const transformer = useCallback(
({ value }) =>
request("/api/flow-to-typescript", {
value,
declarationOnly: true,
isTS: true,
isTS: true
}),
[]
);
@@ -28,7 +28,7 @@ export default function () {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
),
)
}}
/>
);
+2 -2
View File
@@ -3,12 +3,12 @@ import { useCallback } from "react";
import * as React from "react";
import { xml2json } from "xml-js";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(
JSON.parse(
xml2json(value, {
compact: true,
compact: true
})
)
);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import yaml from "yaml";
export default function () {
export default function() {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(yaml.parse(value));
}, []);
+2 -2
View File
@@ -4,7 +4,7 @@ export const prettierParsers = {
jsx: "babel",
svg: "html",
xml: "html",
typescript: "typescript",
typescript: "typescript"
};
export const supportedLanguages = [
@@ -17,5 +17,5 @@ export const supportedLanguages = [
"yaml",
"typescript",
"flow",
...Object.keys(prettierParsers),
...Object.keys(prettierParsers)
];
+2 -2
View File
@@ -9,7 +9,7 @@ const plugins = [
require("prettier/parser-markdown"),
require("prettier/parser-yaml"),
require("prettier/parser-flow"),
require("prettier/parser-typescript"),
require("prettier/parser-typescript")
];
export async function prettify(language: string, value: string) {
@@ -22,7 +22,7 @@ export async function prettify(language: string, value: string) {
} else {
result = prettier.format(value, {
parser: prettierParsers[language] || language,
plugins,
plugins
});
}
+1 -1
View File
@@ -1,7 +1,7 @@
export default async function request(url: string, data: any) {
const res = await fetch(url, {
method: "POST",
body: typeof data === "object" ? JSON.stringify(data) : data,
body: typeof data === "object" ? JSON.stringify(data) : data
});
return await res.text();
+65 -65
View File
@@ -3,7 +3,7 @@ import { editor } from "monaco-editor";
export const ThemeContext = React.createContext({
theme: "light",
toggleTheme: () => {},
toggleTheme: () => {}
});
export const lightEditor: editor.IStandaloneThemeData = {
@@ -13,154 +13,154 @@ export const lightEditor: editor.IStandaloneThemeData = {
{
foreground: "940494",
background: "444494",
token: "punctuation.definition.list",
token: "punctuation.definition.list"
},
{
foreground: "404f50",
background: "5f0fff",
fontStyle: "italic",
token: "comment",
token: "comment"
},
{
foreground: "5a5f9b",
background: "aaafdb",
token: "string",
token: "string"
},
{
foreground: "4f827b",
background: "77c2bb",
token: "constant.numeric",
token: "constant.numeric"
},
{
foreground: "025f69",
background: "7f2299",
token: "constant.character",
token: "constant.character"
},
{
foreground: "025f69",
background: "7f2299",
token: "constant.other",
token: "constant.other"
},
{
foreground: "7d7e52",
background: "bdbe82",
token: "constant.language",
token: "constant.language"
},
{
foreground: "7b5d8f",
background: "9b9ffd",
fontStyle: "bold",
token: "storage.modifier",
token: "storage.modifier"
},
{
foreground: "7b5cbf",
background: "8b5ddf",
fontStyle: "bold",
token: "storage",
token: "storage"
},
{
foreground: "025f49",
background: "22ff49",
token: "entity.name.function",
token: "entity.name.function"
},
{
foreground: "9d7e62",
background: "bdbe82",
token: "support.function",
token: "support.function"
},
{
foreground: "939469",
background: "e3e4a9",
token: "entity.name.function.misc",
token: "entity.name.function.misc"
},
{
foreground: "856f63",
background: "a5df93",
token: "entity.name.function.predicate",
token: "entity.name.function.predicate"
},
{
foreground: "af938c",
background: "dfb3ac",
token: "entity.name.function.io",
token: "entity.name.function.io"
},
{
foreground: "7bafad",
background: "bbdfdd",
token: "variable.other.external-symbol",
token: "variable.other.external-symbol"
},
{
foreground: "316fcf",
background: "3aafff",
token: "variable.language",
token: "variable.language"
},
{
foreground: "316fcf",
background: "3aafff",
token: "variable.other",
token: "variable.other"
},
{
foreground: "33969f",
background: "05d6f9",
fontStyle: "italic",
token: "variable.parameter",
token: "variable.parameter"
},
{
foreground: "674aa8",
background: "a3aad8",
token: "keyword",
token: "keyword"
},
{
foreground: "b9986f",
background: "b998df",
fontStyle: "bold",
token: "entity.name.class",
token: "entity.name.class"
},
{
foreground: "22af9d",
background: "b998df",
token: "entity.name.structure",
token: "entity.name.structure"
},
{
foreground: "af47a9",
background: "af77a9",
token: "entity.name.type",
token: "entity.name.type"
},
{
foreground: "cc4357",
background: "ffddff",
token: "entity.name.class",
token: "entity.name.class"
},
{
foreground: "cc4357",
background: "ffddff",
token: "entity.name.type.class",
token: "entity.name.type.class"
},
{
foreground: "ef6aa7",
background: "ef6aa7",
token: "support.class",
token: "support.class"
},
{
foreground: "dfdfd5",
background: "cc1b27",
token: "invalid",
token: "invalid"
},
{
foreground: "13499f",
background: "0099ff",
fontStyle: "italic",
token: "string source",
token: "string source"
},
{
foreground: "3976a2",
background: "49a6d2",
token: "entity.name.tag",
token: "entity.name.tag"
},
{
foreground: "4946c2",
background: "4986c2",
token: "entity.other.attribute-name",
},
token: "entity.other.attribute-name"
}
],
colors: {
"editor.foreground": "#0f0009",
@@ -169,8 +169,8 @@ export const lightEditor: editor.IStandaloneThemeData = {
"editor.lineHighlightBackground": "#ffffff",
"editorCursor.foreground": "#100011",
"editorWhitespace.foreground": "#000000",
"editor.selectionHighlightBorder": "#B3B3B3",
},
"editor.selectionHighlightBorder": "#B3B3B3"
}
};
export const darkEditor: editor.IStandaloneThemeData = {
@@ -179,128 +179,128 @@ export const darkEditor: editor.IStandaloneThemeData = {
rules: [
{
foreground: "75715e",
token: "comment",
token: "comment"
},
{
foreground: "e6db74",
token: "string",
token: "string"
},
{
foreground: "ae81ff",
token: "constant.numeric",
token: "constant.numeric"
},
{
foreground: "ae81ff",
token: "constant.language",
token: "constant.language"
},
{
foreground: "ae81ff",
token: "constant.character",
token: "constant.character"
},
{
foreground: "ae81ff",
token: "constant.other",
token: "constant.other"
},
{
foreground: "f92672",
token: "keyword",
token: "keyword"
},
{
foreground: "f92672",
token: "storage",
token: "storage"
},
{
foreground: "66d9ef",
fontStyle: "italic",
token: "storage.type",
token: "storage.type"
},
{
foreground: "a6e22e",
fontStyle: "underline",
token: "entity.name.class",
token: "entity.name.class"
},
{
foreground: "a6e22e",
fontStyle: "italic underline",
token: "entity.other.inherited-class",
token: "entity.other.inherited-class"
},
{
foreground: "a6e22e",
token: "entity.name.function",
token: "entity.name.function"
},
{
foreground: "fd971f",
fontStyle: "italic",
token: "variable.parameter",
token: "variable.parameter"
},
{
foreground: "f92672",
token: "entity.name.tag",
token: "entity.name.tag"
},
{
foreground: "a6e22e",
token: "entity.other.attribute-name",
token: "entity.other.attribute-name"
},
{
foreground: "66d9ef",
token: "support.function",
token: "support.function"
},
{
foreground: "66d9ef",
token: "support.constant",
token: "support.constant"
},
{
foreground: "66d9ef",
fontStyle: "italic",
token: "support.type",
token: "support.type"
},
{
foreground: "66d9ef",
fontStyle: "italic",
token: "support.class",
token: "support.class"
},
{
foreground: "f8f8f0",
background: "f92672",
token: "invalid",
token: "invalid"
},
{
foreground: "f8f8f0",
background: "ae81ff",
token: "invalid.deprecated",
token: "invalid.deprecated"
},
{
foreground: "cfcfc2",
token: "meta.structure.dictionary.json string.quoted.double.json",
token: "meta.structure.dictionary.json string.quoted.double.json"
},
{
foreground: "75715e",
token: "meta.diff",
token: "meta.diff"
},
{
foreground: "75715e",
token: "meta.diff.header",
token: "meta.diff.header"
},
{
foreground: "f92672",
token: "markup.deleted",
token: "markup.deleted"
},
{
foreground: "a6e22e",
token: "markup.inserted",
token: "markup.inserted"
},
{
foreground: "e6db74",
token: "markup.changed",
token: "markup.changed"
},
{
foreground: "ae81ff",
token: "constant.numeric.line-number.find-in-files - match",
token: "constant.numeric.line-number.find-in-files - match"
},
{
foreground: "e6db74",
token: "entity.name.filename.find-in-files",
},
token: "entity.name.filename.find-in-files"
}
],
colors: {
"editor.foreground": "#F8F8F2",
@@ -310,6 +310,6 @@ export const darkEditor: editor.IStandaloneThemeData = {
"editorCursor.foreground": "#F8F8F0",
"editorWhitespace.foreground": "#3B3A32",
"editorIndentGuide.activeBackground": "#9D550F",
"editor.selectionHighlightBorder": "#222218",
},
"editor.selectionHighlightBorder": "#222218"
}
};
+2 -2
View File
@@ -9,9 +9,9 @@ function sendMsg(payload, worker: Worker) {
const msgId = globalMsgId++;
const msg = {
id: msgId,
payload,
payload
};
return new Promise(function (resolve, reject) {
return new Promise(function(resolve, reject) {
// save callbacks for later
resolves[msgId] = resolve;
rejects[msgId] = reject;
+7 -7
View File
@@ -25,14 +25,14 @@ async function handleJsonToProptypes(value, id) {
}
const result = transform(`const propTypes = ${JSON.stringify(code)}`, {
plugins: [jsonToProptypes],
plugins: [jsonToProptypes]
}).code;
const prettyCode = await prettify("javascript", result);
_self.postMessage({
id,
payload: prettyCode,
payload: prettyCode
});
}
@@ -40,8 +40,8 @@ function objectStylesToTemplate(value, id, settings) {
_self.postMessage({
id,
payload: transform(value, {
plugins: [[objStylesToTemplate, settings]],
}).code,
plugins: [[objStylesToTemplate, settings]]
}).code
});
}
@@ -49,8 +49,8 @@ function jsonToMobx(value, id) {
_self.postMessage({
id,
payload: transform(`const myModel = ${value}`, {
plugins: [jsonToMobxTree],
}).code,
plugins: [jsonToMobxTree]
}).code
});
}
@@ -71,7 +71,7 @@ _self.onmessage = ({ data: { id, payload } }: { data: Data }) => {
}
_self.postMessage({
id,
err: e.message,
err: e.message
});
}
};
+2 -2
View File
@@ -9,12 +9,12 @@ _self.onmessage = ({ data: { payload, id } }) => {
_self.postMessage({
id,
payload: JSON.stringify(postcssJs.objectify(root)),
payload: JSON.stringify(postcssJs.objectify(root))
});
} catch (e) {
_self.postMessage({
id,
err: e.message,
err: e.message
});
}
};
+5 -5
View File
@@ -16,21 +16,21 @@ const _self = self as any;
_self.onmessage = ({
data: {
payload: { value, language },
id,
},
id
}
}: Data) => {
(async function () {
(async function() {
try {
const payload = await prettify(language, value);
_self.postMessage({
id,
payload,
payload
});
} catch (e) {
_self.postMessage({
id,
err: e.message,
err: e.message
});
}
})();
+5 -5
View File
@@ -16,20 +16,20 @@ _self.onmessage = ({ data: { id, payload } }: { data: Data }) => {
delete payload.settings.optimizeSvg;
const plugins = Object.keys(payload.settings).filter(
(key) => payload.settings[key]
key => payload.settings[key]
);
try {
const svgo = new SVGO({
full: true,
// @ts-ignore
plugins,
plugins
});
svgo.optimize(payload.value).then((result) => {
svgo.optimize(payload.value).then(result => {
_self.postMessage({
id,
payload: result.data,
payload: result.data
});
});
} catch (e) {
@@ -38,7 +38,7 @@ _self.onmessage = ({ data: { id, payload } }: { data: Data }) => {
}
_self.postMessage({
id,
err: e.message,
err: e.message
});
}
};
+3 -3
View File
@@ -9,17 +9,17 @@ _self.onmessage = async ({ data: { payload, id } }) => {
const result = await convert(value, {
plugins: [require("@svgr/plugin-jsx").default],
svgo: false,
native,
native
});
_self.postMessage({
payload: result,
id,
id
});
} catch (e) {
_self.postMessage({
id,
error: e.message,
error: e.message
});
}
};