diff --git a/components/canvas/bounds/bounding-box.tsx b/components/canvas/bounds/bounding-box.tsx index f222f59e5..c0f5f3bc0 100644 --- a/components/canvas/bounds/bounding-box.tsx +++ b/components/canvas/bounds/bounding-box.tsx @@ -28,7 +28,7 @@ export default function Bounds() { if (!bounds) return null if (!isSelecting) return null - const size = (isMobile().any ? 12 : 8) / zoom // Touch target size + const size = (isMobile().any ? 10 : 8) / zoom // Touch target size return ( + + + + ) } -const StyledCorner = styled("rect", { - stroke: "$bounds", - fill: "#fff", - zStrokeWidth: 2, +const StyledCorner = styled('rect', { + stroke: 'none', + fill: 'transparent', variants: { corner: { - [Corner.TopLeft]: { cursor: "nwse-resize" }, - [Corner.TopRight]: { cursor: "nesw-resize" }, - [Corner.BottomRight]: { cursor: "nwse-resize" }, - [Corner.BottomLeft]: { cursor: "nesw-resize" }, + [Corner.TopLeft]: { cursor: 'nwse-resize' }, + [Corner.TopRight]: { cursor: 'nesw-resize' }, + [Corner.BottomRight]: { cursor: 'nwse-resize' }, + [Corner.BottomLeft]: { cursor: 'nesw-resize' }, }, }, }) + +const StyledCornerInner = styled('rect', { + stroke: '$bounds', + fill: '#fff', + zStrokeWidth: 2, +}) diff --git a/components/canvas/bounds/edge-handle.tsx b/components/canvas/bounds/edge-handle.tsx index 1ddcc293a..9ee054ce2 100644 --- a/components/canvas/bounds/edge-handle.tsx +++ b/components/canvas/bounds/edge-handle.tsx @@ -1,6 +1,6 @@ -import useHandleEvents from "hooks/useBoundsHandleEvents" -import styled from "styles" -import { Edge, Bounds } from "types" +import useHandleEvents from 'hooks/useBoundsHandleEvents' +import styled from 'styles' +import { Edge, Bounds } from 'types' export default function EdgeHandle({ size, @@ -28,15 +28,15 @@ export default function EdgeHandle({ ) } -const StyledEdge = styled("rect", { - stroke: "none", - fill: "none", +const StyledEdge = styled('rect', { + stroke: 'none', + fill: 'none', variants: { edge: { - [Edge.Top]: { cursor: "ns-resize" }, - [Edge.Right]: { cursor: "ew-resize" }, - [Edge.Bottom]: { cursor: "ns-resize" }, - [Edge.Left]: { cursor: "ew-resize" }, + [Edge.Top]: { cursor: 'ns-resize' }, + [Edge.Right]: { cursor: 'ew-resize' }, + [Edge.Bottom]: { cursor: 'ns-resize' }, + [Edge.Left]: { cursor: 'ew-resize' }, }, }, }) diff --git a/components/code-panel/code-editor.tsx b/components/code-panel/code-editor.tsx index 48621d085..af7916bab 100644 --- a/components/code-panel/code-editor.tsx +++ b/components/code-panel/code-editor.tsx @@ -1,11 +1,11 @@ -import Editor, { Monaco } from "@monaco-editor/react" -import useTheme from "hooks/useTheme" -import prettier from "prettier/standalone" -import parserTypeScript from "prettier/parser-typescript" -import codeAsString from "./code-as-string" -import React, { useCallback, useEffect, useRef } from "react" -import styled from "styles" -import { IMonaco, IMonacoEditor } from "types" +import Editor, { Monaco } from '@monaco-editor/react' +import useTheme from 'hooks/useTheme' +import prettier from 'prettier/standalone' +import parserTypeScript from 'prettier/parser-typescript' +import codeAsString from './code-as-string' +import React, { useCallback, useEffect, useRef } from 'react' +import styled from 'styles' +import { IMonaco, IMonacoEditor } from 'types' interface Props { value: string @@ -48,7 +48,7 @@ export default function CodeEditor({ checkJs: false, strict: false, noLib: true, - lib: ["es6"], + lib: ['es6'], target: monaco.languages.typescript.ScriptTarget.ES2015, allowNonTsExtensions: true, }) @@ -69,13 +69,13 @@ export default function CodeEditor({ monaco.languages.typescript.javascriptDefaults.addExtraLib(codeAsString) - monaco.languages.registerDocumentFormattingEditProvider("javascript", { + monaco.languages.registerDocumentFormattingEditProvider('javascript', { async provideDocumentFormattingEdits(model) { const text = prettier.format(model.getValue(), { - parser: "typescript", + parser: 'typescript', plugins: [parserTypeScript], singleQuote: true, - trailingComma: "es5", + trailingComma: 'es5', semi: false, }) @@ -114,12 +114,12 @@ export default function CodeEditor({ (e: React.KeyboardEvent) => { onKey && onKey() e.stopPropagation() - const metaKey = navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey - if (e.key === "s" && metaKey) { + const metaKey = navigator.platform.match('Mac') ? e.metaKey : e.ctrlKey + if (e.key === 's' && metaKey) { const editor = rEditor.current if (!editor) return editor - .getAction("editor.action.formatDocument") + .getAction('editor.action.formatDocument') .run() .then(() => onSave(rEditor.current?.getModel().getValue(), rEditor.current) @@ -127,10 +127,10 @@ export default function CodeEditor({ e.preventDefault() } - if (e.key === "p" && metaKey) { + if (e.key === 'p' && metaKey) { e.preventDefault() } - if (e.key === "d" && metaKey) { + if (e.key === 'd' && metaKey) { e.preventDefault() } }, @@ -167,7 +167,7 @@ export default function CodeEditor({ ), options: { isWholeLine: true, - className: "editorLineError", + className: 'editorLineError', }, }, ]) @@ -176,7 +176,7 @@ export default function CodeEditor({ useEffect(() => { const monaco = rMonaco.current if (!monaco) return - monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "light") + monaco.editor.setTheme(theme === 'dark' ? 'vs-dark' : 'light') }, [theme]) useEffect(() => { @@ -194,7 +194,7 @@ export default function CodeEditor({ height="100%" language="javascript" value={value} - theme={theme === "dark" ? "vs-dark" : "light"} + theme={theme === 'dark' ? 'vs-dark' : 'light'} beforeMount={handleBeforeMount} onMount={handleMount} onChange={handleChange} @@ -203,12 +203,12 @@ export default function CodeEditor({ ) } -const EditorContainer = styled("div", { - height: "100%", - pointerEvents: "all", - userSelect: "all", +const EditorContainer = styled('div', { + height: '100%', + pointerEvents: 'all', + userSelect: 'all', - ".editorLineError": { - backgroundColor: "$lineError", + '.editorLineError': { + backgroundColor: '$lineError', }, }) diff --git a/components/editor.tsx b/components/editor.tsx index c80c57cce..4be1f7aaa 100644 --- a/components/editor.tsx +++ b/components/editor.tsx @@ -40,9 +40,11 @@ const Layout = styled('div', { left: 0, bottom: 0, right: 0, + height: '100%', + width: '100%', display: 'grid', - gridTemplateRows: '1fr auto 40px', - gridTemplateColumns: 'minmax(50%, 400px) 1fr auto', + gridTemplateRows: '1fr auto 144px', + gridTemplateColumns: 'minmax(0, 720px) 1fr auto', gridTemplateAreas: ` "leftPanels main rightPanels" "tools tools tools" @@ -59,11 +61,11 @@ const LeftPanels = styled('main', { }) const RightPanels = styled('main', { - display: 'grid', gridArea: 'rightPanels', - gridTemplateRows: 'auto', - height: 'fit-content', - justifyContent: 'flex-end', padding: 8, - gap: 8, + // display: 'grid', + // gridTemplateRows: 'auto', + // height: 'fit-content', + // justifyContent: 'flex-end', + // gap: 8, }) diff --git a/components/panel.tsx b/components/panel.tsx index e2fe1d1dd..ebcca81e4 100644 --- a/components/panel.tsx +++ b/components/panel.tsx @@ -13,10 +13,7 @@ export const Root = styled('div', { variants: { isOpen: { - true: { - width: 'auto', - minWidth: 300, - }, + true: {}, false: { height: 34, width: 34,