Explorar o código

fix: incorrect deps

Peng Xiao %!s(int64=3) %!d(string=hai) anos
pai
achega
a6107e2e47

+ 1 - 1
tldraw/cljs-demo/.gitignore

@@ -2,7 +2,7 @@ node_modules/
 public/js
 public/styles.css
 
-src/js
+src/js/tldraw-logseq
 
 /target
 /checkouts

+ 2 - 2
tldraw/cljs-demo/package.json

@@ -8,8 +8,8 @@
   },
   "devDependencies": {
     "node-libs-browser": "^2.2.1",
-    "react": ">=16.8",
-    "react-dom": "^16.8 || ^17.0",
+    "react": "^17",
+    "react-dom": "^17",
     "shadow-cljs": "^2.19.0"
   },
   "dependencies": {

+ 1 - 14
tldraw/cljs-demo/public/index.html

@@ -7,20 +7,7 @@
       content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
     />
     <meta http-equiv="X-UA-Compatible" content="ie=edge" />
-    <script src="https://cdn.tailwindcss.com"></script>
-    <script>
-      tailwind.config = {
-        theme: {
-          extend: {
-            fontFamily: {
-              title: ["Montserrat", "sans-serif"],
-              mono: ["Fira Code", "monospace"],
-              sans: ["Source Sans", "sans-serif"],
-            },
-          },
-        },
-      };
-    </script>
+  </head>
   <body >
     <div id="app"></div>
     <script src="js/main.js"></script>

+ 0 - 0
tldraw/cljs-demo/src/js/.gitkeep


+ 6 - 5
tldraw/cljs-demo/yarn.lock

@@ -467,7 +467,7 @@ randomfill@^1.0.3:
     randombytes "^2.0.5"
     safe-buffer "^5.1.0"
 
-"react-dom@^16.8 || ^17.0":
+react-dom@^17:
   version "17.0.2"
   resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
   integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
@@ -476,12 +476,13 @@ randomfill@^1.0.3:
     object-assign "^4.1.1"
     scheduler "^0.20.2"
 
-react@>=16.8:
-  version "18.1.0"
-  resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
-  integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==
+react@^17:
+  version "17.0.2"
+  resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
+  integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
   dependencies:
     loose-envify "^1.1.0"
+    object-assign "^4.1.1"
 
 readable-stream@^2.0.2, readable-stream@^2.3.3, readable-stream@^2.3.6:
   version "2.3.7"

+ 2 - 2
tldraw/demo/package.json

@@ -14,7 +14,7 @@
   },
   "dependencies": {
     "@vitejs/plugin-react": "^1.3.2",
-    "react": "^17.0.0",
-    "react-dom": "^17.0.0"
+    "react": "^17",
+    "react-dom": "^17"
   }
 }

+ 12 - 9
tldraw/packages/core/src/lib/TLBaseLineBindingState.ts

@@ -1,4 +1,5 @@
 import Vec from '@tldraw/vec'
+import { transaction } from 'mobx'
 import { TLApp, TLLineShape, TLLineShapeProps, TLShape, TLTool, TLToolState } from '~lib'
 import type { TLBinding, TLEventMap, TLHandle, TLStateEvents } from '~types'
 import { deepMerge, GeomUtils } from '~utils'
@@ -190,15 +191,17 @@ export class TLBaseLineBindingState<
 
     updated = this.currentShape.getHandlesChange(next.shape, next.shape.handles)
 
-    if (updated) {
-      this.currentShape.update(updated)
-      this.app.currentPage.updateBindings(next.bindings)
-      this.app.setBindingShapes(
-        Object.values(updated.handles ?? {})
-          .map(h => next.bindings[h.bindingId!]?.toId)
-          .filter(Boolean)
-      )
-    }
+    transaction(() => {
+      if (updated) {
+        this.currentShape.update(updated)
+        this.app.currentPage.updateBindings(next.bindings)
+        this.app.setBindingShapes(
+          Object.values(updated.handles ?? {})
+            .map(h => next.bindings[h.bindingId!]?.toId)
+            .filter(Boolean)
+        )
+      }
+    })
   }
 
   onPointerUp: TLStateEvents<S, K>['onPointerUp'] = () => {

+ 1 - 4
tldraw/packages/core/src/lib/TLPage/TLPage.ts

@@ -231,10 +231,7 @@ export class TLPage<S extends TLShape = TLShape, E extends TLEventMap = TLEventM
     })
 
     // Get bindings related to the changed shapes
-    const bindingsToUpdate =
-      Object.values(curr.bindings) ||
-      // fixme:
-      getRelatedBindings(curr, Object.keys(changedShapes))
+    const bindingsToUpdate = getRelatedBindings(curr, Object.keys(changedShapes))
 
     const visitedShapes = new Set<TLShapeModel>()
 

+ 1 - 1
tldraw/packages/react/src/hooks/useResizeObserver.ts

@@ -85,6 +85,6 @@ export function useResizeObserver<T extends HTMLElement>(
     updateBounds()
     setTimeout(() => {
       app.api.cameraToCenter()
-    })
+    }, 50)
   }, [ref])
 }

+ 2 - 2
tldraw/yarn.lock

@@ -7482,7 +7482,7 @@ rbush@^3.0.1:
   dependencies:
     quickselect "^2.0.0"
 
-react-dom@^17.0.0:
+react-dom@^17, react-dom@^17.0.0:
   version "17.0.2"
   resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
   integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
@@ -7534,7 +7534,7 @@ react-transition-group@^4.3.0:
     loose-envify "^1.4.0"
     prop-types "^15.6.2"
 
-react@^17.0.0:
+react@^17, react@^17.0.0:
   version "17.0.2"
   resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
   integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==