feat: wireframe-to-code (#7334)

This commit is contained in:
David Luzar 2023-11-23 23:07:53 +01:00 committed by GitHub
parent d1e4421823
commit c7ee46e7f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 2106 additions and 444 deletions

View file

@ -6,11 +6,7 @@ import {
isDarwin,
WINDOWS_EMOJI_FALLBACK_FONT,
} from "./constants";
import {
FontFamilyValues,
FontString,
NonDeletedExcalidrawElement,
} from "./element/types";
import { FontFamilyValues, FontString } from "./element/types";
import { ActiveTool, AppState, ToolType, Zoom } from "./types";
import { unstable_batchedUpdates } from "react-dom";
import { ResolutionType } from "./utility-types";
@ -77,7 +73,9 @@ export const isWritableElement = (
target instanceof HTMLBRElement || // newline in wysiwyg
target instanceof HTMLTextAreaElement ||
(target instanceof HTMLInputElement &&
(target.type === "text" || target.type === "number"));
(target.type === "text" ||
target.type === "number" ||
target.type === "password"));
export const getFontFamilyString = ({
fontFamily,
@ -821,19 +819,6 @@ export const composeEventHandlers = <E>(
};
};
export const isOnlyExportingSingleFrame = (
elements: readonly NonDeletedExcalidrawElement[],
) => {
const frames = elements.filter((element) => element.type === "frame");
return (
frames.length === 1 &&
elements.every(
(element) => element.type === "frame" || element.frameId === frames[0].id,
)
);
};
/**
* supply `null` as message if non-never value is valid, you just need to
* typecheck against it