canvu-react 0.4.13 → 0.4.15

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/dist/native.d.cts CHANGED
@@ -1,10 +1,16 @@
1
- import { C as Camera2D } from './shape-builders-CKEMjivV.cjs';
1
+ import { C as Camera2D, S as StrokeStyle } from './shape-builders-CKEMjivV.cjs';
2
2
  export { o as createFreehandStrokeItem, q as createImageItem, t as createShapeId } from './shape-builders-CKEMjivV.cjs';
3
3
  import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.cjs';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { StyleProp, ViewStyle, TextStyle } from 'react-native';
5
6
  import * as react from 'react';
6
7
  import { ReactNode } from 'react';
7
- import { StyleProp, ViewStyle, TextStyle } from 'react-native';
8
+
9
+ type TimedTrailPoint = {
10
+ readonly x: number;
11
+ readonly y: number;
12
+ readonly t: number;
13
+ };
8
14
 
9
15
  type PlacementPreview = {
10
16
  readonly kind: "rect" | "ellipse" | "architectural-cloud";
@@ -34,11 +40,12 @@ type PlacementPreview = {
34
40
  };
35
41
  } | {
36
42
  readonly kind: "stroke";
37
- readonly tool: string;
43
+ readonly tool: "draw" | "marker" | "laser";
38
44
  readonly points: readonly {
39
45
  readonly x: number;
40
46
  readonly y: number;
41
47
  }[];
48
+ readonly style?: StrokeStyle;
42
49
  };
43
50
  type NativeInteractionOverlayProps = {
44
51
  readonly camera: Camera2D;
@@ -47,17 +54,12 @@ type NativeInteractionOverlayProps = {
47
54
  readonly selectedItems: readonly VectorSceneItem[];
48
55
  readonly showResizeHandles: boolean;
49
56
  readonly placementPreview: PlacementPreview | null;
50
- readonly eraserTrail?: readonly {
51
- readonly x: number;
52
- readonly y: number;
53
- }[];
54
- readonly laserTrail?: readonly {
55
- readonly x: number;
56
- readonly y: number;
57
- }[];
57
+ readonly eraserTrail?: readonly TimedTrailPoint[];
58
+ readonly laserTrail?: readonly TimedTrailPoint[];
58
59
  readonly eraserPreviewItems?: readonly VectorSceneItem[];
60
+ readonly previewStrokeStyle?: StrokeStyle;
59
61
  };
60
- declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
62
+ declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, previewStrokeStyle, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
61
63
 
62
64
  type NativeSceneRendererProps = {
63
65
  readonly items: readonly VectorSceneItem[];
@@ -72,6 +74,15 @@ type NativeShapeRendererProps = {
72
74
  };
73
75
  declare function NativeShapeRenderer({ item }: NativeShapeRendererProps): react_jsx_runtime.JSX.Element | null;
74
76
 
77
+ type NativeVectorStyleToolId = "draw" | "marker";
78
+ type NativeVectorStyleInspectorProps = {
79
+ readonly toolId: NativeVectorStyleToolId;
80
+ readonly value: StrokeStyle;
81
+ readonly onChange: (patch: Partial<StrokeStyle>) => void;
82
+ readonly style?: StyleProp<ViewStyle>;
83
+ };
84
+ declare function NativeVectorStyleInspector({ toolId, value, onChange, style, }: NativeVectorStyleInspectorProps): react_jsx_runtime.JSX.Element;
85
+
75
86
  /**
76
87
  * Describes a single tool button rendered by {@link NativeVectorToolbar}.
77
88
  *
@@ -196,9 +207,19 @@ type NativeVectorViewportProps = {
196
207
  readonly onToolChangeRequest?: (toolId: string) => void;
197
208
  readonly onCameraChange?: () => void;
198
209
  readonly toolbar?: React.ReactNode;
210
+ readonly showStyleInspector?: boolean;
211
+ readonly styleInspectorPlacement?: "bottom" | "top-left";
199
212
  };
200
213
  declare const NativeVectorViewport: react.ForwardRefExoticComponent<NativeVectorViewportProps & react.RefAttributes<NativeVectorViewportHandle>>;
201
214
 
215
+ type NativeStyleColor = {
216
+ readonly name: string;
217
+ readonly hex: string;
218
+ };
219
+ declare const NATIVE_STYLE_PALETTE: readonly NativeStyleColor[];
220
+ declare function normalizeNativeStyleHex(stroke: string | undefined): string;
221
+ declare function nativeStyleColorWithOpacity(hex: string, opacity: number | undefined): string;
222
+
202
223
  type NumberProp = string | number;
203
224
  type SvgRectNode = {
204
225
  readonly kind: "rect";
@@ -321,4 +342,4 @@ type SvgNode = SvgRectNode | SvgEllipseNode | SvgCircleNode | SvgLineNode | SvgP
321
342
  */
322
343
  declare function parseSvgFragment(xml: string): SvgNode[];
323
344
 
324
- export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NativeInteractionOverlay, type NativeInteractionOverlayProps, NativeSceneRenderer, type NativeSceneRendererProps, NativeShapeRenderer, type NativeShapeRendererProps, type NativeVectorToolDefinition, NativeVectorToolbar, type NativeVectorToolbarDensity, type NativeVectorToolbarProps, type NativeVectorToolbarRenderOverflowInput, type NativeVectorToolbarRenderToolInput, type NativeVectorToolbarRenderToolLockInput, NativeVectorViewport, type NativeVectorViewportHandle, type NativeVectorViewportProps, type PlacementPreview, type SvgNode, VectorSceneItem, parseSvgFragment };
345
+ export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, NativeInteractionOverlay, type NativeInteractionOverlayProps, NativeSceneRenderer, type NativeSceneRendererProps, NativeShapeRenderer, type NativeShapeRendererProps, type NativeStyleColor, NativeVectorStyleInspector, type NativeVectorStyleInspectorProps, type NativeVectorStyleToolId, type NativeVectorToolDefinition, NativeVectorToolbar, type NativeVectorToolbarDensity, type NativeVectorToolbarProps, type NativeVectorToolbarRenderOverflowInput, type NativeVectorToolbarRenderToolInput, type NativeVectorToolbarRenderToolLockInput, NativeVectorViewport, type NativeVectorViewportHandle, type NativeVectorViewportProps, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
package/dist/native.d.ts CHANGED
@@ -1,10 +1,16 @@
1
- import { C as Camera2D } from './shape-builders-Cyh8zvDG.js';
1
+ import { C as Camera2D, S as StrokeStyle } from './shape-builders-Cyh8zvDG.js';
2
2
  export { o as createFreehandStrokeItem, q as createImageItem, t as createShapeId } from './shape-builders-Cyh8zvDG.js';
3
3
  import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { StyleProp, ViewStyle, TextStyle } from 'react-native';
5
6
  import * as react from 'react';
6
7
  import { ReactNode } from 'react';
7
- import { StyleProp, ViewStyle, TextStyle } from 'react-native';
8
+
9
+ type TimedTrailPoint = {
10
+ readonly x: number;
11
+ readonly y: number;
12
+ readonly t: number;
13
+ };
8
14
 
9
15
  type PlacementPreview = {
10
16
  readonly kind: "rect" | "ellipse" | "architectural-cloud";
@@ -34,11 +40,12 @@ type PlacementPreview = {
34
40
  };
35
41
  } | {
36
42
  readonly kind: "stroke";
37
- readonly tool: string;
43
+ readonly tool: "draw" | "marker" | "laser";
38
44
  readonly points: readonly {
39
45
  readonly x: number;
40
46
  readonly y: number;
41
47
  }[];
48
+ readonly style?: StrokeStyle;
42
49
  };
43
50
  type NativeInteractionOverlayProps = {
44
51
  readonly camera: Camera2D;
@@ -47,17 +54,12 @@ type NativeInteractionOverlayProps = {
47
54
  readonly selectedItems: readonly VectorSceneItem[];
48
55
  readonly showResizeHandles: boolean;
49
56
  readonly placementPreview: PlacementPreview | null;
50
- readonly eraserTrail?: readonly {
51
- readonly x: number;
52
- readonly y: number;
53
- }[];
54
- readonly laserTrail?: readonly {
55
- readonly x: number;
56
- readonly y: number;
57
- }[];
57
+ readonly eraserTrail?: readonly TimedTrailPoint[];
58
+ readonly laserTrail?: readonly TimedTrailPoint[];
58
59
  readonly eraserPreviewItems?: readonly VectorSceneItem[];
60
+ readonly previewStrokeStyle?: StrokeStyle;
59
61
  };
60
- declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
62
+ declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, previewStrokeStyle, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
61
63
 
62
64
  type NativeSceneRendererProps = {
63
65
  readonly items: readonly VectorSceneItem[];
@@ -72,6 +74,15 @@ type NativeShapeRendererProps = {
72
74
  };
73
75
  declare function NativeShapeRenderer({ item }: NativeShapeRendererProps): react_jsx_runtime.JSX.Element | null;
74
76
 
77
+ type NativeVectorStyleToolId = "draw" | "marker";
78
+ type NativeVectorStyleInspectorProps = {
79
+ readonly toolId: NativeVectorStyleToolId;
80
+ readonly value: StrokeStyle;
81
+ readonly onChange: (patch: Partial<StrokeStyle>) => void;
82
+ readonly style?: StyleProp<ViewStyle>;
83
+ };
84
+ declare function NativeVectorStyleInspector({ toolId, value, onChange, style, }: NativeVectorStyleInspectorProps): react_jsx_runtime.JSX.Element;
85
+
75
86
  /**
76
87
  * Describes a single tool button rendered by {@link NativeVectorToolbar}.
77
88
  *
@@ -196,9 +207,19 @@ type NativeVectorViewportProps = {
196
207
  readonly onToolChangeRequest?: (toolId: string) => void;
197
208
  readonly onCameraChange?: () => void;
198
209
  readonly toolbar?: React.ReactNode;
210
+ readonly showStyleInspector?: boolean;
211
+ readonly styleInspectorPlacement?: "bottom" | "top-left";
199
212
  };
200
213
  declare const NativeVectorViewport: react.ForwardRefExoticComponent<NativeVectorViewportProps & react.RefAttributes<NativeVectorViewportHandle>>;
201
214
 
215
+ type NativeStyleColor = {
216
+ readonly name: string;
217
+ readonly hex: string;
218
+ };
219
+ declare const NATIVE_STYLE_PALETTE: readonly NativeStyleColor[];
220
+ declare function normalizeNativeStyleHex(stroke: string | undefined): string;
221
+ declare function nativeStyleColorWithOpacity(hex: string, opacity: number | undefined): string;
222
+
202
223
  type NumberProp = string | number;
203
224
  type SvgRectNode = {
204
225
  readonly kind: "rect";
@@ -321,4 +342,4 @@ type SvgNode = SvgRectNode | SvgEllipseNode | SvgCircleNode | SvgLineNode | SvgP
321
342
  */
322
343
  declare function parseSvgFragment(xml: string): SvgNode[];
323
344
 
324
- export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NativeInteractionOverlay, type NativeInteractionOverlayProps, NativeSceneRenderer, type NativeSceneRendererProps, NativeShapeRenderer, type NativeShapeRendererProps, type NativeVectorToolDefinition, NativeVectorToolbar, type NativeVectorToolbarDensity, type NativeVectorToolbarProps, type NativeVectorToolbarRenderOverflowInput, type NativeVectorToolbarRenderToolInput, type NativeVectorToolbarRenderToolLockInput, NativeVectorViewport, type NativeVectorViewportHandle, type NativeVectorViewportProps, type PlacementPreview, type SvgNode, VectorSceneItem, parseSvgFragment };
345
+ export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, NativeInteractionOverlay, type NativeInteractionOverlayProps, NativeSceneRenderer, type NativeSceneRendererProps, NativeShapeRenderer, type NativeShapeRendererProps, type NativeStyleColor, NativeVectorStyleInspector, type NativeVectorStyleInspectorProps, type NativeVectorStyleToolId, type NativeVectorToolDefinition, NativeVectorToolbar, type NativeVectorToolbarDensity, type NativeVectorToolbarProps, type NativeVectorToolbarRenderOverflowInput, type NativeVectorToolbarRenderToolInput, type NativeVectorToolbarRenderToolLockInput, NativeVectorViewport, type NativeVectorViewportHandle, type NativeVectorViewportProps, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };