Bump prettier from 2.0.2 to 2.0.3 (#1263)

* Bump prettier from 2.0.2 to 2.0.3

Bumps [prettier](https://github.com/prettier/prettier) from 2.0.2 to 2.0.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.0.2...2.0.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Format

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
This commit is contained in:
dependabot-preview[bot] 2020-04-06 14:21:07 +03:00 committed by GitHub
parent 4003fa24b2
commit 18f0b76231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 183 additions and 159 deletions

6
package-lock.json generated
View File

@ -12338,9 +12338,9 @@
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
}, },
"prettier": { "prettier": {
"version": "2.0.2", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.2.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.3.tgz",
"integrity": "sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==", "integrity": "sha512-5qpBDBHO9fpE0zruKiTZm8Gxmz7kknO+WlQR/ivV+RMwgDw/WjOgmxLDn66MPrxq/WZPx/EgEZzh87xJO5E6Fw==",
"dev": true "dev": true
}, },
"prettier-linter-helpers": { "prettier-linter-helpers": {

View File

@ -46,7 +46,7 @@
"lint-staged": "10.0.10", "lint-staged": "10.0.10",
"node-sass": "4.13.1", "node-sass": "4.13.1",
"pepjs": "0.5.2", "pepjs": "0.5.2",
"prettier": "2.0.2", "prettier": "2.0.3",
"rewire": "5.0.0", "rewire": "5.0.0",
"typescript": "3.8.3" "typescript": "3.8.3"
}, },

View File

@ -120,9 +120,11 @@ import { actionFinalize } from "../actions";
function withBatchedUpdates< function withBatchedUpdates<
TFunction extends ((event: any) => void) | (() => void) TFunction extends ((event: any) => void) | (() => void)
>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) { >(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) {
return ((event) => { return (
unstable_batchedUpdates(func as TFunction, event); ((event) => {
}) as TFunction; unstable_batchedUpdates(func as TFunction, event);
}) as TFunction
);
} }
const { history } = createHistory(); const { history } = createHistory();

View File

@ -52,57 +52,58 @@ export function handlerRectangles(
const centeringOffset = (size - 8) / (2 * zoom); const centeringOffset = (size - 8) / (2 * zoom);
const handlers = { const handlers =
nw: generateHandler( {
elementX1 - dashedLineMargin - handlerMarginX + centeringOffset, nw: generateHandler(
elementY1 - dashedLineMargin - handlerMarginY + centeringOffset, elementX1 - dashedLineMargin - handlerMarginX + centeringOffset,
handlerWidth, elementY1 - dashedLineMargin - handlerMarginY + centeringOffset,
handlerHeight, handlerWidth,
cx, handlerHeight,
cy, cx,
angle, cy,
), angle,
ne: generateHandler( ),
elementX2 + dashedLineMargin - centeringOffset, ne: generateHandler(
elementY1 - dashedLineMargin - handlerMarginY + centeringOffset, elementX2 + dashedLineMargin - centeringOffset,
handlerWidth, elementY1 - dashedLineMargin - handlerMarginY + centeringOffset,
handlerHeight, handlerWidth,
cx, handlerHeight,
cy, cx,
angle, cy,
), angle,
sw: generateHandler( ),
elementX1 - dashedLineMargin - handlerMarginX + centeringOffset, sw: generateHandler(
elementY2 + dashedLineMargin - centeringOffset, elementX1 - dashedLineMargin - handlerMarginX + centeringOffset,
handlerWidth, elementY2 + dashedLineMargin - centeringOffset,
handlerHeight, handlerWidth,
cx, handlerHeight,
cy, cx,
angle, cy,
), angle,
se: generateHandler( ),
elementX2 + dashedLineMargin - centeringOffset, se: generateHandler(
elementY2 + dashedLineMargin - centeringOffset, elementX2 + dashedLineMargin - centeringOffset,
handlerWidth, elementY2 + dashedLineMargin - centeringOffset,
handlerHeight, handlerWidth,
cx, handlerHeight,
cy, cx,
angle, cy,
), angle,
rotation: generateHandler( ),
elementX1 + elementWidth / 2 - handlerWidth / 2, rotation: generateHandler(
elementY1 - elementX1 + elementWidth / 2 - handlerWidth / 2,
dashedLineMargin - elementY1 -
handlerMarginY + dashedLineMargin -
centeringOffset - handlerMarginY +
ROTATION_HANDLER_GAP / zoom, centeringOffset -
handlerWidth, ROTATION_HANDLER_GAP / zoom,
handlerHeight, handlerWidth,
cx, handlerHeight,
cy, cx,
angle, cy,
), angle,
} as { [T in Sides]: [number, number, number, number] }; ),
} as { [T in Sides]: [number, number, number, number] };
// We only want to show height handlers (all cardinal directions) above a certain size // We only want to show height handlers (all cardinal directions) above a certain size
const minimumSizeForEightHandlers = (5 * size) / zoom; const minimumSizeForEightHandlers = (5 * size) / zoom;
@ -153,38 +154,48 @@ export function handlerRectangles(
const [, p1] = element.points; const [, p1] = element.points;
if (p1[0] === 0 || p1[1] === 0) { if (p1[0] === 0 || p1[1] === 0) {
return { return (
nw: handlers.nw, {
se: handlers.se, nw: handlers.nw,
} as typeof handlers; se: handlers.se,
} as typeof handlers
);
} }
if (p1[0] > 0 && p1[1] < 0) { if (p1[0] > 0 && p1[1] < 0) {
return { return (
ne: handlers.ne, {
sw: handlers.sw, ne: handlers.ne,
} as typeof handlers; sw: handlers.sw,
} as typeof handlers
);
} }
if (p1[0] > 0 && p1[1] > 0) { if (p1[0] > 0 && p1[1] > 0) {
return { return (
nw: handlers.nw, {
se: handlers.se, nw: handlers.nw,
} as typeof handlers; se: handlers.se,
} as typeof handlers
);
} }
if (p1[0] < 0 && p1[1] > 0) { if (p1[0] < 0 && p1[1] > 0) {
return { return (
ne: handlers.ne, {
sw: handlers.sw, ne: handlers.ne,
} as typeof handlers; sw: handlers.sw,
} as typeof handlers
);
} }
if (p1[0] < 0 && p1[1] < 0) { if (p1[0] < 0 && p1[1] < 0) {
return { return (
nw: handlers.nw, {
se: handlers.se, nw: handlers.nw,
} as typeof handlers; se: handlers.se,
} as typeof handlers
);
} }
} }
} }

View File

@ -13,7 +13,9 @@ export function IsMobileProvider({ children }: { children: React.ReactNode }) {
matches: false, matches: false,
addListener: () => {}, addListener: () => {},
removeListener: () => {}, removeListener: () => {},
} as any) as MediaQueryList); } as
any) as
MediaQueryList);
} }
const [isMobile, setMobile] = useState(query.current.matches); const [isMobile, setMobile] = useState(query.current.matches);

View File

@ -1,20 +1,21 @@
export const isDarwin = /Mac|iPod|iPhone|iPad/.test(window.navigator.platform); export const isDarwin = /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
export const KEYS = { export const KEYS =
ARROW_LEFT: "ArrowLeft", {
ARROW_RIGHT: "ArrowRight", ARROW_LEFT: "ArrowLeft",
ARROW_DOWN: "ArrowDown", ARROW_RIGHT: "ArrowRight",
ARROW_UP: "ArrowUp", ARROW_DOWN: "ArrowDown",
ENTER: "Enter", ARROW_UP: "ArrowUp",
ESCAPE: "Escape", ENTER: "Enter",
DELETE: "Delete", ESCAPE: "Escape",
BACKSPACE: "Backspace", DELETE: "Delete",
CTRL_OR_CMD: isDarwin ? "metaKey" : "ctrlKey", BACKSPACE: "Backspace",
TAB: "Tab", CTRL_OR_CMD: isDarwin ? "metaKey" : "ctrlKey",
SPACE: " ", TAB: "Tab",
QUESTION_MARK: "?", SPACE: " ",
F_KEY_CODE: 70, QUESTION_MARK: "?",
} as const; F_KEY_CODE: 70,
} as const;
export type Key = keyof typeof KEYS; export type Key = keyof typeof KEYS;

View File

@ -1,71 +1,79 @@
import React from "react"; import React from "react";
// We inline font-awesome icons in order to save on js size rather than including the font awesome react library // We inline font-awesome icons in order to save on js size rather than including the font awesome react library
export const SHAPES = [ export const SHAPES =
{ [
icon: ( {
// fa-mouse-pointer icon: (
<svg viewBox="0 0 320 512" className=""> // fa-mouse-pointer
<path d="M302.189 329.126H196.105l55.831 135.993c3.889 9.428-.555 19.999-9.444 23.999l-49.165 21.427c-9.165 4-19.443-.571-23.332-9.714l-53.053-129.136-86.664 89.138C18.729 472.71 0 463.554 0 447.977V18.299C0 1.899 19.921-6.096 30.277 5.443l284.412 292.542c11.472 11.179 3.007 31.141-12.5 31.141z" /> <svg viewBox="0 0 320 512" className="">
</svg> <path d="M302.189 329.126H196.105l55.831 135.993c3.889 9.428-.555 19.999-9.444 23.999l-49.165 21.427c-9.165 4-19.443-.571-23.332-9.714l-53.053-129.136-86.664 89.138C18.729 472.71 0 463.554 0 447.977V18.299C0 1.899 19.921-6.096 30.277 5.443l284.412 292.542c11.472 11.179 3.007 31.141-12.5 31.141z" />
), </svg>
value: "selection", ),
}, value: "selection",
{ },
icon: ( {
// fa-square icon: (
<svg viewBox="0 0 448 512"> // fa-square
<path d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z" /> <svg viewBox="0 0 448 512">
</svg> <path d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z" />
), </svg>
value: "rectangle", ),
}, value: "rectangle",
{ },
icon: ( {
// custom icon: (
<svg viewBox="0 0 223.646 223.646"> // custom
<path d="M111.823 0L16.622 111.823 111.823 223.646 207.025 111.823z" /> <svg viewBox="0 0 223.646 223.646">
</svg> <path d="M111.823 0L16.622 111.823 111.823 223.646 207.025 111.823z" />
), </svg>
value: "diamond", ),
}, value: "diamond",
{ },
icon: ( {
// fa-circle icon: (
<svg viewBox="0 0 512 512"> // fa-circle
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z" /> <svg viewBox="0 0 512 512">
</svg> <path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z" />
), </svg>
value: "ellipse", ),
}, value: "ellipse",
{ },
icon: ( {
// fa-long-arrow-alt-right icon: (
<svg viewBox="0 0 448 512" className="rtl-mirror"> // fa-long-arrow-alt-right
<path d="M313.941 216H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12h301.941v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971V216z" /> <svg viewBox="0 0 448 512" className="rtl-mirror">
</svg> <path d="M313.941 216H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12h301.941v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971V216z" />
), </svg>
value: "arrow", ),
}, value: "arrow",
{ },
icon: ( {
// custom icon: (
<svg viewBox="0 0 6 6"> // custom
<line x1="0" y1="3" x2="6" y2="3" stroke="#000" strokeLinecap="round" /> <svg viewBox="0 0 6 6">
</svg> <line
), x1="0"
value: "line", y1="3"
}, x2="6"
{ y2="3"
icon: ( stroke="#000"
// fa-font strokeLinecap="round"
<svg viewBox="0 0 448 512"> />
<path d="M432 416h-23.41L277.88 53.69A32 32 0 0 0 247.58 32h-47.16a32 32 0 0 0-30.3 21.69L39.41 416H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-19.58l23.3-64h152.56l23.3 64H304a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM176.85 272L224 142.51 271.15 272z" /> </svg>
</svg> ),
), value: "line",
value: "text", },
}, {
] as const; icon: (
// fa-font
<svg viewBox="0 0 448 512">
<path d="M432 416h-23.41L277.88 53.69A32 32 0 0 0 247.58 32h-47.16a32 32 0 0 0-30.3 21.69L39.41 416H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-19.58l23.3-64h152.56l23.3 64H304a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM176.85 272L224 142.51 271.15 272z" />
</svg>
),
value: "text",
},
] as const;
export const shapesShortcutKeys = SHAPES.map((shape, index) => [ export const shapesShortcutKeys = SHAPES.map((shape, index) => [
shape.value[0], shape.value[0],