canvu-react 0.3.5

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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +156 -0
  3. package/dist/camera-BwQjm5oh.d.cts +50 -0
  4. package/dist/camera-KwCYYPhm.d.ts +50 -0
  5. package/dist/chatbot.cjs +221 -0
  6. package/dist/chatbot.cjs.map +1 -0
  7. package/dist/chatbot.d.cts +36 -0
  8. package/dist/chatbot.d.ts +36 -0
  9. package/dist/chatbot.js +218 -0
  10. package/dist/chatbot.js.map +1 -0
  11. package/dist/index.cjs +1920 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +276 -0
  14. package/dist/index.d.ts +276 -0
  15. package/dist/index.js +1867 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/native.cjs +2572 -0
  18. package/dist/native.cjs.map +1 -0
  19. package/dist/native.d.cts +217 -0
  20. package/dist/native.d.ts +217 -0
  21. package/dist/native.js +2562 -0
  22. package/dist/native.js.map +1 -0
  23. package/dist/react.cjs +8540 -0
  24. package/dist/react.cjs.map +1 -0
  25. package/dist/react.d.cts +481 -0
  26. package/dist/react.d.ts +481 -0
  27. package/dist/react.js +8492 -0
  28. package/dist/react.js.map +1 -0
  29. package/dist/realtime.cjs +2338 -0
  30. package/dist/realtime.cjs.map +1 -0
  31. package/dist/realtime.d.cts +309 -0
  32. package/dist/realtime.d.ts +309 -0
  33. package/dist/realtime.js +2317 -0
  34. package/dist/realtime.js.map +1 -0
  35. package/dist/shape-builders-DTYvub8W.d.ts +93 -0
  36. package/dist/shape-builders-DxPoOecg.d.cts +93 -0
  37. package/dist/tldraw.cjs +1948 -0
  38. package/dist/tldraw.cjs.map +1 -0
  39. package/dist/tldraw.d.cts +98 -0
  40. package/dist/tldraw.d.ts +98 -0
  41. package/dist/tldraw.js +1941 -0
  42. package/dist/tldraw.js.map +1 -0
  43. package/dist/types--ALu1mF-.d.ts +356 -0
  44. package/dist/types-B58i5k-u.d.cts +35 -0
  45. package/dist/types-CB0TZZuk.d.cts +157 -0
  46. package/dist/types-CB0TZZuk.d.ts +157 -0
  47. package/dist/types-D1ftVsOQ.d.cts +356 -0
  48. package/dist/types-DgEArHkA.d.ts +35 -0
  49. package/package.json +103 -0
@@ -0,0 +1,93 @@
1
+ import { V as VectorSceneItem, L as LineEndpointsLocal, b as VectorPathPoint, R as Rect, a as ArrowBindings } from './types-CB0TZZuk.cjs';
2
+
3
+ /** Resolved stroke for SVG generation. */
4
+ type StrokeStyle = {
5
+ stroke: string;
6
+ strokeWidth: number;
7
+ strokeOpacity?: number;
8
+ };
9
+ declare const DEFAULT_STROKE_STYLE: StrokeStyle;
10
+ declare function resolveStrokeStyle(item: VectorSceneItem): StrokeStyle;
11
+ declare function buildRectSvg(width: number, height: number, style?: StrokeStyle): string;
12
+ declare function buildEllipseSvg(width: number, height: number, style?: StrokeStyle): string;
13
+ declare function buildLineSvg(line: LineEndpointsLocal, style?: StrokeStyle): string;
14
+ declare function buildArrowSvg(itemId: string, line: LineEndpointsLocal, style?: StrokeStyle): string;
15
+ declare function buildDrawDotSvg(r: number, style?: StrokeStyle): string;
16
+ /** Structured result for React overlays; scene uses {@link buildFreehandPathSvg} string. */
17
+ type FreehandSvgPayload = {
18
+ kind: "circle";
19
+ cx: number;
20
+ cy: number;
21
+ r: number;
22
+ fill: string;
23
+ fillOpacity?: number;
24
+ } | {
25
+ kind: "fillPath";
26
+ d: string;
27
+ fill: string;
28
+ fillOpacity?: number;
29
+ } | {
30
+ kind: "strokePath";
31
+ d: string;
32
+ stroke: string;
33
+ strokeWidth: number;
34
+ strokeOpacity?: number;
35
+ };
36
+ /**
37
+ * Computes freehand geometry (perfect-freehand + fallback). Used by {@link buildFreehandPathSvg}
38
+ * and React overlays without `dangerouslySetInnerHTML`.
39
+ */
40
+ declare function computeFreehandSvgPayload(pathPointsLocal: readonly VectorPathPoint[], style: StrokeStyle, toolKind: "draw" | "pencil" | "brush" | "marker", strokeComplete?: boolean): FreehandSvgPayload | null;
41
+ /**
42
+ * Freehand stroke in local coordinates using [perfect-freehand](https://github.com/steveruizok/perfect-freehand)
43
+ * (filled outline, tapered caps — similar spirit to tldraw / Excalidraw ink).
44
+ */
45
+ declare function buildFreehandPathSvg(pathPointsLocal: readonly {
46
+ x: number;
47
+ y: number;
48
+ }[], style: StrokeStyle, toolKind: "draw" | "pencil" | "brush" | "marker", strokeComplete?: boolean): string;
49
+ /**
50
+ * Creates a new unique id for a shape (for `VectorSceneItem.id` when adding from code or API).
51
+ */
52
+ declare function createShapeId(): string;
53
+ /**
54
+ * Converts line segment endpoints from **world** coordinates to **local** coordinates
55
+ * (origin = top-left of `bounds`). Use with {@link createLineItem}.
56
+ */
57
+ declare function lineEndpointsToLocal(bounds: Rect, worldEndA: {
58
+ x: number;
59
+ y: number;
60
+ }, worldEndB: {
61
+ x: number;
62
+ y: number;
63
+ }): LineEndpointsLocal;
64
+ /**
65
+ * Rebuilds the SVG fragment (`childrenSvg`) from geometry + stroke fields (after edits or resize).
66
+ */
67
+ declare function rebuildItemSvg(item: VectorSceneItem): VectorSceneItem;
68
+ /** Updates stroke color / width / opacity and refreshes the item’s SVG. */
69
+ declare function applyStrokeToItem(item: VectorSceneItem, patch: Partial<Pick<VectorSceneItem, "stroke" | "strokeWidth" | "strokeOpacity">>): VectorSceneItem;
70
+ /** Creates a rectangle shape ready to append to your scene `items` array. */
71
+ declare function createRectangleItem(id: string, bounds: Rect, style?: Partial<StrokeStyle>): VectorSceneItem;
72
+ /** Creates an ellipse shape. */
73
+ declare function createEllipseItem(id: string, bounds: Rect, style?: Partial<StrokeStyle>): VectorSceneItem;
74
+ /** Creates a straight line or arrow; `line` is usually from {@link lineEndpointsToLocal}. */
75
+ declare function createLineItem(id: string, bounds: Rect, line: LineEndpointsLocal, toolKind: "line" | "arrow", style?: Partial<StrokeStyle>, arrowBind?: ArrowBindings): VectorSceneItem;
76
+ /** “Draw dot” tool: a small filled circle at (`worldX`, `worldY`). */
77
+ declare function createDrawDotItem(id: string, worldX: number, worldY: number, radius: number, style?: Partial<StrokeStyle>): VectorSceneItem;
78
+ /** Creates an editable text box (`stroke` is used as text fill). */
79
+ declare function createTextItem(id: string, bounds: Rect, text?: string, style?: Partial<StrokeStyle>): VectorSceneItem;
80
+ /** Freehand stroke from world-space points (main pen or marker highlight). */
81
+ declare function createFreehandStrokeItem(id: string, pointsWorld: readonly VectorPathPoint[], toolKind: "draw" | "marker", style?: Partial<StrokeStyle>): VectorSceneItem | null;
82
+ /** Places a bitmap (e.g. `data:image/png;base64,...`) inside `bounds`. */
83
+ declare function createImageItem(id: string, bounds: Rect, imageRasterHref: string, imageIntrinsicSize: {
84
+ width: number;
85
+ height: number;
86
+ }): VectorSceneItem;
87
+ /** @internal Legacy traced path content — prefer {@link createImageItem} with a raster data URL. */
88
+ declare function createImageFromVectorTrace(id: string, bounds: Rect, imageVectorInnerSvg: string, imageVectorLocalSize: {
89
+ width: number;
90
+ height: number;
91
+ }): VectorSceneItem;
92
+
93
+ export { DEFAULT_STROKE_STYLE as D, type FreehandSvgPayload as F, type StrokeStyle as S, applyStrokeToItem as a, buildArrowSvg as b, buildDrawDotSvg as c, buildEllipseSvg as d, buildFreehandPathSvg as e, buildLineSvg as f, buildRectSvg as g, computeFreehandSvgPayload as h, createDrawDotItem as i, createEllipseItem as j, createFreehandStrokeItem as k, createImageFromVectorTrace as l, createImageItem as m, createLineItem as n, createRectangleItem as o, createShapeId as p, createTextItem as q, lineEndpointsToLocal as r, rebuildItemSvg as s, resolveStrokeStyle as t };