canvu-react 0.4.35 → 0.4.37

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,3 +1,5 @@
1
+ import { C as CanvuLinkData } from './link-item-DwzXOwU5.cjs';
2
+ export { D as DEFAULT_LINK_CARD_SIZE, c as createLinkItem, g as getLinkData, i as isLinkItem } from './link-item-DwzXOwU5.cjs';
1
3
  import { C as Camera2D, S as StrokeStyle } from './shape-builders-CKEMjivV.cjs';
2
4
  export { o as createFreehandStrokeItem, q as createImageItem, t as createShapeId } from './shape-builders-CKEMjivV.cjs';
3
5
  import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.cjs';
@@ -162,7 +164,7 @@ type NativeVectorToolbarProps = {
162
164
  readonly renderOverflowChevronIcon?: (input: NativeVectorToolbarRenderOverflowInput) => ReactNode;
163
165
  readonly renderToolButton?: (input: NativeVectorToolbarRenderToolInput) => ReactNode;
164
166
  };
165
- declare const DEFAULT_NATIVE_OVERFLOW_TOOL_IDS: readonly ["rect", "ellipse", "architectural-cloud", "line", "marker", "laser", "image"];
167
+ declare const DEFAULT_NATIVE_OVERFLOW_TOOL_IDS: readonly ["rect", "ellipse", "architectural-cloud", "line", "marker", "laser", "image", "link"];
166
168
  /**
167
169
  * Default mobile-friendly tool list for {@link NativeVectorToolbar}.
168
170
  *
@@ -213,6 +215,58 @@ type NativeWorldPointerDownDetail = {
213
215
  readonly screenX: number;
214
216
  readonly screenY: number;
215
217
  };
218
+ /**
219
+ * Optional override for a link item inserted from the native link tool.
220
+ *
221
+ * Use this when your app has already reserved an item id or wants to place the
222
+ * link card at a custom box. Most apps can omit it and use the default card
223
+ * centered on the tapped world point.
224
+ */
225
+ type NativeLinkToolInsertOptions = {
226
+ readonly id?: string;
227
+ readonly bounds?: Rect;
228
+ };
229
+ /**
230
+ * Copy used by the built-in native link dialog.
231
+ *
232
+ * Pass this only when you need localized or product-specific text. Omit it for
233
+ * the default plug-and-play `"link"` tool flow.
234
+ */
235
+ type NativeLinkToolDialogLabels = {
236
+ readonly title?: string;
237
+ readonly description?: string;
238
+ readonly inputPlaceholder?: string;
239
+ readonly cancelLabel?: string;
240
+ readonly addLabel?: string;
241
+ };
242
+ /**
243
+ * Detail passed when the built-in native `"link"` tool receives a tap.
244
+ *
245
+ * The default flow shows canvu's built-in URL dialog and inserts the card after
246
+ * submit. Use this detail only when overriding that dialog through
247
+ * `onLinkToolRequest`.
248
+ *
249
+ * @example
250
+ * ```tsx
251
+ * <NativeVectorViewport
252
+ * toolId={toolId}
253
+ * onLinkToolRequest={(detail) => {
254
+ * openLinkDialog({
255
+ * onSubmit: (href) => detail.insertLink({ href }),
256
+ * });
257
+ * }}
258
+ * />
259
+ * ```
260
+ */
261
+ type NativeLinkToolRequestDetail = {
262
+ readonly toolId: "link";
263
+ readonly worldX: number;
264
+ readonly worldY: number;
265
+ readonly screenX: number;
266
+ readonly screenY: number;
267
+ readonly suggestedBounds: Rect;
268
+ readonly insertLink: (link: CanvuLinkData, options?: NativeLinkToolInsertOptions) => VectorSceneItem | null;
269
+ };
216
270
  type NativeVectorViewportProps = {
217
271
  readonly items: readonly VectorSceneItem[];
218
272
  readonly selectedIds?: readonly string[];
@@ -223,6 +277,15 @@ type NativeVectorViewportProps = {
223
277
  readonly onSelectionChange?: (ids: string[]) => void;
224
278
  readonly onItemsChange?: (items: VectorSceneItem[]) => void;
225
279
  readonly onToolChangeRequest?: (toolId: string) => void;
280
+ /**
281
+ * Optional override for the built-in native link dialog.
282
+ *
283
+ * Omit this for the plug-and-play first-party link tool. When supplied,
284
+ * canvu will not show its default dialog; your app is responsible for
285
+ * calling `detail.insertLink(...)`.
286
+ */
287
+ readonly onLinkToolRequest?: (detail: NativeLinkToolRequestDetail) => void;
288
+ readonly linkToolDialogLabels?: NativeLinkToolDialogLabels;
226
289
  readonly onWorldPointerDown?: (detail: NativeWorldPointerDownDetail) => void;
227
290
  readonly onWorldPointerMove?: (world: {
228
291
  readonly x: number;
@@ -369,4 +432,4 @@ type SvgNode = SvgRectNode | SvgEllipseNode | SvgCircleNode | SvgLineNode | SvgP
369
432
  */
370
433
  declare function parseSvgFragment(xml: string): SvgNode[];
371
434
 
372
- export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, type NativeCustomShapePlacementOptions, 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 NativeWorldPointerDownDetail, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
435
+ export { CanvuLinkData, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, type NativeCustomShapePlacementOptions, NativeInteractionOverlay, type NativeInteractionOverlayProps, type NativeLinkToolDialogLabels, type NativeLinkToolInsertOptions, type NativeLinkToolRequestDetail, 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 };
package/dist/native.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { C as CanvuLinkData } from './link-item-IW4GTnxl.js';
2
+ export { D as DEFAULT_LINK_CARD_SIZE, c as createLinkItem, g as getLinkData, i as isLinkItem } from './link-item-IW4GTnxl.js';
1
3
  import { C as Camera2D, S as StrokeStyle } from './shape-builders-Cyh8zvDG.js';
2
4
  export { o as createFreehandStrokeItem, q as createImageItem, t as createShapeId } from './shape-builders-Cyh8zvDG.js';
3
5
  import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.js';
@@ -162,7 +164,7 @@ type NativeVectorToolbarProps = {
162
164
  readonly renderOverflowChevronIcon?: (input: NativeVectorToolbarRenderOverflowInput) => ReactNode;
163
165
  readonly renderToolButton?: (input: NativeVectorToolbarRenderToolInput) => ReactNode;
164
166
  };
165
- declare const DEFAULT_NATIVE_OVERFLOW_TOOL_IDS: readonly ["rect", "ellipse", "architectural-cloud", "line", "marker", "laser", "image"];
167
+ declare const DEFAULT_NATIVE_OVERFLOW_TOOL_IDS: readonly ["rect", "ellipse", "architectural-cloud", "line", "marker", "laser", "image", "link"];
166
168
  /**
167
169
  * Default mobile-friendly tool list for {@link NativeVectorToolbar}.
168
170
  *
@@ -213,6 +215,58 @@ type NativeWorldPointerDownDetail = {
213
215
  readonly screenX: number;
214
216
  readonly screenY: number;
215
217
  };
218
+ /**
219
+ * Optional override for a link item inserted from the native link tool.
220
+ *
221
+ * Use this when your app has already reserved an item id or wants to place the
222
+ * link card at a custom box. Most apps can omit it and use the default card
223
+ * centered on the tapped world point.
224
+ */
225
+ type NativeLinkToolInsertOptions = {
226
+ readonly id?: string;
227
+ readonly bounds?: Rect;
228
+ };
229
+ /**
230
+ * Copy used by the built-in native link dialog.
231
+ *
232
+ * Pass this only when you need localized or product-specific text. Omit it for
233
+ * the default plug-and-play `"link"` tool flow.
234
+ */
235
+ type NativeLinkToolDialogLabels = {
236
+ readonly title?: string;
237
+ readonly description?: string;
238
+ readonly inputPlaceholder?: string;
239
+ readonly cancelLabel?: string;
240
+ readonly addLabel?: string;
241
+ };
242
+ /**
243
+ * Detail passed when the built-in native `"link"` tool receives a tap.
244
+ *
245
+ * The default flow shows canvu's built-in URL dialog and inserts the card after
246
+ * submit. Use this detail only when overriding that dialog through
247
+ * `onLinkToolRequest`.
248
+ *
249
+ * @example
250
+ * ```tsx
251
+ * <NativeVectorViewport
252
+ * toolId={toolId}
253
+ * onLinkToolRequest={(detail) => {
254
+ * openLinkDialog({
255
+ * onSubmit: (href) => detail.insertLink({ href }),
256
+ * });
257
+ * }}
258
+ * />
259
+ * ```
260
+ */
261
+ type NativeLinkToolRequestDetail = {
262
+ readonly toolId: "link";
263
+ readonly worldX: number;
264
+ readonly worldY: number;
265
+ readonly screenX: number;
266
+ readonly screenY: number;
267
+ readonly suggestedBounds: Rect;
268
+ readonly insertLink: (link: CanvuLinkData, options?: NativeLinkToolInsertOptions) => VectorSceneItem | null;
269
+ };
216
270
  type NativeVectorViewportProps = {
217
271
  readonly items: readonly VectorSceneItem[];
218
272
  readonly selectedIds?: readonly string[];
@@ -223,6 +277,15 @@ type NativeVectorViewportProps = {
223
277
  readonly onSelectionChange?: (ids: string[]) => void;
224
278
  readonly onItemsChange?: (items: VectorSceneItem[]) => void;
225
279
  readonly onToolChangeRequest?: (toolId: string) => void;
280
+ /**
281
+ * Optional override for the built-in native link dialog.
282
+ *
283
+ * Omit this for the plug-and-play first-party link tool. When supplied,
284
+ * canvu will not show its default dialog; your app is responsible for
285
+ * calling `detail.insertLink(...)`.
286
+ */
287
+ readonly onLinkToolRequest?: (detail: NativeLinkToolRequestDetail) => void;
288
+ readonly linkToolDialogLabels?: NativeLinkToolDialogLabels;
226
289
  readonly onWorldPointerDown?: (detail: NativeWorldPointerDownDetail) => void;
227
290
  readonly onWorldPointerMove?: (world: {
228
291
  readonly x: number;
@@ -369,4 +432,4 @@ type SvgNode = SvgRectNode | SvgEllipseNode | SvgCircleNode | SvgLineNode | SvgP
369
432
  */
370
433
  declare function parseSvgFragment(xml: string): SvgNode[];
371
434
 
372
- export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, type NativeCustomShapePlacementOptions, 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 NativeWorldPointerDownDetail, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
435
+ export { CanvuLinkData, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, type NativeCustomShapePlacementOptions, NativeInteractionOverlay, type NativeInteractionOverlayProps, type NativeLinkToolDialogLabels, type NativeLinkToolInsertOptions, type NativeLinkToolRequestDetail, 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 };