canvu-react 0.4.32 → 0.4.34

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.
@@ -1,5 +1,6 @@
1
- import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-BS-YG8Hx.cjs';
2
- export { F as PresenceOverlayRenderContext } from './types-BS-YG8Hx.cjs';
1
+ import { P as PlacementPreview, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-NBYvslB-.cjs';
2
+ import { a as RemotePresenceMarkupStroke, R as RemotePresencePeer, b as RemotePresenceCamera, c as RealtimeConnectionState } from './types-BQUbxMgz.cjs';
3
+ export { P as PresenceOverlayRenderContext } from './types-BQUbxMgz.cjs';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import { C as Camera2D } from './shape-builders-CKEMjivV.cjs';
5
6
  import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.cjs';
@@ -1,5 +1,6 @@
1
- import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-UZYYwK-v.js';
2
- export { F as PresenceOverlayRenderContext } from './types-UZYYwK-v.js';
1
+ import { P as PlacementPreview, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-DeDm865m.js';
2
+ import { a as RemotePresenceMarkupStroke, R as RemotePresencePeer, b as RemotePresenceCamera, c as RealtimeConnectionState } from './types-B82WiQQh.js';
3
+ export { P as PresenceOverlayRenderContext } from './types-B82WiQQh.js';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import { C as Camera2D } from './shape-builders-Cyh8zvDG.js';
5
6
  import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.js';
package/dist/realtime.js CHANGED
@@ -1989,6 +1989,12 @@ function useRealtimePeerFollow(options) {
1989
1989
  }, [followedPeerId, onFollowEnd, sessionPeers, viewportRef]);
1990
1990
  }
1991
1991
  var ITEMS_KEY = "items";
1992
+ var CLIENT_ONLY_IMAGE_KEYS = /* @__PURE__ */ new Set([
1993
+ "imageBlobId",
1994
+ "imageThumbnailBlobId",
1995
+ "imageRasterHref",
1996
+ "imageThumbnailHref"
1997
+ ]);
1992
1998
  var SERVER_ADD_RACE_WINDOW_MS = 2e3;
1993
1999
  function createYjsBoardDoc() {
1994
2000
  const doc = new Y.Doc();
@@ -2011,7 +2017,7 @@ function getItemId(item) {
2011
2017
  }
2012
2018
  function vectorItemToYMap(item) {
2013
2019
  const yMap = new Y.Map();
2014
- for (const [key, value] of Object.entries(item)) {
2020
+ for (const [key, value] of Object.entries(normalizeRealtimeItem(item))) {
2015
2021
  if (value === void 0) continue;
2016
2022
  yMap.set(key, value);
2017
2023
  }
@@ -2056,11 +2062,12 @@ function valuesEqual(left, right) {
2056
2062
  }
2057
2063
  function serializeItem(value) {
2058
2064
  const item = value instanceof Y.Map ? yMapToVectorItem(value) : value;
2059
- return JSON.stringify(item);
2065
+ return JSON.stringify(normalizeRealtimeItem(item));
2060
2066
  }
2061
2067
  function updateYMapInPlace(yMap, next) {
2068
+ const normalizedNext = normalizeRealtimeItem(next);
2062
2069
  const nextKeys = /* @__PURE__ */ new Set();
2063
- for (const [key, value] of Object.entries(next)) {
2070
+ for (const [key, value] of Object.entries(normalizedNext)) {
2064
2071
  if (value === void 0) continue;
2065
2072
  nextKeys.add(key);
2066
2073
  const current = yMap.get(key);
@@ -2072,6 +2079,14 @@ function updateYMapInPlace(yMap, next) {
2072
2079
  if (!nextKeys.has(key)) yMap.delete(key);
2073
2080
  }
2074
2081
  }
2082
+ function normalizeRealtimeItem(item) {
2083
+ if (item.toolKind !== "image") return item;
2084
+ const normalized = Object.fromEntries(
2085
+ Object.entries(item).filter(([key]) => !CLIENT_ONLY_IMAGE_KEYS.has(key))
2086
+ );
2087
+ normalized.childrenSvg = "";
2088
+ return normalized;
2089
+ }
2075
2090
  function applyLocalItemsToYDoc(board, options) {
2076
2091
  const { items, origin } = options;
2077
2092
  const addedIds = [];