canvu-react 0.4.39 → 0.4.41

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