Compare commits

..

2 Commits

Author SHA1 Message Date
8b330d17b0 Add deps 2023-07-21 15:42:45 +09:00
3c8ac297b2 Fix some bugs 2023-07-21 15:42:11 +09:00
6 changed files with 56 additions and 9 deletions

View File

@ -18,6 +18,7 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"pre-commit": "lint-staged", "pre-commit": "lint-staged",
"pre-build": "run-s pre-build:*",
"pre-build:license-report": "node license-emit.js", "pre-build:license-report": "node license-emit.js",
"build": "run-s pre-build build:*", "build": "run-s pre-build build:*",
"build:vite": "tsc && vite build", "build:vite": "tsc && vite build",
@ -35,6 +36,9 @@
"dexie": "^3.2.4", "dexie": "^3.2.4",
"dexie-react-hooks": "^1.1.6", "dexie-react-hooks": "^1.1.6",
"jotai": "^2.2.2", "jotai": "^2.2.2",
"just-diff": "^6.0.2",
"just-diff-apply": "^5.5.0",
"qrcode.react": "^3.1.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.14.2", "react-router-dom": "^6.14.2",

25
pnpm-lock.yaml generated
View File

@ -29,6 +29,15 @@ dependencies:
jotai: jotai:
specifier: ^2.2.2 specifier: ^2.2.2
version: 2.2.2(react@18.2.0) version: 2.2.2(react@18.2.0)
just-diff:
specifier: ^6.0.2
version: 6.0.2
just-diff-apply:
specifier: ^5.5.0
version: 5.5.0
qrcode.react:
specifier: ^3.1.0
version: 3.1.0(react@18.2.0)
react: react:
specifier: ^18.2.0 specifier: ^18.2.0
version: 18.2.0 version: 18.2.0
@ -3606,6 +3615,14 @@ packages:
graceful-fs: 4.2.11 graceful-fs: 4.2.11
dev: true dev: true
/just-diff-apply@5.5.0:
resolution: {integrity: sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw==}
dev: false
/just-diff@6.0.2:
resolution: {integrity: sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==}
dev: false
/keyv@4.5.3: /keyv@4.5.3:
resolution: {integrity: sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==} resolution: {integrity: sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==}
dependencies: dependencies:
@ -4082,6 +4099,14 @@ packages:
engines: {node: '>=6'} engines: {node: '>=6'}
dev: true dev: true
/qrcode.react@3.1.0(react@18.2.0):
resolution: {integrity: sha512-oyF+Urr3oAMUG/OiOuONL3HXM+53wvuH3mtIWQrYmsXoAq0DkvZp2RYUWFSMFtbdOpuS++9v+WAkzNVkMlNW6Q==}
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
dependencies:
react: 18.2.0
dev: false
/queue-microtask@1.2.3: /queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
dev: true dev: true

View File

@ -13,10 +13,7 @@ export const ExcalidrawMain = () => {
const [toggleState, setToggleState] = useState<boolean>(false); const [toggleState, setToggleState] = useState<boolean>(false);
const onClose = useCallback( const onClose = useCallback(() => setToggleState(false), []);
() => setToggleState(!toggleState),
[toggleState]
);
return ( return (
<ExcalidrawContainer <ExcalidrawContainer

View File

@ -3,7 +3,7 @@ import type {
ExcalidrawProps, ExcalidrawProps,
ExcalidrawImperativeAPI, ExcalidrawImperativeAPI,
} from '@excalidraw/excalidraw/types/types'; } from '@excalidraw/excalidraw/types/types';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useEffect, useMemo, useState } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
export type WindowRect = { export type WindowRect = {
@ -46,17 +46,17 @@ export const ExcalidrawContainer: FC<ExcalidrawContainerProps> = (props) => {
height: window.innerHeight, height: window.innerHeight,
}); });
const onResize = useCallback(() => { const onResize = () => {
setWindowRect({ setWindowRect({
width: window.innerWidth, width: window.innerWidth,
height: window.innerHeight, height: window.innerHeight,
}); });
}, []); };
useEffect(() => { useEffect(() => {
window.addEventListener('resize', onResize); window.addEventListener('resize', onResize);
return () => window.removeEventListener('resize', onResize); return () => window.removeEventListener('resize', onResize);
}, [onResize]); }, []);
return ( return (
<ExcalidrawBox $scale={scale} $windowRect={windowRect}> <ExcalidrawBox $scale={scale} $windowRect={windowRect}>

View File

@ -21,7 +21,7 @@ const RightTopUI: FC<RightTopUIProps> = (props) => {
const sidebarToggle = useCallback( const sidebarToggle = useCallback(
(variant: SidebarVariant) => { (variant: SidebarVariant) => {
if (excalidrawAPI && !props.toggleState) { if (excalidrawAPI && !props.toggleState) {
props.setToggleState(props.toggleState); props.setToggleState(true);
props.setSidebarVariant(variant); props.setSidebarVariant(variant);
excalidrawAPI.toggleMenu('customSidebar'); excalidrawAPI.toggleMenu('customSidebar');
} }

View File

@ -55,6 +55,27 @@
"link": "git+https://github.com/pmndrs/jotai.git", "link": "git+https://github.com/pmndrs/jotai.git",
"installedFrom": "https://registry.npmjs.org/jotai/-/jotai-2.2.2.tgz" "installedFrom": "https://registry.npmjs.org/jotai/-/jotai-2.2.2.tgz"
}, },
{
"name": "just-diff",
"licenseType": "MIT",
"author": "Angus Croll",
"link": "git+https://github.com/angus-c/just.git",
"installedFrom": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz"
},
{
"name": "just-diff-apply",
"licenseType": "MIT",
"author": "Angus Croll",
"link": "git+https://github.com/angus-c/just.git",
"installedFrom": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-5.5.0.tgz"
},
{
"name": "qrcode.react",
"licenseType": "ISC",
"author": "Paul OShannessy <paul@oshannessy.com>",
"link": "git+https://github.com/zpao/qrcode.react.git",
"installedFrom": "https://registry.npmjs.org/qrcode.react/-/qrcode.react-3.1.0.tgz"
},
{ {
"name": "react", "name": "react",
"licenseType": "MIT", "licenseType": "MIT",