canvu-react 0.4.61 → 0.4.62

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
@@ -247,9 +247,6 @@ type NativeRemotePresenceHit = {
247
247
  readonly peerId?: string;
248
248
  };
249
249
 
250
- type NativeVectorStyleInspectorPlacement = "bottom" | "top-left";
251
- type NativeVectorStyleInspectorOverlayStyle = StyleProp<ViewStyle>;
252
-
253
250
  type NativeCustomShapePlacementOptions = {
254
251
  readonly toolId: string;
255
252
  readonly createItem: (args: {
@@ -388,17 +385,43 @@ type NativeVectorViewportProps = {
388
385
  readonly overlay?: React.ReactNode;
389
386
  readonly toolbar?: React.ReactNode;
390
387
  readonly showStyleInspector?: boolean;
391
- readonly styleInspectorPlacement?: NativeVectorStyleInspectorPlacement;
392
- /**
393
- * Overrides the outer container style used to position the native style inspector.
394
- *
395
- * Use this when your app overlays custom headers, footers, or safe-area chrome
396
- * above the canvas and needs to move the inspector away from those controls.
397
- */
398
- readonly styleInspectorOverlayStyle?: NativeVectorStyleInspectorOverlayStyle;
388
+ readonly styleInspectorPlacement?: "bottom" | "top-left";
399
389
  };
400
390
  declare const NativeVectorViewport: react.ForwardRefExoticComponent<NativeVectorViewportProps & react.RefAttributes<NativeVectorViewportHandle>>;
401
391
 
392
+ type NativeVectorZoomControlsLabels = {
393
+ readonly zoomOut?: string;
394
+ readonly zoomIn?: string;
395
+ };
396
+ type NativeVectorZoomControlsProps = {
397
+ readonly zoomPercent: number;
398
+ readonly onZoomOut: () => void;
399
+ readonly onZoomIn: () => void;
400
+ readonly labels?: NativeVectorZoomControlsLabels;
401
+ readonly disabled?: boolean;
402
+ readonly style?: StyleProp<ViewStyle>;
403
+ readonly buttonStyle?: StyleProp<ViewStyle>;
404
+ readonly iconStyle?: StyleProp<TextStyle>;
405
+ readonly labelStyle?: StyleProp<TextStyle>;
406
+ };
407
+ /**
408
+ * Native zoom-out, percentage, and zoom-in control for apps that compose
409
+ * {@link NativeVectorViewport} with their own floating chrome.
410
+ *
411
+ * Canvu owns the visual control and accessibility defaults; the consuming app
412
+ * should own placement, visibility, and camera wiring.
413
+ *
414
+ * @example
415
+ * ```tsx
416
+ * <NativeVectorZoomControls
417
+ * zoomPercent={Math.round(camera.zoom * 100)}
418
+ * onZoomOut={() => camera.setZoom(camera.zoom / 1.2)}
419
+ * onZoomIn={() => camera.setZoom(camera.zoom * 1.2)}
420
+ * />
421
+ * ```
422
+ */
423
+ declare function NativeVectorZoomControls({ zoomPercent, onZoomOut, onZoomIn, labels, disabled, style, buttonStyle, iconStyle, labelStyle, }: NativeVectorZoomControlsProps): react_jsx_runtime.JSX.Element;
424
+
402
425
  type NativeStyleColor = {
403
426
  readonly name: string;
404
427
  readonly hex: string;
@@ -530,4 +553,4 @@ type SvgNode = SvgRectNode | SvgEllipseNode | SvgCircleNode | SvgLineNode | SvgP
530
553
  */
531
554
  declare function parseSvgFragment(xml: string): SvgNode[];
532
555
 
533
- export { CanvuLinkData, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, type NativeCustomShapePlacementOptions, NativeImagesMenu, type NativeImagesMenuLabels, type NativeImagesMenuProps, NativeInteractionOverlay, type NativeInteractionOverlayProps, type NativeLinkToolDialogLabels, type NativeLinkToolInsertOptions, type NativeLinkToolRequestDetail, type NativeRemotePresencePressDetail, 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 NativeWorldPointerDownDetail, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
556
+ export { CanvuLinkData, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, type NativeCustomShapePlacementOptions, NativeImagesMenu, type NativeImagesMenuLabels, type NativeImagesMenuProps, NativeInteractionOverlay, type NativeInteractionOverlayProps, type NativeLinkToolDialogLabels, type NativeLinkToolInsertOptions, type NativeLinkToolRequestDetail, type NativeRemotePresencePressDetail, 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, NativeVectorZoomControls, type NativeVectorZoomControlsLabels, type NativeVectorZoomControlsProps, type NativeWorldPointerDownDetail, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
package/dist/native.d.ts CHANGED
@@ -247,9 +247,6 @@ type NativeRemotePresenceHit = {
247
247
  readonly peerId?: string;
248
248
  };
249
249
 
250
- type NativeVectorStyleInspectorPlacement = "bottom" | "top-left";
251
- type NativeVectorStyleInspectorOverlayStyle = StyleProp<ViewStyle>;
252
-
253
250
  type NativeCustomShapePlacementOptions = {
254
251
  readonly toolId: string;
255
252
  readonly createItem: (args: {
@@ -388,17 +385,43 @@ type NativeVectorViewportProps = {
388
385
  readonly overlay?: React.ReactNode;
389
386
  readonly toolbar?: React.ReactNode;
390
387
  readonly showStyleInspector?: boolean;
391
- readonly styleInspectorPlacement?: NativeVectorStyleInspectorPlacement;
392
- /**
393
- * Overrides the outer container style used to position the native style inspector.
394
- *
395
- * Use this when your app overlays custom headers, footers, or safe-area chrome
396
- * above the canvas and needs to move the inspector away from those controls.
397
- */
398
- readonly styleInspectorOverlayStyle?: NativeVectorStyleInspectorOverlayStyle;
388
+ readonly styleInspectorPlacement?: "bottom" | "top-left";
399
389
  };
400
390
  declare const NativeVectorViewport: react.ForwardRefExoticComponent<NativeVectorViewportProps & react.RefAttributes<NativeVectorViewportHandle>>;
401
391
 
392
+ type NativeVectorZoomControlsLabels = {
393
+ readonly zoomOut?: string;
394
+ readonly zoomIn?: string;
395
+ };
396
+ type NativeVectorZoomControlsProps = {
397
+ readonly zoomPercent: number;
398
+ readonly onZoomOut: () => void;
399
+ readonly onZoomIn: () => void;
400
+ readonly labels?: NativeVectorZoomControlsLabels;
401
+ readonly disabled?: boolean;
402
+ readonly style?: StyleProp<ViewStyle>;
403
+ readonly buttonStyle?: StyleProp<ViewStyle>;
404
+ readonly iconStyle?: StyleProp<TextStyle>;
405
+ readonly labelStyle?: StyleProp<TextStyle>;
406
+ };
407
+ /**
408
+ * Native zoom-out, percentage, and zoom-in control for apps that compose
409
+ * {@link NativeVectorViewport} with their own floating chrome.
410
+ *
411
+ * Canvu owns the visual control and accessibility defaults; the consuming app
412
+ * should own placement, visibility, and camera wiring.
413
+ *
414
+ * @example
415
+ * ```tsx
416
+ * <NativeVectorZoomControls
417
+ * zoomPercent={Math.round(camera.zoom * 100)}
418
+ * onZoomOut={() => camera.setZoom(camera.zoom / 1.2)}
419
+ * onZoomIn={() => camera.setZoom(camera.zoom * 1.2)}
420
+ * />
421
+ * ```
422
+ */
423
+ declare function NativeVectorZoomControls({ zoomPercent, onZoomOut, onZoomIn, labels, disabled, style, buttonStyle, iconStyle, labelStyle, }: NativeVectorZoomControlsProps): react_jsx_runtime.JSX.Element;
424
+
402
425
  type NativeStyleColor = {
403
426
  readonly name: string;
404
427
  readonly hex: string;
@@ -530,4 +553,4 @@ type SvgNode = SvgRectNode | SvgEllipseNode | SvgCircleNode | SvgLineNode | SvgP
530
553
  */
531
554
  declare function parseSvgFragment(xml: string): SvgNode[];
532
555
 
533
- export { CanvuLinkData, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, type NativeCustomShapePlacementOptions, NativeImagesMenu, type NativeImagesMenuLabels, type NativeImagesMenuProps, NativeInteractionOverlay, type NativeInteractionOverlayProps, type NativeLinkToolDialogLabels, type NativeLinkToolInsertOptions, type NativeLinkToolRequestDetail, type NativeRemotePresencePressDetail, 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 NativeWorldPointerDownDetail, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
556
+ export { CanvuLinkData, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, type NativeCustomShapePlacementOptions, NativeImagesMenu, type NativeImagesMenuLabels, type NativeImagesMenuProps, NativeInteractionOverlay, type NativeInteractionOverlayProps, type NativeLinkToolDialogLabels, type NativeLinkToolInsertOptions, type NativeLinkToolRequestDetail, type NativeRemotePresencePressDetail, 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, NativeVectorZoomControls, type NativeVectorZoomControlsLabels, type NativeVectorZoomControlsProps, type NativeWorldPointerDownDetail, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
package/dist/native.js CHANGED
@@ -5368,35 +5368,6 @@ function duplicateNativeSelectedShapes(input) {
5368
5368
  });
5369
5369
  }
5370
5370
 
5371
- // src/native/native-style-inspector-overlay.ts
5372
- function resolveNativeStyleInspectorOverlayStyle({
5373
- placement,
5374
- overlayElevation,
5375
- overlayStyle,
5376
- overlayZIndex
5377
- }) {
5378
- const placementStyle = placement === "top-left" ? {
5379
- position: "absolute",
5380
- left: 16,
5381
- top: 104,
5382
- alignItems: "flex-start"
5383
- } : {
5384
- position: "absolute",
5385
- left: 16,
5386
- right: 16,
5387
- bottom: 84,
5388
- alignItems: "center"
5389
- };
5390
- return [
5391
- placementStyle,
5392
- {
5393
- zIndex: overlayZIndex,
5394
- elevation: overlayElevation
5395
- },
5396
- overlayStyle
5397
- ];
5398
- }
5399
-
5400
5371
  // src/native/native-transient-items.ts
5401
5372
  function moveNativeTransientItems({
5402
5373
  items,
@@ -5693,8 +5664,7 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
5693
5664
  overlay,
5694
5665
  toolbar,
5695
5666
  showStyleInspector = false,
5696
- styleInspectorPlacement = "bottom",
5697
- styleInspectorOverlayStyle
5667
+ styleInspectorPlacement = "bottom"
5698
5668
  }, ref) {
5699
5669
  const [size, setSize] = useState({ width: 0, height: 0 });
5700
5670
  const cameraRef = useRef(null);
@@ -6928,12 +6898,22 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
6928
6898
  View,
6929
6899
  {
6930
6900
  pointerEvents: "box-none",
6931
- style: resolveNativeStyleInspectorOverlayStyle({
6932
- placement: styleInspectorPlacement,
6933
- overlayElevation: NATIVE_VIEWPORT_OVERLAY_ELEVATION,
6934
- overlayStyle: styleInspectorOverlayStyle,
6935
- overlayZIndex: NATIVE_VIEWPORT_OVERLAY_Z_INDEX
6936
- }),
6901
+ style: styleInspectorPlacement === "top-left" ? {
6902
+ position: "absolute",
6903
+ left: 16,
6904
+ top: 104,
6905
+ alignItems: "flex-start",
6906
+ zIndex: NATIVE_VIEWPORT_OVERLAY_Z_INDEX,
6907
+ elevation: NATIVE_VIEWPORT_OVERLAY_ELEVATION
6908
+ } : {
6909
+ position: "absolute",
6910
+ left: 16,
6911
+ right: 16,
6912
+ bottom: 84,
6913
+ alignItems: "center",
6914
+ zIndex: NATIVE_VIEWPORT_OVERLAY_Z_INDEX,
6915
+ elevation: NATIVE_VIEWPORT_OVERLAY_ELEVATION
6916
+ },
6937
6917
  children: /* @__PURE__ */ jsx(
6938
6918
  NativeVectorStyleInspector,
6939
6919
  {
@@ -7162,7 +7142,140 @@ var styles4 = StyleSheet.create({
7162
7142
  fontWeight: "700"
7163
7143
  }
7164
7144
  });
7145
+ var DEFAULT_NATIVE_VECTOR_ZOOM_CONTROLS_LABELS = {
7146
+ zoomOut: "Zoom out",
7147
+ zoomIn: "Zoom in"
7148
+ };
7149
+ function NativeVectorZoomControls({
7150
+ zoomPercent,
7151
+ onZoomOut,
7152
+ onZoomIn,
7153
+ labels,
7154
+ disabled = false,
7155
+ style,
7156
+ buttonStyle,
7157
+ iconStyle,
7158
+ labelStyle
7159
+ }) {
7160
+ const resolvedLabels = {
7161
+ ...DEFAULT_NATIVE_VECTOR_ZOOM_CONTROLS_LABELS,
7162
+ ...labels
7163
+ };
7164
+ return /* @__PURE__ */ jsxs(View, { style: [styles5.root, style], children: [
7165
+ /* @__PURE__ */ jsx(
7166
+ Pressable,
7167
+ {
7168
+ accessibilityRole: "button",
7169
+ accessibilityLabel: resolvedLabels.zoomOut,
7170
+ accessibilityState: { disabled },
7171
+ disabled,
7172
+ onPress: onZoomOut,
7173
+ style: ({ pressed }) => [
7174
+ styles5.button,
7175
+ pressed && !disabled ? styles5.buttonPressed : null,
7176
+ disabled ? styles5.buttonDisabled : null,
7177
+ buttonStyle
7178
+ ],
7179
+ children: /* @__PURE__ */ jsx(
7180
+ Text,
7181
+ {
7182
+ style: [styles5.icon, disabled ? styles5.disabledText : null, iconStyle],
7183
+ children: "-"
7184
+ }
7185
+ )
7186
+ }
7187
+ ),
7188
+ /* @__PURE__ */ jsx(View, { style: styles5.labelWrap, children: /* @__PURE__ */ jsxs(
7189
+ Text,
7190
+ {
7191
+ accessibilityRole: "text",
7192
+ style: [styles5.label, disabled ? styles5.disabledText : null, labelStyle],
7193
+ children: [
7194
+ zoomPercent,
7195
+ "%"
7196
+ ]
7197
+ }
7198
+ ) }),
7199
+ /* @__PURE__ */ jsx(
7200
+ Pressable,
7201
+ {
7202
+ accessibilityRole: "button",
7203
+ accessibilityLabel: resolvedLabels.zoomIn,
7204
+ accessibilityState: { disabled },
7205
+ disabled,
7206
+ onPress: onZoomIn,
7207
+ style: ({ pressed }) => [
7208
+ styles5.button,
7209
+ pressed && !disabled ? styles5.buttonPressed : null,
7210
+ disabled ? styles5.buttonDisabled : null,
7211
+ buttonStyle
7212
+ ],
7213
+ children: /* @__PURE__ */ jsx(
7214
+ Text,
7215
+ {
7216
+ style: [styles5.icon, disabled ? styles5.disabledText : null, iconStyle],
7217
+ children: "+"
7218
+ }
7219
+ )
7220
+ }
7221
+ )
7222
+ ] });
7223
+ }
7224
+ var styles5 = StyleSheet.create({
7225
+ root: {
7226
+ alignItems: "center",
7227
+ backgroundColor: "#ffffff",
7228
+ borderColor: "rgba(15, 23, 42, 0.12)",
7229
+ borderRadius: 18,
7230
+ borderWidth: 1,
7231
+ elevation: 4,
7232
+ flexDirection: "row",
7233
+ paddingHorizontal: 12,
7234
+ paddingVertical: 8,
7235
+ shadowColor: "#0f172a",
7236
+ shadowOffset: { width: 0, height: 1 },
7237
+ shadowOpacity: 0.16,
7238
+ shadowRadius: 3
7239
+ },
7240
+ button: {
7241
+ alignItems: "center",
7242
+ borderRadius: 12,
7243
+ height: 36,
7244
+ justifyContent: "center",
7245
+ width: 36
7246
+ },
7247
+ buttonPressed: {
7248
+ backgroundColor: "rgba(15, 23, 42, 0.08)"
7249
+ },
7250
+ buttonDisabled: {
7251
+ opacity: 0.54
7252
+ },
7253
+ icon: {
7254
+ color: "#0f172a",
7255
+ fontSize: 30,
7256
+ fontWeight: "400",
7257
+ includeFontPadding: false,
7258
+ lineHeight: 32,
7259
+ textAlign: "center"
7260
+ },
7261
+ labelWrap: {
7262
+ alignItems: "center",
7263
+ justifyContent: "center",
7264
+ minWidth: 64,
7265
+ paddingHorizontal: 8
7266
+ },
7267
+ label: {
7268
+ color: "#0f172a",
7269
+ fontSize: 16,
7270
+ fontWeight: "700",
7271
+ includeFontPadding: false,
7272
+ lineHeight: 20
7273
+ },
7274
+ disabledText: {
7275
+ color: "#64748b"
7276
+ }
7277
+ });
7165
7278
 
7166
- export { DEFAULT_LINK_CARD_SIZE, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, NativeImagesMenu, NativeInteractionOverlay, NativeSceneRenderer, NativeShapeRenderer, NativeVectorStyleInspector, NativeVectorToolbar, NativeVectorViewport, createFreehandStrokeItem, createImageItem, createLinkItem, createShapeId, getLinkData, isLinkItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
7279
+ export { DEFAULT_LINK_CARD_SIZE, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, NativeImagesMenu, NativeInteractionOverlay, NativeSceneRenderer, NativeShapeRenderer, NativeVectorStyleInspector, NativeVectorToolbar, NativeVectorViewport, NativeVectorZoomControls, createFreehandStrokeItem, createImageItem, createLinkItem, createShapeId, getLinkData, isLinkItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
7167
7280
  //# sourceMappingURL=native.js.map
7168
7281
  //# sourceMappingURL=native.js.map