canvu-react 0.4.33 → 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.
@@ -3,6 +3,7 @@ import { CSSProperties, ReactNode, RefObject } from 'react';
3
3
  import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.js';
4
4
  import { S as StrokeStyle, C as Camera2D } from './shape-builders-Cyh8zvDG.js';
5
5
  import { C as CanvuLinkData, a as VectorViewportAssetStore } from './link-item-voRU0Up9.js';
6
+ import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-B82WiQQh.js';
6
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
8
 
8
9
  type CanvuChromeActiveToolStyle = StrokeStyle & {
@@ -116,72 +117,6 @@ type VectorToolDefinition = {
116
117
  ariaLabel?: string;
117
118
  };
118
119
 
119
- type RealtimeConnectionState = "connecting" | "connected" | "reconnecting" | "offline" | "error";
120
- /**
121
- * In-progress freehand stroke from a remote peer (before it becomes a committed `VectorSceneItem`).
122
- */
123
- type RemotePresenceMarkupStroke = {
124
- readonly points: readonly {
125
- readonly x: number;
126
- readonly y: number;
127
- }[];
128
- readonly tool: "draw" | "pencil" | "brush" | "marker" | "laser";
129
- /** Optional stroke style mirrored from the local in-progress shape so the
130
- * preview width/color/opacity matches the eventual committed item. */
131
- readonly strokeWidth?: number;
132
- readonly stroke?: string;
133
- readonly strokeOpacity?: number;
134
- };
135
- type RemotePresenceCamera = {
136
- readonly x: number;
137
- readonly y: number;
138
- readonly zoom: number;
139
- readonly viewportWidth: number;
140
- readonly viewportHeight: number;
141
- };
142
- /**
143
- * One connected participant. Your WebSocket layer maps server messages → this shape;
144
- * {@link VectorViewport} renders it in world space.
145
- */
146
- type RemotePresencePeer = {
147
- readonly id: string;
148
- /** Stable color for cursor + stroke (e.g. `#2563eb`). If omitted, a hue is derived from `id`. */
149
- readonly color?: string;
150
- /** Short display name near the cursor. */
151
- readonly displayName?: string;
152
- /** Optional profile image / avatar URL for richer collaboration UIs. */
153
- readonly image?: string;
154
- /** Last known pointer position in **world** units, or `null` if off-canvas / idle. */
155
- readonly cursor: {
156
- readonly x: number;
157
- readonly y: number;
158
- } | null;
159
- /** Optional live stroke while the peer is drawing (same semantics as local placement preview). */
160
- readonly markupStroke?: RemotePresenceMarkupStroke | null;
161
- /** Optional live camera snapshot for richer collaboration UIs. */
162
- readonly camera?: RemotePresenceCamera | null;
163
- /** Connection-scoped id when collaboration is backed by a realtime session. */
164
- readonly clientId?: string;
165
- /** Stable participant identity when collaboration is backed by a realtime session. */
166
- readonly peerId?: string;
167
- /** Room/session id when provided by the collaboration transport. */
168
- readonly roomId?: string;
169
- /** Lifecycle timestamps in epoch milliseconds. */
170
- readonly joinedAt?: number;
171
- readonly lastSeenAt?: number;
172
- /** Distinguishes the local participant from remote peers. */
173
- readonly isSelf?: boolean;
174
- /** Optional active tool hint for richer presence UIs. */
175
- readonly activeTool?: string;
176
- /** Session-level connection state, useful for richer rosters. */
177
- readonly connectionState?: RealtimeConnectionState;
178
- };
179
- type PresenceOverlayRenderContext = {
180
- camera: Camera2D;
181
- /** Bumps when the camera changes so overlays stay aligned with the scene. */
182
- cameraVersion: number;
183
- };
184
-
185
120
  type ActiveToolStyle = StrokeStyle & {
186
121
  toolKind: "draw" | "marker" | "text" | "rect" | "ellipse" | "architectural-cloud" | "line" | "arrow";
187
122
  label?: string;
@@ -494,4 +429,4 @@ declare function useCanvuResolvedTools(): VectorToolDefinition[];
494
429
  */
495
430
  declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
496
431
 
497
- export { type RemotePresencePeer as A, type BoardComponentPosition as B, type CanvasPlugin as C, type RemotePresenceCamera as D, type RealtimeConnectionState as E, type PresenceOverlayRenderContext as F, type PlacementPreview as P, type RemotePresenceMarkupStroke as R, type VectorToolDefinition as V, type WorldPointerDownDetail as W, VectorSelectionInspector as a, type CanvasPluginComponentProps as b, type CanvasPluginContribution as c, type CanvasPluginItemsChangeMiddlewareContext as d, type CanvasPluginRenderContext as e, type CanvuChromeActiveToolStyle as f, CanvuChromeContext as g, type CanvuChromeContextValue as h, type CanvuChromeSelectionStyleChange as i, CanvuPluginContext as j, type CanvuPluginContextValue as k, type CanvuPluginViewportSnapshot as l, type CustomShapePlacementOptions as m, type VectorCanvasSpacePosition as n, type VectorSelectionInspectorProps as o, VectorViewport as p, type VectorViewportHandle as q, type VectorViewportProps as r, createCanvuPlugin as s, getBoardPositionStyle as t, useCanvuChromeContext as u, useCanvuDocumentContext as v, useCanvuPluginContext as w, useCanvuPluginContribution as x, useCanvuResolvedTools as y, useCanvuViewportContext as z };
432
+ export { type BoardComponentPosition as B, type CanvasPlugin as C, type PlacementPreview as P, type VectorToolDefinition as V, type WorldPointerDownDetail as W, VectorSelectionInspector as a, type CanvasPluginComponentProps as b, type CanvasPluginContribution as c, type CanvasPluginItemsChangeMiddlewareContext as d, type CanvasPluginRenderContext as e, type CanvuChromeActiveToolStyle as f, CanvuChromeContext as g, type CanvuChromeContextValue as h, type CanvuChromeSelectionStyleChange as i, CanvuPluginContext as j, type CanvuPluginContextValue as k, type CanvuPluginViewportSnapshot as l, type CustomShapePlacementOptions as m, type VectorCanvasSpacePosition as n, type VectorSelectionInspectorProps as o, VectorViewport as p, type VectorViewportHandle as q, type VectorViewportProps as r, createCanvuPlugin as s, getBoardPositionStyle as t, useCanvuChromeContext as u, useCanvuDocumentContext as v, useCanvuPluginContext as w, useCanvuPluginContribution as x, useCanvuResolvedTools as y, useCanvuViewportContext as z };
@@ -3,6 +3,7 @@ import { CSSProperties, ReactNode, RefObject } from 'react';
3
3
  import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.cjs';
4
4
  import { S as StrokeStyle, C as Camera2D } from './shape-builders-CKEMjivV.cjs';
5
5
  import { C as CanvuLinkData, a as VectorViewportAssetStore } from './link-item-Dncuz2d_.cjs';
6
+ import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-BQUbxMgz.cjs';
6
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
8
 
8
9
  type CanvuChromeActiveToolStyle = StrokeStyle & {
@@ -116,72 +117,6 @@ type VectorToolDefinition = {
116
117
  ariaLabel?: string;
117
118
  };
118
119
 
119
- type RealtimeConnectionState = "connecting" | "connected" | "reconnecting" | "offline" | "error";
120
- /**
121
- * In-progress freehand stroke from a remote peer (before it becomes a committed `VectorSceneItem`).
122
- */
123
- type RemotePresenceMarkupStroke = {
124
- readonly points: readonly {
125
- readonly x: number;
126
- readonly y: number;
127
- }[];
128
- readonly tool: "draw" | "pencil" | "brush" | "marker" | "laser";
129
- /** Optional stroke style mirrored from the local in-progress shape so the
130
- * preview width/color/opacity matches the eventual committed item. */
131
- readonly strokeWidth?: number;
132
- readonly stroke?: string;
133
- readonly strokeOpacity?: number;
134
- };
135
- type RemotePresenceCamera = {
136
- readonly x: number;
137
- readonly y: number;
138
- readonly zoom: number;
139
- readonly viewportWidth: number;
140
- readonly viewportHeight: number;
141
- };
142
- /**
143
- * One connected participant. Your WebSocket layer maps server messages → this shape;
144
- * {@link VectorViewport} renders it in world space.
145
- */
146
- type RemotePresencePeer = {
147
- readonly id: string;
148
- /** Stable color for cursor + stroke (e.g. `#2563eb`). If omitted, a hue is derived from `id`. */
149
- readonly color?: string;
150
- /** Short display name near the cursor. */
151
- readonly displayName?: string;
152
- /** Optional profile image / avatar URL for richer collaboration UIs. */
153
- readonly image?: string;
154
- /** Last known pointer position in **world** units, or `null` if off-canvas / idle. */
155
- readonly cursor: {
156
- readonly x: number;
157
- readonly y: number;
158
- } | null;
159
- /** Optional live stroke while the peer is drawing (same semantics as local placement preview). */
160
- readonly markupStroke?: RemotePresenceMarkupStroke | null;
161
- /** Optional live camera snapshot for richer collaboration UIs. */
162
- readonly camera?: RemotePresenceCamera | null;
163
- /** Connection-scoped id when collaboration is backed by a realtime session. */
164
- readonly clientId?: string;
165
- /** Stable participant identity when collaboration is backed by a realtime session. */
166
- readonly peerId?: string;
167
- /** Room/session id when provided by the collaboration transport. */
168
- readonly roomId?: string;
169
- /** Lifecycle timestamps in epoch milliseconds. */
170
- readonly joinedAt?: number;
171
- readonly lastSeenAt?: number;
172
- /** Distinguishes the local participant from remote peers. */
173
- readonly isSelf?: boolean;
174
- /** Optional active tool hint for richer presence UIs. */
175
- readonly activeTool?: string;
176
- /** Session-level connection state, useful for richer rosters. */
177
- readonly connectionState?: RealtimeConnectionState;
178
- };
179
- type PresenceOverlayRenderContext = {
180
- camera: Camera2D;
181
- /** Bumps when the camera changes so overlays stay aligned with the scene. */
182
- cameraVersion: number;
183
- };
184
-
185
120
  type ActiveToolStyle = StrokeStyle & {
186
121
  toolKind: "draw" | "marker" | "text" | "rect" | "ellipse" | "architectural-cloud" | "line" | "arrow";
187
122
  label?: string;
@@ -494,4 +429,4 @@ declare function useCanvuResolvedTools(): VectorToolDefinition[];
494
429
  */
495
430
  declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
496
431
 
497
- export { type RemotePresencePeer as A, type BoardComponentPosition as B, type CanvasPlugin as C, type RemotePresenceCamera as D, type RealtimeConnectionState as E, type PresenceOverlayRenderContext as F, type PlacementPreview as P, type RemotePresenceMarkupStroke as R, type VectorToolDefinition as V, type WorldPointerDownDetail as W, VectorSelectionInspector as a, type CanvasPluginComponentProps as b, type CanvasPluginContribution as c, type CanvasPluginItemsChangeMiddlewareContext as d, type CanvasPluginRenderContext as e, type CanvuChromeActiveToolStyle as f, CanvuChromeContext as g, type CanvuChromeContextValue as h, type CanvuChromeSelectionStyleChange as i, CanvuPluginContext as j, type CanvuPluginContextValue as k, type CanvuPluginViewportSnapshot as l, type CustomShapePlacementOptions as m, type VectorCanvasSpacePosition as n, type VectorSelectionInspectorProps as o, VectorViewport as p, type VectorViewportHandle as q, type VectorViewportProps as r, createCanvuPlugin as s, getBoardPositionStyle as t, useCanvuChromeContext as u, useCanvuDocumentContext as v, useCanvuPluginContext as w, useCanvuPluginContribution as x, useCanvuResolvedTools as y, useCanvuViewportContext as z };
432
+ export { type BoardComponentPosition as B, type CanvasPlugin as C, type PlacementPreview as P, type VectorToolDefinition as V, type WorldPointerDownDetail as W, VectorSelectionInspector as a, type CanvasPluginComponentProps as b, type CanvasPluginContribution as c, type CanvasPluginItemsChangeMiddlewareContext as d, type CanvasPluginRenderContext as e, type CanvuChromeActiveToolStyle as f, CanvuChromeContext as g, type CanvuChromeContextValue as h, type CanvuChromeSelectionStyleChange as i, CanvuPluginContext as j, type CanvuPluginContextValue as k, type CanvuPluginViewportSnapshot as l, type CustomShapePlacementOptions as m, type VectorCanvasSpacePosition as n, type VectorSelectionInspectorProps as o, VectorViewport as p, type VectorViewportHandle as q, type VectorViewportProps as r, createCanvuPlugin as s, getBoardPositionStyle as t, useCanvuChromeContext as u, useCanvuDocumentContext as v, useCanvuPluginContext as w, useCanvuPluginContribution as x, useCanvuResolvedTools as y, useCanvuViewportContext as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvu-react",
3
- "version": "0.4.33",
3
+ "version": "0.4.34",
4
4
  "description": "Vector-first infinite canvas (SVG) with pan, zoom, React bindings, and optional plugins",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,6 +45,12 @@
45
45
  "import": "./dist/realtime.js",
46
46
  "require": "./dist/realtime.cjs"
47
47
  },
48
+ "./realtime": {
49
+ "react-native": "./dist/realtimeNative.js",
50
+ "types": "./dist/realtimeNative.d.ts",
51
+ "import": "./dist/realtimeNative.js",
52
+ "require": "./dist/realtimeNative.cjs"
53
+ },
48
54
  "./plugins/tldraw": {
49
55
  "react-native": "./dist/tldraw.js",
50
56
  "types": "./dist/tldraw.d.ts",