diff --git a/app/web/package.json b/app/web/package.json index 333ae73c..8d23d7f0 100644 --- a/app/web/package.json +++ b/app/web/package.json @@ -7,20 +7,20 @@ }, "dependencies": { "@babel/parser": "^7.23.0", - "@floating-ui/react": "^0.26.0", + "@floating-ui/react": "^0.26.1", "@leeoniya/ufuzzy": "^1.0.11", "@minoru/react-dnd-treeview": "^3.4.4", "@monaco-editor/react": "^4.6.0", "@paralleldrive/cuid2": "2.2.2", - "@parcel/packager-wasm": "^2.10.0", - "@parcel/service-worker": "^2.10.0", + "@parcel/packager-wasm": "^2.10.1", + "@parcel/service-worker": "^2.10.1", "@qiwi/deep-proxy": "^2.0.3", - "@swc/wasm-web": "1.3.94-nightly-20231014.1", + "@swc/wasm-web": "1.3.96-nightly-20231025.1", "algoliasearch": "^4.20.0", "date-fns": "^2.30.0", "dbgen": "workspace:*", "downshift": "^8.2.2", - "esbuild-wasm": "^0.19.4", + "esbuild-wasm": "^0.19.5", "hash-wasm": "^4.10.0", "idb-keyval": "^6.2.1", "immer": "^10.0.3", @@ -53,10 +53,10 @@ "react-dom": "18.2.0", "react-is": "^18.2.0", "react-use-error-boundary": "^3.0.0", - "react-virtuoso": "^4.6.1", + "react-virtuoso": "^4.6.2", "safe-stable-stringify": "^2.4.3", "svgo": "^3.0.2", - "textdiff-create": "^1.1.9", + "textdiff-create": "^1.1.10", "tinycolor2": "^1.6.0", "ua-parser-js": "^1.0.36", "uuid": "9.0.1", @@ -67,39 +67,38 @@ "yjs-types": "^0.0.1" }, "devDependencies": { - "@types/lodash.concat": "^4.5.7", - "@types/lodash.find": "^4.6.7", - "@types/lodash.findindex": "^4.6.7", - "@types/lodash.indexof": "^4.0.7", - "@types/lodash.orderby": "^4.6.7", - "@types/lodash.slice": "^4.2.7", - "@types/lodash.throttle": "^4.1.7", - "@types/lodash.transform": "^4.6.7", - "@types/lodash.uniq": "^4.5.7", - "@types/lodash.uniqby": "^4.7.7", - "@types/react-is": "^18.2.2", - "@types/textdiff-create": "^1.0.0", - "@types/ua-parser-js": "^0.7.37", - "@parcel/config-default": "2.10.0", - "@parcel/core": "2.10.0", - "@parcel/reporter-bundle-analyzer": "^2.10.0", - "@parcel/transformer-raw": "^2.10.0", + "@types/lodash.concat": "^4.5.8", + "@types/lodash.find": "^4.6.8", + "@types/lodash.findindex": "^4.6.8", + "@types/lodash.indexof": "^4.0.8", + "@types/lodash.orderby": "^4.6.8", + "@types/lodash.slice": "^4.2.8", + "@types/lodash.throttle": "^4.1.8", + "@types/lodash.transform": "^4.6.8", + "@types/lodash.uniq": "^4.5.8", + "@types/lodash.uniqby": "^4.7.8", + "@types/react-is": "^18.2.3", + "@types/textdiff-create": "^1.0.1", + "@types/ua-parser-js": "^0.7.38", + "@parcel/config-default": "2.10.1", + "@parcel/core": "2.10.1", + "@parcel/transformer-raw": "^2.10.1", "@tinijs/parcel-reporter-copy-public": "0.0.2", - "@types/lodash.capitalize": "4.2.7", - "@types/lodash.debounce": "^4.0.7", - "@types/lodash.get": "^4.4.7", - "@types/lodash.set": "^4.3.7", - "@types/lodash.trim": "4.5.7", + "@types/lodash.capitalize": "4.2.8", + "@types/lodash.debounce": "^4.0.8", + "@types/lodash.get": "^4.4.8", + "@types/lodash.set": "^4.3.8", + "@types/lodash.trim": "4.5.8", "@types/prettier": "3.0.0", - "@types/react": "^18.2.0", - "@types/react-dom": "^18.2.0", - "@types/tinycolor2": "^1.4.4", - "@types/uuid": "9.0.5", - "@types/vscode": "^1.83.0", - "parcel": "2.10.0", + "@types/react": "^18.2.31", + "@types/react-dom": "^18.2.14", + "@types/tinycolor2": "^1.4.5", + "@types/uuid": "9.0.6", + "@types/vscode": "^1.83.1", + "parcel": "2.10.1", "parcel-bundler-splitable": "0.0.4", "postcss": "8.4.31", - "tailwindcss": "3.3.3" + "tailwindcss": "3.3.4" }, "staticFiles": { "staticPath": "public" diff --git a/app/web/src/render/ed/ed-base.tsx b/app/web/src/render/ed/ed-base.tsx index 47ec70be..095d4a24 100644 --- a/app/web/src/render/ed/ed-base.tsx +++ b/app/web/src/render/ed/ed-base.tsx @@ -7,6 +7,7 @@ import { EdMain } from "./panel/main/main"; import { EdTree } from "./panel/tree/tree"; import { edUndoManager } from "./logic/ed-undo"; import { EdPopCompGroup } from "./panel/popup/comp-group"; +import { EdPaneResize } from "./panel/main/pane-resize"; export const EdBase = () => { const p = useGlobal(EDGlobal, "EDITOR"); @@ -34,6 +35,20 @@ export const EdBase = () => {
+ { + if (size > 100) { + p.ui.layout.left = size; + p.render(); + } + }} + onDone={(size) => { + if (size > 100) { + localStorage.setItem("prasi-layout-left", size.toString()); + } + }} + />
diff --git a/app/web/src/render/ed/logic/ed-global.ts b/app/web/src/render/ed/logic/ed-global.ts index 54fb622c..db8747d0 100644 --- a/app/web/src/render/ed/logic/ed-global.ts +++ b/app/web/src/render/ed/logic/ed-global.ts @@ -87,6 +87,10 @@ export const EDGlobal = { group: {} as Record>>, }, ui: { + layout: { + left: parseInt(localStorage.getItem("prasi-layout-left") || "250"), + right: parseInt(localStorage.getItem("prasi-layout-right") || "250"), + }, prevent_indent_hook: false, syncing: false, tree: { diff --git a/app/web/src/render/ed/panel/main/main.tsx b/app/web/src/render/ed/panel/main/main.tsx index 80101255..6c3a862a 100644 --- a/app/web/src/render/ed/panel/main/main.tsx +++ b/app/web/src/render/ed/panel/main/main.tsx @@ -1,3 +1,3 @@ export const EdMain = () => { - return
; + return
; }; diff --git a/app/web/src/render/ed/panel/main/pane-resize.tsx b/app/web/src/render/ed/panel/main/pane-resize.tsx new file mode 100644 index 00000000..ac993555 --- /dev/null +++ b/app/web/src/render/ed/panel/main/pane-resize.tsx @@ -0,0 +1,72 @@ +import { useLocal } from "web-utils"; + +export const EdPaneResize = (arg: { + size: number; + onResize: (size: number) => void; + onDone: (size: number) => void; +}) => { + const local = useLocal({ + default: arg.size, + dragging: false, + sx: 0, + size: 0, + result: 0, + inzone: false, + }); + + const stopDrag = () => { + local.dragging = false; + local.render(); + arg.onDone(arg.size); + }; + + return ( + <> + {local.dragging && ( +
{ + local.inzone = true; + }} + onPointerMove={(e) => { + local.result = Math.max(0, local.size + e.clientX - local.sx); + arg.onResize(local.result); + }} + onPointerUp={stopDrag} + onPointerDown={stopDrag} + >
+ )} +
+
{ + arg.onResize(local.default); + }} + onPointerUp={stopDrag} + onPointerLeave={() => { + setTimeout(() => { + if (!local.inzone) { + stopDrag(); + } + }, 300); + }} + onPointerDown={(e) => { + window.removeEventListener("blur", stopDrag); + window.addEventListener("blur", stopDrag); + + e.preventDefault(); + e.stopPropagation(); + local.dragging = true; + local.sx = e.clientX; + local.size = arg.size; + local.result = arg.size; + local.render(); + }} + >
+
+ + ); +}; diff --git a/app/web/src/render/ed/panel/tree/node/item/ctx-menu.tsx b/app/web/src/render/ed/panel/tree/node/item/ctx-menu.tsx index cb97d91b..104360a9 100644 --- a/app/web/src/render/ed/panel/tree/node/item/ctx-menu.tsx +++ b/app/web/src/render/ed/panel/tree/node/item/ctx-menu.tsx @@ -100,7 +100,7 @@ export const EdTreeCtxMenu = ({ )} } + // hotKey={} onClick={() => edActionCut(p, item)} /> { + const p = useGlobal(EDGlobal, "EDITOR"); return ( -
- -
-
- - - +
+
+ +
+
+ + + +
diff --git a/app/web/src/utils/sync/ws-client.ts b/app/web/src/utils/sync/ws-client.ts index 0d12e387..86938145 100644 --- a/app/web/src/utils/sync/ws-client.ts +++ b/app/web/src/utils/sync/ws-client.ts @@ -16,7 +16,7 @@ import { initIDB } from "./idb"; const packr = new Packr({ structuredClone: true }); /** CONSTANT */ -const WS_DEBUG = false; +const WS_DEBUG = true; const RECONNECT_TIMEOUT = 1000; const conf = { diff --git a/bun.lockb b/bun.lockb index 27d19bc0..e8e0ff40 100755 Binary files a/bun.lockb and b/bun.lockb differ