canvu-react 0.4.39 → 0.4.40

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
@@ -296,6 +296,7 @@ type NativeVectorViewportProps = {
296
296
  readonly onCameraChange?: () => void;
297
297
  readonly customPlacement?: NativeCustomShapePlacementOptions;
298
298
  readonly customPlacements?: readonly NativeCustomShapePlacementOptions[];
299
+ readonly overlay?: React.ReactNode;
299
300
  readonly toolbar?: React.ReactNode;
300
301
  readonly showStyleInspector?: boolean;
301
302
  readonly styleInspectorPlacement?: "bottom" | "top-left";
package/dist/native.d.ts CHANGED
@@ -296,6 +296,7 @@ type NativeVectorViewportProps = {
296
296
  readonly onCameraChange?: () => void;
297
297
  readonly customPlacement?: NativeCustomShapePlacementOptions;
298
298
  readonly customPlacements?: readonly NativeCustomShapePlacementOptions[];
299
+ readonly overlay?: React.ReactNode;
299
300
  readonly toolbar?: React.ReactNode;
300
301
  readonly showStyleInspector?: boolean;
301
302
  readonly styleInspectorPlacement?: "bottom" | "top-left";
package/dist/native.js CHANGED
@@ -4687,6 +4687,8 @@ var MARKER_TOOL_STYLE = {
4687
4687
  strokeWidth: 16,
4688
4688
  strokeOpacity: 0.5
4689
4689
  };
4690
+ var NATIVE_VIEWPORT_OVERLAY_Z_INDEX = 40;
4691
+ var NATIVE_VIEWPORT_OVERLAY_ELEVATION = 40;
4690
4692
  function isPlacementTool(toolId) {
4691
4693
  return toolId === "rect" || toolId === "ellipse" || toolId === "architectural-cloud" || toolId === "line" || toolId === "arrow";
4692
4694
  }
@@ -4770,6 +4772,7 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
4770
4772
  onCameraChange,
4771
4773
  customPlacement,
4772
4774
  customPlacements = [],
4775
+ overlay,
4773
4776
  toolbar,
4774
4777
  showStyleInspector = false,
4775
4778
  styleInspectorPlacement = "bottom"
@@ -5701,153 +5704,161 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
5701
5704
  };
5702
5705
  const normalizedNativeLinkHref = normalizeNativeLinkHref(nativeLinkInputValue);
5703
5706
  const nativeLinkCanSubmit = pendingNativeLinkRequest !== null && normalizedNativeLinkHref !== null && onItemsChange != null;
5704
- return /* @__PURE__ */ jsxs(
5705
- View,
5706
- {
5707
- style: { flex: 1, overflow: "hidden" },
5708
- onLayout,
5709
- onPointerDown: handlePointerDown,
5710
- onPointerMove: handlePointerMove,
5711
- onPointerUp: handlePointerUp,
5712
- onPointerEnter: handlePointerMove,
5713
- onPointerLeave: () => {
5714
- hideToolCursor();
5715
- notifyWorldPointerLeave();
5716
- },
5717
- ...panResponder.panHandlers,
5718
- children: [
5719
- size.width > 0 && size.height > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5720
- /* @__PURE__ */ jsx(
5721
- NativeSceneRenderer,
5707
+ return /* @__PURE__ */ jsxs(View, { style: { flex: 1, overflow: "hidden" }, onLayout, children: [
5708
+ size.width > 0 && size.height > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
5709
+ /* @__PURE__ */ jsxs(
5710
+ View,
5711
+ {
5712
+ style: StyleSheet.absoluteFill,
5713
+ onPointerDown: handlePointerDown,
5714
+ onPointerMove: handlePointerMove,
5715
+ onPointerUp: handlePointerUp,
5716
+ onPointerEnter: handlePointerMove,
5717
+ onPointerLeave: () => {
5718
+ hideToolCursor();
5719
+ notifyWorldPointerLeave();
5720
+ },
5721
+ ...panResponder.panHandlers,
5722
+ children: [
5723
+ /* @__PURE__ */ jsx(
5724
+ NativeSceneRenderer,
5725
+ {
5726
+ items: sceneItems,
5727
+ camera,
5728
+ width: size.width,
5729
+ height: size.height
5730
+ }
5731
+ ),
5732
+ interactive && /* @__PURE__ */ jsx(
5733
+ NativeInteractionOverlay,
5734
+ {
5735
+ camera,
5736
+ width: size.width,
5737
+ height: size.height,
5738
+ selectedItems,
5739
+ showResizeHandles,
5740
+ placementPreview,
5741
+ laserTrail,
5742
+ eraserTrail,
5743
+ eraserPreviewItems: items.filter(
5744
+ (it) => eraserPreviewIds.includes(it.id)
5745
+ ),
5746
+ previewStrokeStyle: strokeStyleState,
5747
+ remotePresence
5748
+ }
5749
+ )
5750
+ ]
5751
+ }
5752
+ ),
5753
+ overlay ? /* @__PURE__ */ jsx(View, { pointerEvents: "box-none", style: StyleSheet.absoluteFill, children: overlay }) : null,
5754
+ interactive && showStyleInspector && activeStyleToolId ? /* @__PURE__ */ jsx(
5755
+ View,
5756
+ {
5757
+ pointerEvents: "box-none",
5758
+ style: styleInspectorPlacement === "top-left" ? {
5759
+ position: "absolute",
5760
+ left: 16,
5761
+ top: 104,
5762
+ alignItems: "flex-start",
5763
+ zIndex: NATIVE_VIEWPORT_OVERLAY_Z_INDEX,
5764
+ elevation: NATIVE_VIEWPORT_OVERLAY_ELEVATION
5765
+ } : {
5766
+ position: "absolute",
5767
+ left: 16,
5768
+ right: 16,
5769
+ bottom: 84,
5770
+ alignItems: "center",
5771
+ zIndex: NATIVE_VIEWPORT_OVERLAY_Z_INDEX,
5772
+ elevation: NATIVE_VIEWPORT_OVERLAY_ELEVATION
5773
+ },
5774
+ children: /* @__PURE__ */ jsx(
5775
+ NativeVectorStyleInspector,
5722
5776
  {
5723
- items: sceneItems,
5724
- camera,
5725
- width: size.width,
5726
- height: size.height
5777
+ toolId: activeStyleToolId,
5778
+ value: strokeStyleState,
5779
+ onChange: patchCurrentStrokeStyle
5727
5780
  }
5728
- ),
5729
- interactive && /* @__PURE__ */ jsx(
5730
- NativeInteractionOverlay,
5781
+ )
5782
+ }
5783
+ ) : null,
5784
+ toolbar && /* @__PURE__ */ jsx(
5785
+ View,
5786
+ {
5787
+ style: {
5788
+ position: "absolute",
5789
+ bottom: 16,
5790
+ left: 16,
5791
+ right: 16,
5792
+ flexDirection: "row",
5793
+ justifyContent: "center",
5794
+ alignItems: "center",
5795
+ zIndex: NATIVE_VIEWPORT_OVERLAY_Z_INDEX,
5796
+ elevation: NATIVE_VIEWPORT_OVERLAY_ELEVATION
5797
+ },
5798
+ pointerEvents: "box-none",
5799
+ children: toolbar
5800
+ }
5801
+ )
5802
+ ] }),
5803
+ /* @__PURE__ */ jsx(
5804
+ Modal,
5805
+ {
5806
+ animationType: "fade",
5807
+ transparent: true,
5808
+ visible: pendingNativeLinkRequest !== null,
5809
+ onRequestClose: closeNativeLinkDialog,
5810
+ children: /* @__PURE__ */ jsx(View, { style: styles3.nativeLinkDialogBackdrop, children: /* @__PURE__ */ jsxs(View, { style: styles3.nativeLinkDialogCard, children: [
5811
+ /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogTitle, children: nativeLinkDialogLabels.title }),
5812
+ /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogDescription, children: nativeLinkDialogLabels.description }),
5813
+ /* @__PURE__ */ jsx(
5814
+ TextInput,
5731
5815
  {
5732
- camera,
5733
- width: size.width,
5734
- height: size.height,
5735
- selectedItems,
5736
- showResizeHandles,
5737
- placementPreview,
5738
- laserTrail,
5739
- eraserTrail,
5740
- eraserPreviewItems: items.filter(
5741
- (it) => eraserPreviewIds.includes(it.id)
5742
- ),
5743
- previewStrokeStyle: strokeStyleState,
5744
- remotePresence
5816
+ accessibilityLabel: nativeLinkDialogLabels.title,
5817
+ autoCapitalize: "none",
5818
+ autoCorrect: false,
5819
+ keyboardType: "url",
5820
+ onChangeText: setNativeLinkInputValue,
5821
+ onSubmitEditing: submitNativeLinkDialog,
5822
+ placeholder: nativeLinkDialogLabels.inputPlaceholder,
5823
+ returnKeyType: "done",
5824
+ style: styles3.nativeLinkDialogInput,
5825
+ value: nativeLinkInputValue
5745
5826
  }
5746
5827
  ),
5747
- interactive && showStyleInspector && activeStyleToolId ? /* @__PURE__ */ jsx(
5748
- View,
5749
- {
5750
- pointerEvents: "box-none",
5751
- style: styleInspectorPlacement === "top-left" ? {
5752
- position: "absolute",
5753
- left: 16,
5754
- top: 104,
5755
- alignItems: "flex-start"
5756
- } : {
5757
- position: "absolute",
5758
- left: 16,
5759
- right: 16,
5760
- bottom: 84,
5761
- alignItems: "center"
5762
- },
5763
- children: /* @__PURE__ */ jsx(
5764
- NativeVectorStyleInspector,
5765
- {
5766
- toolId: activeStyleToolId,
5767
- value: strokeStyleState,
5768
- onChange: patchCurrentStrokeStyle
5769
- }
5770
- )
5771
- }
5772
- ) : null,
5773
- toolbar && /* @__PURE__ */ jsx(
5774
- View,
5775
- {
5776
- style: {
5777
- position: "absolute",
5778
- bottom: 16,
5779
- left: 16,
5780
- right: 16,
5781
- flexDirection: "row",
5782
- justifyContent: "center",
5783
- alignItems: "center"
5784
- },
5785
- pointerEvents: "box-none",
5786
- children: toolbar
5787
- }
5788
- )
5789
- ] }),
5790
- /* @__PURE__ */ jsx(
5791
- Modal,
5792
- {
5793
- animationType: "fade",
5794
- transparent: true,
5795
- visible: pendingNativeLinkRequest !== null,
5796
- onRequestClose: closeNativeLinkDialog,
5797
- children: /* @__PURE__ */ jsx(View, { style: styles3.nativeLinkDialogBackdrop, children: /* @__PURE__ */ jsxs(View, { style: styles3.nativeLinkDialogCard, children: [
5798
- /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogTitle, children: nativeLinkDialogLabels.title }),
5799
- /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogDescription, children: nativeLinkDialogLabels.description }),
5800
- /* @__PURE__ */ jsx(
5801
- TextInput,
5802
- {
5803
- accessibilityLabel: nativeLinkDialogLabels.title,
5804
- autoCapitalize: "none",
5805
- autoCorrect: false,
5806
- keyboardType: "url",
5807
- onChangeText: setNativeLinkInputValue,
5808
- onSubmitEditing: submitNativeLinkDialog,
5809
- placeholder: nativeLinkDialogLabels.inputPlaceholder,
5810
- returnKeyType: "done",
5811
- style: styles3.nativeLinkDialogInput,
5812
- value: nativeLinkInputValue
5813
- }
5814
- ),
5815
- /* @__PURE__ */ jsxs(View, { style: styles3.nativeLinkDialogActions, children: [
5816
- /* @__PURE__ */ jsx(
5817
- Pressable,
5818
- {
5819
- accessibilityRole: "button",
5820
- onPress: closeNativeLinkDialog,
5821
- style: ({ pressed }) => [
5822
- styles3.nativeLinkDialogButton,
5823
- pressed ? styles3.nativeLinkDialogButtonPressed : void 0
5824
- ],
5825
- children: /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogButtonText, children: nativeLinkDialogLabels.cancelLabel })
5826
- }
5827
- ),
5828
- /* @__PURE__ */ jsx(
5829
- Pressable,
5830
- {
5831
- accessibilityRole: "button",
5832
- accessibilityState: { disabled: !nativeLinkCanSubmit },
5833
- disabled: !nativeLinkCanSubmit,
5834
- onPress: submitNativeLinkDialog,
5835
- style: ({ pressed }) => [
5836
- styles3.nativeLinkDialogButton,
5837
- styles3.nativeLinkDialogPrimaryButton,
5838
- pressed && nativeLinkCanSubmit ? styles3.nativeLinkDialogPrimaryButtonPressed : void 0,
5839
- !nativeLinkCanSubmit ? styles3.nativeLinkDialogDisabledButton : void 0
5840
- ],
5841
- children: /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogPrimaryButtonText, children: nativeLinkDialogLabels.addLabel })
5842
- }
5843
- )
5844
- ] })
5845
- ] }) })
5846
- }
5847
- )
5848
- ]
5849
- }
5850
- );
5828
+ /* @__PURE__ */ jsxs(View, { style: styles3.nativeLinkDialogActions, children: [
5829
+ /* @__PURE__ */ jsx(
5830
+ Pressable,
5831
+ {
5832
+ accessibilityRole: "button",
5833
+ onPress: closeNativeLinkDialog,
5834
+ style: ({ pressed }) => [
5835
+ styles3.nativeLinkDialogButton,
5836
+ pressed ? styles3.nativeLinkDialogButtonPressed : void 0
5837
+ ],
5838
+ children: /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogButtonText, children: nativeLinkDialogLabels.cancelLabel })
5839
+ }
5840
+ ),
5841
+ /* @__PURE__ */ jsx(
5842
+ Pressable,
5843
+ {
5844
+ accessibilityRole: "button",
5845
+ accessibilityState: { disabled: !nativeLinkCanSubmit },
5846
+ disabled: !nativeLinkCanSubmit,
5847
+ onPress: submitNativeLinkDialog,
5848
+ style: ({ pressed }) => [
5849
+ styles3.nativeLinkDialogButton,
5850
+ styles3.nativeLinkDialogPrimaryButton,
5851
+ pressed && nativeLinkCanSubmit ? styles3.nativeLinkDialogPrimaryButtonPressed : void 0,
5852
+ !nativeLinkCanSubmit ? styles3.nativeLinkDialogDisabledButton : void 0
5853
+ ],
5854
+ children: /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogPrimaryButtonText, children: nativeLinkDialogLabels.addLabel })
5855
+ }
5856
+ )
5857
+ ] })
5858
+ ] }) })
5859
+ }
5860
+ )
5861
+ ] });
5851
5862
  });
5852
5863
  var styles3 = StyleSheet.create({
5853
5864
  nativeLinkDialogBackdrop: {