@upmade/core 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Lukas Mühlenbeck
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Lukas Mühlenbeck
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # @upmade/core
2
-
3
- The framework-agnostic core of [Upmade](https://upmade.io/): objects, tools, sync and asset providers, themes, locales and helpers.
4
-
5
- You don't install this package yourself. `@upmade/engine` and `@upmade/editor` depend on it, and `@upmade/engine` and the Angular, React and Vue wrappers re-export its API, so keep importing from those packages.
6
-
7
- ## Why a separate package
8
-
9
- `@upmade/engine` and `@upmade/editor` are Stencil component libraries. Each Stencil output bundles the code its components import. Keeping the classes in this plain package, which both libraries load as an external dependency, means an app always has exactly one copy of every Upmade class, so `instanceof` checks and shared static state work across the engine and the editor.
10
-
11
- ## Script tags and import maps
12
-
13
- Like `yjs`, `@upmade/core` is imported by bare specifier from the engine and editor builds. When loading those builds directly in the browser without a bundler, add `@upmade/core` to your import map next to `yjs`.
1
+ # @upmade/core
2
+
3
+ The framework-agnostic core of [Upmade](https://upmade.io/): objects, tools, sync and asset providers, themes, locales and helpers.
4
+
5
+ You don't install this package yourself. `@upmade/engine` and `@upmade/editor` depend on it, and `@upmade/engine` and the Angular, React and Vue wrappers re-export its API, so keep importing from those packages.
6
+
7
+ ## Why a separate package
8
+
9
+ `@upmade/engine` and `@upmade/editor` are Stencil component libraries. Each Stencil output bundles the code its components import. Keeping the classes in this plain package, which both libraries load as an external dependency, means an app always has exactly one copy of every Upmade class, so `instanceof` checks and shared static state work across the engine and the editor.
10
+
11
+ ## Script tags and import maps
12
+
13
+ Like `yjs`, `@upmade/core` is imported by bare specifier from the engine and editor builds. When loading those builds directly in the browser without a bundler, add `@upmade/core` to your import map next to `yjs`.
@@ -5916,16 +5916,23 @@ function dropPoint(doc3, pos, slice) {
5916
5916
  for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
5917
5917
  for (let d2 = $pos.depth; d2 >= 0; d2--) {
5918
5918
  let bias = d2 == $pos.depth ? 0 : $pos.pos <= ($pos.start(d2 + 1) + $pos.end(d2 + 1)) / 2 ? -1 : 1;
5919
- let insertPos = $pos.index(d2) + (bias > 0 ? 1 : 0);
5920
- let parent = $pos.node(d2), fits = false;
5921
- if (pass == 1) {
5922
- fits = parent.canReplace(insertPos, insertPos, content);
5923
- } else {
5924
- let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
5925
- fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
5919
+ for (let attempt = 0; attempt < 2; attempt++) {
5920
+ if (attempt) {
5921
+ if (!bias)
5922
+ break;
5923
+ bias = -bias;
5924
+ }
5925
+ let insertPos = $pos.index(d2) + (bias > 0 ? 1 : 0);
5926
+ let parent = $pos.node(d2), fits = false;
5927
+ if (pass == 1) {
5928
+ fits = parent.canReplace(insertPos, insertPos, content);
5929
+ } else {
5930
+ let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
5931
+ fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
5932
+ }
5933
+ if (fits)
5934
+ return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d2 + 1) : $pos.after(d2 + 1);
5926
5935
  }
5927
- if (fits)
5928
- return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d2 + 1) : $pos.after(d2 + 1);
5929
5936
  }
5930
5937
  }
5931
5938
  return null;
@@ -14492,9 +14499,10 @@ var lightTheme = {
14492
14499
  separatorColor: "hsl(0, 0%, 0%, 8%)"
14493
14500
  },
14494
14501
  watermark: {
14495
- background: "rgba(255, 255, 255, 0.6)",
14496
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.12)",
14497
- color: "rgba(60, 60, 60, 0.75)"
14502
+ background: "rgba(255, 255, 255, 0.9)",
14503
+ boxShadow: "0 1px 3px rgba(0, 0, 0, 0.12)",
14504
+ color: "#52525b",
14505
+ logoColor: "#000000"
14498
14506
  },
14499
14507
  chatBox: {
14500
14508
  backgroundColor: "#ffffff",
@@ -14918,9 +14926,10 @@ var darkTheme = {
14918
14926
  separatorColor: "hsl(0, 0%, 100%, 12%)"
14919
14927
  },
14920
14928
  watermark: {
14921
- background: "rgba(40, 40, 40, 0.6)",
14922
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.35)",
14923
- color: "rgba(220, 220, 220, 0.8)"
14929
+ background: "rgba(40, 40, 40, 0.9)",
14930
+ boxShadow: "0 1px 3px rgba(0, 0, 0, 0.35)",
14931
+ color: "#d4d4d8",
14932
+ logoColor: "#ffffff"
14924
14933
  },
14925
14934
  chatBox: {
14926
14935
  backgroundColor: "#2a2a2a",
@@ -43788,7 +43797,7 @@ var CURRENT_APP_STATE_SCHEMA_VERSION = 2;
43788
43797
  var CURRENT_WORKSPACE_SCHEMA_VERSION = 3;
43789
43798
 
43790
43799
  // src/constants/version.ts
43791
- var UPMADE_VERSION = "0.6.2";
43800
+ var UPMADE_VERSION = "0.6.3";
43792
43801
 
43793
43802
  // src/configs/default-engine-config.ts
43794
43803
  var DEFAULT_ENGINE_CONFIG = {
@@ -45392,6 +45401,40 @@ var UpmadeObjectMap = class _UpmadeObjectMap {
45392
45401
  }
45393
45402
  }
45394
45403
  }
45404
+ /**
45405
+ * Removes an object the local user started but did not finish, as if it had never been made,
45406
+ * e.g. a brush stroke whose first finger turned out to be the start of a pinch-zoom.
45407
+ *
45408
+ * Unlike `remove()`, which records the removal as an undo step of its own (so undo would bring
45409
+ * the half-made object back), the deletion joins the still open undo step that recorded the
45410
+ * object's insertion. Yjs never restores what was created and deleted in the same step. If that
45411
+ * step holds nothing else, it is dropped, so the next undo reverts the user's previous action.
45412
+ *
45413
+ * @param objectId - The ID of the object to discard
45414
+ */
45415
+ discard(objectId) {
45416
+ if (!this._idMap.has(objectId)) {
45417
+ return;
45418
+ }
45419
+ this.quadtree.remove((o3) => o3.id === objectId);
45420
+ this._idMap.delete(objectId);
45421
+ if (this._localActiveDrawingObjectId === objectId) {
45422
+ this._localActiveDrawingObjectId = null;
45423
+ }
45424
+ if (this._objectsMap?.has(objectId)) {
45425
+ const undoManager = this._undoManager;
45426
+ const stackLength = undoManager?.undoStack.length ?? 0;
45427
+ const origin = this.writeOrigin;
45428
+ this._ydoc?.transact(() => {
45429
+ this._objectsMap?.delete(objectId);
45430
+ }, origin);
45431
+ const top = undoManager?.undoStack[stackLength - 1];
45432
+ if (undoManager && top && origin === "local" && this._transactionDepth === 0 && this._temporaryItemsCount === 0 && undoManager.undoStack.length === stackLength && Y5.equalDeleteSets(top.insertions, top.deletions)) {
45433
+ undoManager.undoStack.pop();
45434
+ }
45435
+ }
45436
+ this.markUndoBoundary();
45437
+ }
45395
45438
  /**
45396
45439
  * Filters objects in the quadtree based on a predicate function.
45397
45440
  *
@@ -51075,9 +51118,10 @@ var UpmadeViewport = class _UpmadeViewport {
51075
51118
  }
51076
51119
  if (activePointers.length === 2) {
51077
51120
  this._core.store.objects?.clearCursorPosition();
51078
- const currentPath = this._core.store.currentPath;
51079
- if (currentPath) {
51080
- this._core.store.objects.remove((obj) => obj.id === currentPath.id);
51121
+ const drawingObjectId = this._core.store.objects?.localActiveDrawingObjectId;
51122
+ const drawingObject = drawingObjectId ? this._core.store.objects.findById(drawingObjectId) : void 0;
51123
+ if (drawingObject instanceof UpmadePath) {
51124
+ this._core.store.objects.discard(drawingObject.id);
51081
51125
  }
51082
51126
  if (this._core.store.state.isSelecting) {
51083
51127
  this._core.store.state.isSelecting = false;