tldraw 5.6.0 → 5.6.2

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.
Files changed (90) hide show
  1. package/DOCS.md +21 -9
  2. package/RELEASE_NOTES.md +161 -3
  3. package/dist-cjs/index.d.ts +31 -1
  4. package/dist-cjs/index.js +4 -1
  5. package/dist-cjs/index.js.map +2 -2
  6. package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js +11 -4
  7. package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js.map +2 -2
  8. package/dist-cjs/lib/shapes/bookmark/bookmarks.js +25 -4
  9. package/dist-cjs/lib/shapes/bookmark/bookmarks.js.map +2 -2
  10. package/dist-cjs/lib/shapes/shared/HyperlinkButton.js +4 -0
  11. package/dist-cjs/lib/shapes/shared/HyperlinkButton.js.map +2 -2
  12. package/dist-cjs/lib/shapes/shared/RichTextLabel.js +13 -1
  13. package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
  14. package/dist-cjs/lib/shapes/shared/useOpenLinkHandler.js +38 -0
  15. package/dist-cjs/lib/shapes/shared/useOpenLinkHandler.js.map +7 -0
  16. package/dist-cjs/lib/ui/components/ConfirmOpenLinkDialog.js +57 -0
  17. package/dist-cjs/lib/ui/components/ConfirmOpenLinkDialog.js.map +7 -0
  18. package/dist-cjs/lib/ui/components/EditLinkDialog.js +15 -17
  19. package/dist-cjs/lib/ui/components/EditLinkDialog.js.map +2 -2
  20. package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +47 -19
  21. package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +3 -3
  22. package/dist-cjs/lib/ui/context/actions.js +2 -1
  23. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  24. package/dist-cjs/lib/ui/hooks/useEditorEvents.js +12 -1
  25. package/dist-cjs/lib/ui/hooks/useEditorEvents.js.map +2 -2
  26. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  27. package/dist-cjs/lib/ui/version.js +2 -2
  28. package/dist-cjs/lib/ui/version.js.map +1 -1
  29. package/dist-cjs/lib/utils/linkUrl.js +39 -0
  30. package/dist-cjs/lib/utils/linkUrl.js.map +7 -0
  31. package/dist-cjs/lib/utils/openLink.js +68 -0
  32. package/dist-cjs/lib/utils/openLink.js.map +7 -0
  33. package/dist-cjs/lib/utils/text/richText.js +4 -1
  34. package/dist-cjs/lib/utils/text/richText.js.map +2 -2
  35. package/dist-esm/index.d.mts +31 -1
  36. package/dist-esm/index.mjs +4 -1
  37. package/dist-esm/index.mjs.map +2 -2
  38. package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs +12 -4
  39. package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs.map +2 -2
  40. package/dist-esm/lib/shapes/bookmark/bookmarks.mjs +25 -4
  41. package/dist-esm/lib/shapes/bookmark/bookmarks.mjs.map +2 -2
  42. package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs +4 -0
  43. package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs.map +2 -2
  44. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +13 -2
  45. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
  46. package/dist-esm/lib/shapes/shared/useOpenLinkHandler.mjs +18 -0
  47. package/dist-esm/lib/shapes/shared/useOpenLinkHandler.mjs.map +7 -0
  48. package/dist-esm/lib/ui/components/ConfirmOpenLinkDialog.mjs +43 -0
  49. package/dist-esm/lib/ui/components/ConfirmOpenLinkDialog.mjs.map +7 -0
  50. package/dist-esm/lib/ui/components/EditLinkDialog.mjs +16 -18
  51. package/dist-esm/lib/ui/components/EditLinkDialog.mjs.map +2 -2
  52. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +38 -20
  53. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
  54. package/dist-esm/lib/ui/context/actions.mjs +2 -1
  55. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  56. package/dist-esm/lib/ui/hooks/useEditorEvents.mjs +13 -2
  57. package/dist-esm/lib/ui/hooks/useEditorEvents.mjs.map +2 -2
  58. package/dist-esm/lib/ui/version.mjs +2 -2
  59. package/dist-esm/lib/ui/version.mjs.map +1 -1
  60. package/dist-esm/lib/utils/linkUrl.mjs +19 -0
  61. package/dist-esm/lib/utils/linkUrl.mjs.map +7 -0
  62. package/dist-esm/lib/utils/openLink.mjs +48 -0
  63. package/dist-esm/lib/utils/openLink.mjs.map +7 -0
  64. package/dist-esm/lib/utils/text/richText.mjs +5 -1
  65. package/dist-esm/lib/utils/text/richText.mjs.map +2 -2
  66. package/package.json +6 -6
  67. package/src/index.ts +1 -0
  68. package/src/lib/shapes/bookmark/BookmarkShapeUtil.tsx +12 -6
  69. package/src/lib/shapes/bookmark/bookmarks.ts +38 -5
  70. package/src/lib/shapes/shared/HyperlinkButton.tsx +4 -0
  71. package/src/lib/shapes/shared/RichTextLabel.tsx +18 -2
  72. package/src/lib/shapes/shared/useOpenLinkHandler.ts +20 -0
  73. package/src/lib/ui/components/ConfirmOpenLinkDialog.tsx +53 -0
  74. package/src/lib/ui/components/EditLinkDialog.tsx +22 -26
  75. package/src/lib/ui/components/Toolbar/LinkEditor.tsx +40 -21
  76. package/src/lib/ui/context/actions.tsx +2 -1
  77. package/src/lib/ui/hooks/useEditorEvents.ts +14 -2
  78. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +4 -0
  79. package/src/lib/ui/version.ts +2 -2
  80. package/src/lib/ui.css +19 -2
  81. package/src/lib/utils/linkUrl.test.ts +33 -0
  82. package/src/lib/utils/linkUrl.ts +30 -0
  83. package/src/lib/utils/openLink.test.ts +83 -0
  84. package/src/lib/utils/openLink.ts +75 -0
  85. package/src/lib/utils/text/richText.ts +4 -0
  86. package/src/test/bookmark-shapes.test.ts +62 -2
  87. package/src/test/ui/ConfirmOpenLinkDialog.test.tsx +128 -0
  88. package/src/test/ui/EditLinkDialog.test.tsx +53 -2
  89. package/src/test/ui/LinkEditor.test.tsx +71 -0
  90. package/tldraw.css +19 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/// <reference types=\"react\" />\n\nimport { registerTldrawLibraryVersion } from '@tldraw/editor'\nexport { getPointsFromDrawSegment, getPointsFromDrawSegments } from './lib/shapes/draw/getPath'\nexport {\n\tPathBuilder,\n\tPathBuilderGeometry2d,\n\ttype BasePathBuilderOpts,\n\ttype CubicBezierToPathBuilderCommand,\n\ttype DashedPathBuilderOpts,\n\ttype DrawPathBuilderDOpts,\n\ttype DrawPathBuilderOpts,\n\ttype NonePathBuilderOpts,\n\ttype LineToPathBuilderCommand,\n\ttype MoveToPathBuilderCommand,\n\ttype PathBuilderCommand,\n\ttype PathBuilderCommandBase,\n\ttype PathBuilderCommandInfo,\n\ttype PathBuilderCommandOpts,\n\ttype PathBuilderLineOpts,\n\ttype PathBuilderOpts,\n\ttype PathBuilderToDOpts,\n\ttype SolidPathBuilderOpts,\n} from './lib/shapes/shared/PathBuilder'\nexport { usePrefersReducedMotion } from './lib/shapes/shared/usePrefersReducedMotion'\nexport { startEditingShapeWithRichText } from './lib/tools/SelectTool/selectHelpers'\nexport { DefaultA11yAnnouncer, useSelectedShapesAnnouncer } from './lib/ui/components/A11y'\nexport { AccessibilityMenu } from './lib/ui/components/AccessibilityMenu'\nexport { ColorSchemeMenu } from './lib/ui/components/ColorSchemeMenu'\nexport { DefaultFollowingIndicator } from './lib/ui/components/DefaultFollowingIndicator'\nexport { DefaultDialogs } from './lib/ui/components/Dialogs'\nexport {\n\tTldrawUiColumn,\n\tTldrawUiGrid,\n\tTldrawUiOrientationProvider,\n\tTldrawUiRow,\n\tuseTldrawUiOrientation,\n\ttype TldrawUiOrientationContext,\n\ttype TldrawUiOrientationProviderProps,\n\ttype TLUiLayoutProps,\n} from './lib/ui/components/primitives/layout'\nexport {\n\tTldrawUiMenuActionCheckboxItem,\n\ttype TLUiMenuActionCheckboxItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuActionCheckboxItem'\nexport {\n\tTldrawUiMenuActionItem,\n\ttype TLUiMenuActionItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuActionItem'\nexport {\n\tTldrawUiMenuToolItem,\n\ttype TLUiMenuToolItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuToolItem'\nexport { DefaultToasts } from './lib/ui/components/Toasts'\nexport {\n\tF,\n\tuseTldrawI18n,\n\ttype TLUiMessageProps,\n\ttype TLUiMessageValues,\n} from './lib/ui/context/i18n'\nexport { TldrawUiTranslationProvider } from './lib/ui/hooks/useTranslation/useTranslation'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/editor'\nexport { BookmarkAssetUtil } from './lib/assets/BookmarkAssetUtil'\nexport { ImageAssetUtil } from './lib/assets/ImageAssetUtil'\nexport { VideoAssetUtil } from './lib/assets/VideoAssetUtil'\nexport {\n\tArrowBindingHintOverlayUtil,\n\ttype TLArrowBindingHintOverlay,\n} from './lib/overlays/ArrowBindingHintOverlayUtil'\nexport { ArrowBindingUtil } from './lib/bindings/arrow/ArrowBindingUtil'\nexport { ArrowHintOverlayUtil, type TLArrowHintOverlay } from './lib/overlays/ArrowHintOverlayUtil'\nexport {\n\tBrushOverlayUtil,\n\ttype BrushOverlayUtilDisplayValues,\n\ttype BrushOverlayUtilOptions,\n\ttype TLBrushOverlay,\n} from './lib/overlays/BrushOverlayUtil'\nexport { ZoomBrushOverlayUtil, type TLZoomBrushOverlay } from './lib/overlays/ZoomBrushOverlayUtil'\nexport { ScribbleOverlayUtil, type TLScribbleOverlay } from './lib/overlays/ScribbleOverlayUtil'\nexport {\n\tCollaboratorHintOverlayUtil,\n\ttype TLCollaboratorHintOverlay,\n} from './lib/overlays/CollaboratorHintOverlayUtil'\n// Deprecated, but still exported so apps that customized canvas-drawn cursors keep working.\n// oxlint-disable-next-line typescript/no-deprecated\nexport { CollaboratorCursorOverlayUtil } from './lib/overlays/CollaboratorCursorOverlayUtil'\n// oxlint-disable-next-line typescript/no-deprecated\nexport type { TLCollaboratorCursorOverlay } from './lib/overlays/CollaboratorCursorOverlayUtil'\nexport {\n\tCollaboratorBrushOverlayUtil,\n\ttype TLCollaboratorBrushOverlay,\n} from './lib/overlays/CollaboratorBrushOverlayUtil'\nexport {\n\tCollaboratorScribbleOverlayUtil,\n\ttype TLCollaboratorScribbleOverlay,\n} from './lib/overlays/CollaboratorScribbleOverlayUtil'\nexport {\n\tCollaboratorShapeIndicatorOverlayUtil,\n\ttype TLCollaboratorShapeIndicatorOverlay,\n} from './lib/overlays/CollaboratorShapeIndicatorOverlayUtil'\nexport {\n\tShapeHandleOverlayUtil,\n\ttype TLShapeHandleOverlay,\n} from './lib/overlays/ShapeHandleOverlayUtil'\nexport {\n\tShapeIndicatorOverlayUtil,\n\ttype TLShapeIndicatorOverlay,\n} from './lib/overlays/ShapeIndicatorOverlayUtil'\nexport {\n\tSelectionForegroundOverlayUtil,\n\ttype TLSelectionForegroundOverlay,\n} from './lib/overlays/SelectionForegroundOverlayUtil'\nexport {\n\tSnapIndicatorOverlayUtil,\n\ttype TLSnapIndicatorOverlay,\n} from './lib/overlays/SnapIndicatorOverlayUtil'\nexport { defaultAssetUtils } from './lib/defaultAssetUtils'\nexport { defaultBindingUtils } from './lib/defaultBindingUtils'\nexport { defaultOverlayUtils } from './lib/defaultOverlayUtils'\nexport {\n\tDEFAULT_EMBED_DEFINITIONS,\n\tembedShapePermissionDefaults,\n\tunknownEmbedShapePermissionOverrides,\n\ttype CustomEmbedDefinition,\n\ttype DefaultEmbedConfig,\n\ttype DefaultEmbedDefinitionType,\n\ttype EmbedDefinition,\n\ttype GoogleMapsEmbedConfig,\n\ttype TLEmbedDefinition,\n\ttype TLEmbedShapePermissions,\n} from './lib/defaultEmbedDefinitions'\nexport {\n\tcenterSelectionAroundPoint,\n\tcreateEmptyBookmarkShape,\n\tcreateShapesForAssets,\n\tDEFAULT_MAX_ASSET_SIZE,\n\tDEFAULT_MAX_IMAGE_DIMENSION,\n\tdefaultHandleExternalEmbedContent,\n\tdefaultHandleExternalExcalidrawContent,\n\tdefaultHandleExternalFileAsset,\n\tdefaultHandleExternalFileContent,\n\tdefaultHandleExternalFileReplaceContent,\n\tdefaultHandleExternalSvgTextContent,\n\tdefaultHandleExternalTextContent,\n\tdefaultHandleExternalTldrawContent,\n\tdefaultHandleExternalUrlAsset,\n\tdefaultHandleExternalUrlContent,\n\tgetAssetInfo,\n\tnotifyIfFileNotAllowed,\n\tregisterDefaultExternalContentHandlers,\n\ttype TLDefaultExternalContentHandlerOpts,\n\ttype TLExternalContentProps,\n} from './lib/defaultExternalContentHandlers'\nexport { defaultShapeTools } from './lib/defaultShapeTools'\nexport { defaultShapeUtils } from './lib/defaultShapeUtils'\nexport { registerDefaultSideEffects } from './lib/defaultSideEffects'\nexport { defaultTools } from './lib/defaultTools'\nexport {\n\ttype ArrowShapeOptions,\n\ttype ArrowShapeUtilDisplayValues,\n\ttype TLArcArrowInfo,\n\ttype TLArcInfo,\n\ttype TLArrowInfo,\n\ttype TLArrowPoint,\n\ttype TLElbowArrowInfo,\n\ttype TLStraightArrowInfo,\n} from './lib/shapes/arrow/arrow-types'\nexport { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'\nexport { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'\nexport {\n\tclearArrowTargetState,\n\tgetArrowTargetState,\n\tupdateArrowTargetState,\n\ttype ArrowTargetState,\n\ttype UpdateArrowTargetStateOpts,\n} from './lib/shapes/arrow/arrowTargetState'\nexport {\n\ttype ElbowArrowBox,\n\ttype ElbowArrowBoxEdges,\n\ttype ElbowArrowBoxes,\n\ttype ElbowArrowEdge,\n\ttype ElbowArrowInfo,\n\ttype ElbowArrowInfoWithoutRoute,\n\ttype ElbowArrowMidpointHandle,\n\ttype ElbowArrowOptions,\n\ttype ElbowArrowRange,\n\ttype ElbowArrowRoute,\n\ttype ElbowArrowSide,\n\ttype ElbowArrowSideReason,\n\ttype ElbowArrowTargetBox,\n} from './lib/shapes/arrow/elbow/definitions'\nexport { getArrowInfo } from './lib/shapes/arrow/getArrowInfo'\nexport {\n\tgetArrowBindings,\n\tgetArrowTerminalsInArrowSpace,\n\ttype TLArrowBindings,\n} from './lib/shapes/arrow/shared'\nexport { createBookmarkFromUrl } from './lib/shapes/bookmark/bookmarks'\nexport {\n\tBookmarkShapeUtil,\n\ttype BookmarkShapeOptions,\n\ttype BookmarkShapeUtilDisplayValues,\n} from './lib/shapes/bookmark/BookmarkShapeUtil'\nexport { DrawShapeTool } from './lib/shapes/draw/DrawShapeTool'\nexport {\n\tDrawShapeUtil,\n\ttype DrawShapeOptions,\n\ttype DrawShapeUtilDisplayValues,\n} from './lib/shapes/draw/DrawShapeUtil'\nexport {\n\tEmbedShapeUtil,\n\ttype EmbedShapeOptions,\n\ttype EmbedShapeUtilDisplayValues,\n} from './lib/shapes/embed/EmbedShapeUtil'\nexport { FrameShapeTool } from './lib/shapes/frame/FrameShapeTool'\nexport {\n\tFrameShapeUtil,\n\ttype FrameShapeOptions,\n\ttype FrameShapeUtilDisplayValues,\n} from './lib/shapes/frame/FrameShapeUtil'\nexport { GeoShapeTool } from './lib/shapes/geo/GeoShapeTool'\nexport {\n\tGeoShapeUtil,\n\ttype GeoShapeOptions,\n\ttype GeoShapeUtilDisplayValues,\n} from './lib/shapes/geo/GeoShapeUtil'\nexport {\n\tdefaultGeoTypeDefinitions,\n\tgetGeoTypeDefinition,\n\ttype GeoTypeDefinition,\n} from './lib/shapes/geo/getGeoShapePath'\nexport { HighlightShapeTool } from './lib/shapes/highlight/HighlightShapeTool'\nexport {\n\tHighlightShapeUtil,\n\ttype HighlightShapeOptions,\n\ttype HighlightShapeUtilDisplayValues,\n} from './lib/shapes/highlight/HighlightShapeUtil'\nexport {\n\tImageShapeUtil,\n\ttype ImageShapeOptions,\n\ttype ImageShapeUtilDisplayValues,\n} from './lib/shapes/image/ImageShapeUtil'\nexport { LineShapeTool } from './lib/shapes/line/LineShapeTool'\nexport {\n\tLineShapeUtil,\n\ttype LineShapeOptions,\n\ttype LineShapeUtilDisplayValues,\n} from './lib/shapes/line/LineShapeUtil'\nexport {\n\tDefaultNoteShapeAttribution,\n\ttype TLNoteShapeAttributionComponent,\n\ttype TLNoteShapeAttributionProps,\n} from './lib/shapes/note/DefaultNoteShapeAttribution'\nexport { NoteShapeTool } from './lib/shapes/note/NoteShapeTool'\nexport {\n\tNoteShapeUtil,\n\ttype NoteShapeOptions,\n\ttype NoteShapeUtilDisplayValues,\n} from './lib/shapes/note/NoteShapeUtil'\nexport {\n\tASPECT_RATIO_OPTIONS,\n\tASPECT_RATIO_TO_VALUE,\n\tgetCropBox,\n\tgetDefaultCrop,\n\tgetUncroppedSize,\n\ttype ASPECT_RATIO_OPTION,\n\ttype CropBoxOptions,\n} from './lib/shapes/shared/crop'\nexport { getFontFamily } from './lib/shapes/shared/default-shape-constants'\nexport {\n\tallDefaultFontFaces,\n\tDefaultFontFaces,\n\ttype TLDefaultFont,\n\ttype TLDefaultFonts,\n} from './lib/shapes/shared/defaultFonts'\nexport { getStroke } from './lib/shapes/shared/freehand/getStroke'\nexport { getStrokeOutlinePoints } from './lib/shapes/shared/freehand/getStrokeOutlinePoints'\nexport { getStrokePoints } from './lib/shapes/shared/freehand/getStrokePoints'\nexport { getSvgPathFromStrokePoints } from './lib/shapes/shared/freehand/svg'\nexport { type StrokeOptions, type StrokePoint } from './lib/shapes/shared/freehand/types'\nexport {\n\tgetDisplayValues,\n\ttype ShapeOptionsWithDisplayValues,\n} from './lib/shapes/shared/getDisplayValues'\nexport { PlainTextLabel, type PlainTextLabelProps } from './lib/shapes/shared/PlainTextLabel'\nexport {\n\tRichTextLabel,\n\tRichTextSVG,\n\ttype RichTextLabelProps,\n\ttype RichTextSVGProps,\n} from './lib/shapes/shared/RichTextLabel'\nexport { useEditablePlainText } from './lib/shapes/shared/useEditablePlainText'\nexport { useEditableRichText } from './lib/shapes/shared/useEditableRichText'\nexport {\n\tuseImageOrVideoAsset,\n\ttype UseImageOrVideoAssetOptions,\n} from './lib/shapes/shared/useImageOrVideoAsset'\nexport { PlainTextArea } from './lib/shapes/text/PlainTextArea'\nexport { RichTextArea, type TextAreaProps } from './lib/shapes/text/RichTextArea'\nexport { TextShapeTool } from './lib/shapes/text/TextShapeTool'\nexport {\n\tTextShapeUtil,\n\ttype TextShapeOptions,\n\ttype TextShapeUtilDisplayValues,\n} from './lib/shapes/text/TextShapeUtil'\nexport {\n\tVideoShapeUtil,\n\ttype VideoShapeOptions,\n\ttype VideoShapeUtilDisplayValues,\n} from './lib/shapes/video/VideoShapeUtil'\nexport { getColorStyleItems, getFontStyleItems, type StyleValuesForUi } from './lib/styles'\nexport { Tldraw, type TLComponents, type TldrawBaseProps, type TldrawProps } from './lib/Tldraw'\nexport { TldrawImage, type TldrawImageProps } from './lib/TldrawImage'\nexport { EraserTool } from './lib/tools/EraserTool/EraserTool'\nexport { HandTool } from './lib/tools/HandTool/HandTool'\nexport { LaserTool } from './lib/tools/LaserTool/LaserTool'\nexport { getHitShapeOnCanvasPointerDown } from './lib/tools/selection-logic/getHitShapeOnCanvasPointerDown'\nexport { SelectTool } from './lib/tools/SelectTool/SelectTool'\nexport { ZoomTool } from './lib/tools/ZoomTool/ZoomTool'\nexport {\n\tsetDefaultUiAssetUrls,\n\ttype TLUiAssetUrlOverrides,\n\ttype TLUiAssetUrls,\n} from './lib/ui/assetUrls'\nexport {\n\tDefaultActionsMenu,\n\ttype TLUiActionsMenuProps,\n} from './lib/ui/components/ActionsMenu/DefaultActionsMenu'\nexport {\n\tAlignMenuItems,\n\tDefaultActionsMenuContent,\n\tDistributeMenuItems,\n\tGroupOrUngroupMenuItem,\n\tReorderMenuItems,\n\tRotateCWMenuItem,\n\tStackMenuItems,\n\tZoomOrRotateMenuItem,\n} from './lib/ui/components/ActionsMenu/DefaultActionsMenuContent'\nexport {\n\tDefaultContextMenu as ContextMenu,\n\tDefaultContextMenu,\n\ttype TLUiContextMenuProps,\n} from './lib/ui/components/ContextMenu/DefaultContextMenu'\nexport { DefaultContextMenuContent } from './lib/ui/components/ContextMenu/DefaultContextMenuContent'\nexport {\n\tDefaultDebugMenu,\n\ttype TLUiDebugMenuProps,\n} from './lib/ui/components/DebugMenu/DefaultDebugMenu'\nexport {\n\tDebugFlags,\n\tDefaultDebugMenuContent,\n\tExampleDialog,\n\tFeatureFlags,\n\ttype CustomDebugFlags,\n\ttype DebugFlagsProps,\n\ttype ExampleDialogProps,\n\ttype FeatureFlagsProps,\n} from './lib/ui/components/DebugMenu/DefaultDebugMenuContent'\nexport { DefaultMenuPanel } from './lib/ui/components/DefaultMenuPanel'\nexport {\n\tDefaultHelperButtons,\n\ttype TLUiHelperButtonsProps,\n} from './lib/ui/components/HelperButtons/DefaultHelperButtons'\nexport { DefaultHelperButtonsContent } from './lib/ui/components/HelperButtons/DefaultHelperButtonsContent'\nexport {\n\tDefaultHelpMenu,\n\ttype TLUiHelpMenuProps,\n} from './lib/ui/components/HelpMenu/DefaultHelpMenu'\nexport {\n\tDefaultHelpMenuContent,\n\tKeyboardShortcutsMenuItem,\n} from './lib/ui/components/HelpMenu/DefaultHelpMenuContent'\nexport {\n\tDefaultKeyboardShortcutsDialog,\n\ttype TLUiKeyboardShortcutsDialogProps,\n} from './lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog'\nexport { DefaultKeyboardShortcutsDialogContent } from './lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent'\nexport { LanguageMenu } from './lib/ui/components/LanguageMenu'\nexport { InputModeMenu } from './lib/ui/components/InputModeMenu'\nexport {\n\tDefaultMainMenu,\n\ttype TLUiMainMenuProps,\n} from './lib/ui/components/MainMenu/DefaultMainMenu'\nexport {\n\tDefaultMainMenuContent,\n\tEditSubmenu,\n\tExportFileContentSubMenu,\n\tExtrasGroup,\n\tLockGroup,\n\tMiscMenuGroup,\n\tPreferencesGroup,\n\tUndoRedoGroup,\n\tViewSubmenu,\n} from './lib/ui/components/MainMenu/DefaultMainMenuContent'\nexport {\n\tArrangeMenuSubmenu,\n\tClipboardMenuGroup,\n\tConversionsMenuGroup,\n\tConvertToBookmarkMenuItem,\n\tConvertToEmbedMenuItem,\n\tCopyAsMenuGroup,\n\tCopyMenuItem,\n\tCursorChatItem,\n\tCutMenuItem,\n\tDeleteMenuItem,\n\tDuplicateMenuItem,\n\tEditLinkMenuItem,\n\tEditMenuSubmenu,\n\tExportAsMenuGroup,\n\tFitFrameToContentMenuItem,\n\tGroupMenuItem,\n\tMoveToPageMenu,\n\tPasteMenuItem,\n\tPrintItem,\n\tRemoveFrameMenuItem,\n\tReorderMenuSubmenu,\n\tSelectAllMenuItem,\n\tToggleAutoSizeMenuItem,\n\tToggleDebugModeItem,\n\tToggleDynamicSizeModeItem,\n\tToggleEdgeScrollingItem,\n\tToggleEnhancedA11yModeItem,\n\tToggleFocusModeItem,\n\tToggleGridItem,\n\tToggleInvertZoomItem,\n\tToggleKeyboardShortcutsItem,\n\tToggleLockMenuItem,\n\tTogglePasteAtCursorItem,\n\tToggleReduceMotionItem,\n\tToggleSnapModeItem,\n\tToggleToolLockItem,\n\tToggleTransparentBgMenuItem,\n\tToggleWrapModeItem,\n\tUngroupMenuItem,\n\tUnlockAllMenuItem,\n\tZoomTo100MenuItem,\n\tZoomToFitMenuItem,\n\tZoomToSelectionMenuItem,\n} from './lib/ui/components/menu-items'\nexport { DefaultMinimap } from './lib/ui/components/Minimap/DefaultMinimap'\nexport { MobileStylePanel } from './lib/ui/components/MobileStylePanel'\nexport { DefaultNavigationPanel } from './lib/ui/components/NavigationPanel/DefaultNavigationPanel'\nexport { OfflineIndicator } from './lib/ui/components/OfflineIndicator/OfflineIndicator'\nexport { DefaultPageMenu } from './lib/ui/components/PageMenu/DefaultPageMenu'\nexport { PageItemInput, type PageItemInputProps } from './lib/ui/components/PageMenu/PageItemInput'\nexport {\n\tPageItemSubmenu,\n\ttype PageItemSubmenuProps,\n} from './lib/ui/components/PageMenu/PageItemSubmenu'\nexport {\n\tTldrawUiButton,\n\ttype TLUiButtonProps,\n} from './lib/ui/components/primitives/Button/TldrawUiButton'\nexport {\n\tTldrawUiButtonCheck,\n\ttype TLUiButtonCheckProps,\n} from './lib/ui/components/primitives/Button/TldrawUiButtonCheck'\nexport {\n\tTldrawUiButtonIcon,\n\ttype TLUiButtonIconProps,\n} from './lib/ui/components/primitives/Button/TldrawUiButtonIcon'\nexport {\n\tTldrawUiButtonLabel,\n\ttype TLUiButtonLabelProps,\n} from './lib/ui/components/primitives/Button/TldrawUiButtonLabel'\nexport {\n\tTldrawUiMenuCheckboxItem,\n\ttype TLUiMenuCheckboxItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem'\nexport {\n\tTldrawUiMenuContextProvider,\n\ttype TLUiMenuContextProviderProps,\n\ttype TLUiMenuContextType,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuContext'\nexport {\n\tTldrawUiMenuGroup,\n\ttype TLUiMenuGroupProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuGroup'\nexport {\n\tTldrawUiMenuItem,\n\ttype TLUiMenuItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuItem'\nexport {\n\tTldrawUiMenuSubmenu,\n\ttype TLUiMenuSubmenuProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuSubmenu'\nexport {\n\tTldrawUiContextualToolbar,\n\ttype TLUiContextualToolbarProps,\n} from './lib/ui/components/primitives/TldrawUiContextualToolbar'\nexport {\n\tTldrawUiDialogBody,\n\tTldrawUiDialogCloseButton,\n\tTldrawUiDialogFooter,\n\tTldrawUiDialogHeader,\n\tTldrawUiDialogTitle,\n\ttype TLUiDialogBodyProps,\n\ttype TLUiDialogFooterProps,\n\ttype TLUiDialogHeaderProps,\n\ttype TLUiDialogTitleProps,\n} from './lib/ui/components/primitives/TldrawUiDialog'\nexport {\n\tTldrawUiDropdownMenuCheckboxItem,\n\tTldrawUiDropdownMenuContent,\n\tTldrawUiDropdownMenuGroup,\n\tTldrawUiDropdownMenuIndicator,\n\tTldrawUiDropdownMenuItem,\n\tTldrawUiDropdownMenuRoot,\n\tTldrawUiDropdownMenuSub,\n\tTldrawUiDropdownMenuSubContent,\n\tTldrawUiDropdownMenuSubTrigger,\n\tTldrawUiDropdownMenuTrigger,\n\ttype TLUiDropdownMenuCheckboxItemProps,\n\ttype TLUiDropdownMenuContentProps,\n\ttype TLUiDropdownMenuGroupProps,\n\ttype TLUiDropdownMenuItemProps,\n\ttype TLUiDropdownMenuRootProps,\n\ttype TLUiDropdownMenuSubContentProps,\n\ttype TLUiDropdownMenuSubProps,\n\ttype TLUiDropdownMenuSubTriggerProps,\n\ttype TLUiDropdownMenuTriggerProps,\n} from './lib/ui/components/primitives/TldrawUiDropdownMenu'\nexport {\n\tTldrawUiIcon,\n\ttype TLUiIconJsx,\n\ttype TLUiIconProps,\n} from './lib/ui/components/primitives/TldrawUiIcon'\nexport { TldrawUiInput, type TLUiInputProps } from './lib/ui/components/primitives/TldrawUiInput'\nexport { TldrawUiKbd, type TLUiKbdProps } from './lib/ui/components/primitives/TldrawUiKbd'\nexport {\n\tTldrawUiPopover,\n\tTldrawUiPopoverContent,\n\tTldrawUiPopoverTrigger,\n\ttype TLUiPopoverContentProps,\n\ttype TLUiPopoverProps,\n\ttype TLUiPopoverTriggerProps,\n} from './lib/ui/components/primitives/TldrawUiPopover'\nexport {\n\tTldrawUiSelect,\n\tTldrawUiSelectContent,\n\tTldrawUiSelectItem,\n\tTldrawUiSelectTrigger,\n\tTldrawUiSelectValue,\n\ttype TLUiSelectContentProps,\n\ttype TLUiSelectItemProps,\n\ttype TLUiSelectProps,\n\ttype TLUiSelectTriggerProps,\n\ttype TLUiSelectValueProps,\n} from './lib/ui/components/primitives/TldrawUiSelect'\nexport { TldrawUiSlider, type TLUiSliderProps } from './lib/ui/components/primitives/TldrawUiSlider'\nexport {\n\tTldrawUiToolbar,\n\tTldrawUiToolbarButton,\n\tTldrawUiToolbarToggleGroup,\n\tTldrawUiToolbarToggleItem,\n\ttype TLUiToolbarButtonProps,\n\ttype TLUiToolbarProps,\n\ttype TLUiToolbarToggleGroupProps,\n\ttype TLUiToolbarToggleItemProps,\n} from './lib/ui/components/primitives/TldrawUiToolbar'\nexport {\n\thideAllTooltips,\n\tTldrawUiTooltip,\n\tTldrawUiTooltipProvider,\n\ttype TldrawUiTooltipProps,\n\ttype TldrawUiTooltipProviderProps,\n} from './lib/ui/components/primitives/TldrawUiTooltip'\nexport {\n\tDefaultQuickActions,\n\ttype TLUiQuickActionsProps,\n} from './lib/ui/components/QuickActions/DefaultQuickActions'\nexport { DefaultQuickActionsContent } from './lib/ui/components/QuickActions/DefaultQuickActionsContent'\nexport {\n\tDefaultPeopleMenu,\n\t// legacy\n\tDefaultPeopleMenu as PeopleMenu,\n\ttype DefaultPeopleMenuProps,\n\ttype DefaultPeopleMenuProps as PeopleMenuProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenu'\nexport {\n\tDefaultPeopleMenuAvatar,\n\ttype TLUiPeopleMenuAvatarProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenuAvatar'\nexport {\n\tDefaultPeopleMenuContent,\n\ttype DefaultPeopleMenuContentProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenuContent'\nexport {\n\tDefaultPeopleMenuFacePile,\n\ttype TLUiPeopleMenuFacePileProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenuFacePile'\nexport {\n\tDefaultPeopleMenuItem,\n\ttype TLUiPeopleMenuItemProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenuItem'\nexport { DefaultSharePanel } from './lib/ui/components/SharePanel/DefaultSharePanel'\nexport { DefaultUserPresenceEditor } from './lib/ui/components/SharePanel/DefaultUserPresenceEditor'\nexport { Spinner } from './lib/ui/components/Spinner'\nexport {\n\tDefaultStylePanel,\n\ttype TLUiStylePanelProps,\n} from './lib/ui/components/StylePanel/DefaultStylePanel'\nexport {\n\tDefaultStylePanelContent,\n\tStylePanelArrowheadPicker,\n\tStylePanelArrowKindPicker,\n\tStylePanelColorPicker,\n\tStylePanelDashPicker,\n\tStylePanelFillPicker,\n\tStylePanelFontPicker,\n\tStylePanelGeoShapePicker,\n\tStylePanelLabelAlignPicker,\n\tStylePanelOpacityPicker,\n\tStylePanelSection,\n\tStylePanelSizePicker,\n\tStylePanelSplinePicker,\n\tStylePanelTextAlignPicker,\n\ttype StylePanelSectionProps,\n} from './lib/ui/components/StylePanel/DefaultStylePanelContent'\nexport {\n\tStylePanelButtonPicker,\n\tStylePanelButtonPickerInline,\n\ttype StylePanelButtonPickerProps,\n} from './lib/ui/components/StylePanel/StylePanelButtonPicker'\nexport {\n\tStylePanelContextProvider,\n\tuseStylePanelContext,\n\ttype StylePanelContext,\n\ttype StylePanelContextProviderProps,\n} from './lib/ui/components/StylePanel/StylePanelContext'\nexport {\n\tStylePanelDoubleDropdownPicker,\n\tStylePanelDoubleDropdownPickerInline,\n\ttype StylePanelDoubleDropdownPickerProps,\n} from './lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker'\nexport {\n\tStylePanelDropdownPicker,\n\tStylePanelDropdownPickerInline,\n\ttype StylePanelDropdownPickerProps,\n} from './lib/ui/components/StylePanel/StylePanelDropdownPicker'\nexport {\n\tStylePanelSubheading,\n\ttype StylePanelSubheadingProps,\n} from './lib/ui/components/StylePanel/StylePanelSubheading'\nexport {\n\tDefaultImageToolbar,\n\ttype TLUiImageToolbarProps,\n} from './lib/ui/components/Toolbar/DefaultImageToolbar'\nexport {\n\tDefaultImageToolbarContent,\n\ttype DefaultImageToolbarContentProps,\n} from './lib/ui/components/Toolbar/DefaultImageToolbarContent'\nexport {\n\tDefaultRichTextToolbar,\n\ttype TLUiRichTextToolbarProps,\n} from './lib/ui/components/Toolbar/DefaultRichTextToolbar'\nexport {\n\tDefaultRichTextToolbarContent,\n\ttype DefaultRichTextToolbarContentProps,\n} from './lib/ui/components/Toolbar/DefaultRichTextToolbarContent'\nexport {\n\tDefaultToolbar,\n\ttype DefaultToolbarProps,\n} from './lib/ui/components/Toolbar/DefaultToolbar'\nexport {\n\tArrowDownToolbarItem,\n\tArrowLeftToolbarItem,\n\tArrowRightToolbarItem,\n\tArrowToolbarItem,\n\tArrowUpToolbarItem,\n\tAssetToolbarItem,\n\tCheckBoxToolbarItem,\n\tCloudToolbarItem,\n\tCommentToolbarItem,\n\tDefaultToolbarContent,\n\tDiamondToolbarItem,\n\tDrawToolbarItem,\n\tEllipseToolbarItem,\n\tEraserToolbarItem,\n\tFrameToolbarItem,\n\tHandToolbarItem,\n\tHeartToolbarItem,\n\tHexagonToolbarItem,\n\tHighlightToolbarItem,\n\tLaserToolbarItem,\n\tLineToolbarItem,\n\tNoteToolbarItem,\n\tOvalToolbarItem,\n\tRectangleToolbarItem,\n\tRhombusToolbarItem,\n\tSelectToolbarItem,\n\tStarToolbarItem,\n\tTextToolbarItem,\n\tToolbarItem,\n\tTrapezoidToolbarItem,\n\tTriangleToolbarItem,\n\tuseIsToolSelected,\n\tXBoxToolbarItem,\n\ttype ToolbarItemProps,\n} from './lib/ui/components/Toolbar/DefaultToolbarContent'\nexport {\n\tDefaultVideoToolbar,\n\ttype TLUiVideoToolbarProps,\n} from './lib/ui/components/Toolbar/DefaultVideoToolbar'\nexport {\n\tDefaultVideoToolbarContent,\n\ttype DefaultVideoToolbarContentProps,\n} from './lib/ui/components/Toolbar/DefaultVideoToolbarContent'\nexport {\n\tOverflowingToolbar,\n\ttype OverflowingToolbarProps,\n} from './lib/ui/components/Toolbar/OverflowingToolbar'\nexport {\n\tToggleToolLockedButton,\n\ttype ToggleToolLockedButtonProps,\n} from './lib/ui/components/Toolbar/ToggleToolLockedButton'\nexport {\n\tCenteredTopPanelContainer,\n\ttype CenteredTopPanelContainerProps,\n} from './lib/ui/components/TopPanel/CenteredTopPanelContainer'\nexport {\n\tDefaultZoomMenu,\n\ttype TLUiZoomMenuProps,\n} from './lib/ui/components/ZoomMenu/DefaultZoomMenu'\nexport { DefaultZoomMenuContent } from './lib/ui/components/ZoomMenu/DefaultZoomMenuContent'\nexport { PORTRAIT_BREAKPOINT } from './lib/ui/constants'\nexport {\n\tTldrawUiA11yProvider,\n\tuseA11y,\n\ttype A11yPriority,\n\ttype A11yProviderProps,\n\ttype TLUiA11y,\n\ttype TLUiA11yContextType,\n} from './lib/ui/context/a11y'\nexport {\n\tunwrapLabel,\n\tuseActions,\n\ttype ActionsProviderProps,\n\ttype TLUiActionItem,\n\ttype TLUiActionsContextType,\n} from './lib/ui/context/actions'\nexport {\n\tAssetUrlsProvider,\n\tuseAssetUrls,\n\ttype AssetUrlsProviderProps,\n} from './lib/ui/context/asset-urls'\nexport {\n\tBreakPointProvider,\n\tuseBreakpoint,\n\ttype BreakPointProviderProps,\n} from './lib/ui/context/breakpoints'\nexport {\n\tTldrawUiComponentsProvider,\n\tuseTldrawUiComponents,\n\ttype TLUiComponents,\n\ttype TLUiComponentsProviderProps,\n} from './lib/ui/context/components'\nexport {\n\tTldrawUiDialogsProvider,\n\tuseDialogs,\n\ttype TLUiDialog,\n\ttype TLUiDialogProps,\n\ttype TLUiDialogsContextType,\n\ttype TLUiDialogsProviderProps,\n} from './lib/ui/context/dialogs'\nexport {\n\tTldrawUiEventsProvider,\n\tuseUiEvents,\n\ttype EventsProviderProps,\n\ttype TLUiEventContextType,\n\ttype TLUiEventData,\n\ttype TLUiEventHandler,\n\ttype TLUiEventMap,\n\ttype TLUiEventSource,\n} from './lib/ui/context/events'\nexport {\n\tTldrawUiContextProvider,\n\ttype TLUiContextProviderProps,\n} from './lib/ui/context/TldrawUiContextProvider'\nexport {\n\tTldrawUiToastsProvider,\n\tuseToasts,\n\ttype AlertSeverity,\n\ttype TLUiToast,\n\ttype TLUiToastAction,\n\ttype TLUiToastsContextType,\n\ttype TLUiToastsProviderProps,\n} from './lib/ui/context/toasts'\nexport {\n\tuseCanApplySelectionAction,\n\tuseCanRedo,\n\tuseCanUndo,\n\tuseUnlockedSelectedShapesCount,\n} from './lib/ui/hooks/menu-hooks'\nexport {\n\thandleNativeOrMenuCopy,\n\tuseMenuClipboardEvents,\n\tuseNativeClipboardEvents,\n} from './lib/ui/hooks/useClipboardEvents'\nexport {\n\tuseCollaborationStatus,\n\tuseShowCollaborationUi,\n} from './lib/ui/hooks/useCollaborationStatus'\nexport { useCopyAs } from './lib/ui/hooks/useCopyAs'\nexport { useExportAs } from './lib/ui/hooks/useExportAs'\nexport { useKeyboardShortcuts } from './lib/ui/hooks/useKeyboardShortcuts'\nexport { useLocalStorageState } from './lib/ui/hooks/useLocalStorageState'\nexport { useMenuIsOpen } from './lib/ui/hooks/useMenuIsOpen'\nexport { useReadonly } from './lib/ui/hooks/useReadonly'\nexport { useSomeActionsEnabled } from './lib/ui/hooks/useActionState'\nexport { useRelevantStyles } from './lib/ui/hooks/useRelevantStyles'\nexport {\n\tonDragFromToolbarToCreateShape,\n\tuseTools,\n\ttype OnDragFromToolbarToCreateShapesOpts,\n\ttype TLUiToolItem,\n\ttype TLUiToolsContextType,\n\ttype TLUiToolsProviderProps,\n} from './lib/ui/hooks/useTools'\nexport { type TLUiTranslationKey } from './lib/ui/hooks/useTranslation/TLUiTranslationKey'\nexport { RTL_LANGUAGES, type TLUiTranslation } from './lib/ui/hooks/useTranslation/translations'\nexport {\n\tuseCurrentTranslation,\n\tuseDirection,\n\tuseMaybeCurrentTranslation,\n\tuseTranslation,\n\ttype TLUiTranslationContextType,\n\ttype TLUiTranslationProviderProps,\n\ttype TLUiTranslationValues,\n} from './lib/ui/hooks/useTranslation/useTranslation'\nexport { iconTypes, type TLUiIconType } from './lib/ui/icon-types'\nexport { useDefaultHelpers, type TLUiOverrideHelpers, type TLUiOverrides } from './lib/ui/overrides'\nexport { TldrawUi, TldrawUiInFrontOfTheCanvas, type TldrawUiProps } from './lib/ui/TldrawUi'\nexport { containBoxSize, downsizeImage, type BoxWidthHeight } from './lib/utils/assets/assets'\nexport { preloadFont, type TLTypeFace } from './lib/utils/assets/preload-font'\nexport { getEmbedInfo, type TLEmbedResult } from './lib/utils/embeds/embeds'\nexport { putExcalidrawContent } from './lib/utils/excalidraw/putExcalidrawContent'\nexport { copyAs, type CopyAsOptions, type TLCopyType } from './lib/utils/export/copyAs'\nexport { downloadFile, exportAs, type ExportAsOptions } from './lib/utils/export/exportAs'\nexport { fitFrameToContent, removeFrame } from './lib/utils/frames/frames'\nexport {\n\tdefaultEditorAssetUrls,\n\tsetDefaultEditorAssetUrls,\n\ttype TLEditorAssetUrls,\n} from './lib/utils/static-assets/assetUrls'\nexport { sanitizeSvg } from './lib/utils/svg/sanitizeSvg'\nexport {\n\tdefaultAddFontsFromNode,\n\tgetTipTapDefaultExtensions,\n\tKeyboardShiftEnterTweakExtension,\n\trenderHtmlFromRichText,\n\trenderHtmlFromRichTextForMeasurement,\n\trenderHtmlFromRichTextWithExtensions,\n\trenderPlaintextFromRichText,\n\trenderRichTextFromHTML,\n\ttipTapDefaultExtensions,\n} from './lib/utils/text/richText'\nexport { truncateStringWithEllipsis } from './lib/utils/text/text'\nexport {\n\tExtension,\n\tgetSchema,\n\tMark,\n\tmergeAttributes,\n\tNode,\n\tTaskItem,\n\tTaskList,\n\ttype Extensions,\n\ttype JSONContent,\n\ttype TaskItemOptions,\n\ttype TaskListOptions,\n} from './lib/utils/text/tiptap'\nexport {\n\tdefaultWrappingPairs,\n\tWrapSelectionExtension,\n\ttype WrapSelectionOptions,\n} from './lib/utils/text/wrapSelection'\nexport {\n\tbuildFromV1Document,\n\tTLV1AlignStyle,\n\tTLV1AssetType,\n\tTLV1ColorStyle,\n\tTLV1DashStyle,\n\tTLV1Decoration,\n\tTLV1FontStyle,\n\tTLV1ShapeType,\n\tTLV1SizeStyle,\n\ttype TLV1ArrowBinding,\n\ttype TLV1ArrowShape,\n\ttype TLV1Asset,\n\ttype TLV1BaseAsset,\n\ttype TLV1BaseBinding,\n\ttype TLV1BaseShape,\n\ttype TLV1Binding,\n\ttype TLV1Bounds,\n\ttype TLV1Document,\n\ttype TLV1DrawShape,\n\ttype TLV1EllipseShape,\n\ttype TLV1GroupShape,\n\ttype TLV1Handle,\n\ttype TLV1ImageAsset,\n\ttype TLV1ImageShape,\n\ttype TLV1Page,\n\ttype TLV1PageState,\n\ttype TLV1RectangleShape,\n\ttype TLV1Shape,\n\ttype TLV1ShapeStyles,\n\ttype TLV1StickyShape,\n\ttype TLV1TextShape,\n\ttype TLV1TriangleShape,\n\ttype TLV1VideoAsset,\n\ttype TLV1VideoShape,\n} from './lib/utils/tldr/buildFromV1Document'\nexport {\n\tparseAndLoadDocument,\n\tparseTldrawJsonFile,\n\tserializeTldrawJson,\n\tserializeTldrawJsonBlob,\n\tTLDRAW_FILE_EXTENSION,\n\ttype TldrawFile,\n\ttype TldrawFileParseError,\n} from './lib/utils/tldr/file'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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C/C,IAAAC,oBAIO;AACP,yBAA4B;AAC5B,sBAUO;AACP,kBAA2C;AAC3C,oBAYO;AACP,2BAIO;AACP,iCAmCO;AACP,kBAQO;AAAA,IAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["/// <reference types=\"react\" />\n\nimport { registerTldrawLibraryVersion } from '@tldraw/editor'\nexport { getPointsFromDrawSegment, getPointsFromDrawSegments } from './lib/shapes/draw/getPath'\nexport {\n\tPathBuilder,\n\tPathBuilderGeometry2d,\n\ttype BasePathBuilderOpts,\n\ttype CubicBezierToPathBuilderCommand,\n\ttype DashedPathBuilderOpts,\n\ttype DrawPathBuilderDOpts,\n\ttype DrawPathBuilderOpts,\n\ttype NonePathBuilderOpts,\n\ttype LineToPathBuilderCommand,\n\ttype MoveToPathBuilderCommand,\n\ttype PathBuilderCommand,\n\ttype PathBuilderCommandBase,\n\ttype PathBuilderCommandInfo,\n\ttype PathBuilderCommandOpts,\n\ttype PathBuilderLineOpts,\n\ttype PathBuilderOpts,\n\ttype PathBuilderToDOpts,\n\ttype SolidPathBuilderOpts,\n} from './lib/shapes/shared/PathBuilder'\nexport { usePrefersReducedMotion } from './lib/shapes/shared/usePrefersReducedMotion'\nexport { startEditingShapeWithRichText } from './lib/tools/SelectTool/selectHelpers'\nexport { DefaultA11yAnnouncer, useSelectedShapesAnnouncer } from './lib/ui/components/A11y'\nexport { AccessibilityMenu } from './lib/ui/components/AccessibilityMenu'\nexport { ColorSchemeMenu } from './lib/ui/components/ColorSchemeMenu'\nexport { DefaultFollowingIndicator } from './lib/ui/components/DefaultFollowingIndicator'\nexport { DefaultDialogs } from './lib/ui/components/Dialogs'\nexport {\n\tTldrawUiColumn,\n\tTldrawUiGrid,\n\tTldrawUiOrientationProvider,\n\tTldrawUiRow,\n\tuseTldrawUiOrientation,\n\ttype TldrawUiOrientationContext,\n\ttype TldrawUiOrientationProviderProps,\n\ttype TLUiLayoutProps,\n} from './lib/ui/components/primitives/layout'\nexport {\n\tTldrawUiMenuActionCheckboxItem,\n\ttype TLUiMenuActionCheckboxItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuActionCheckboxItem'\nexport {\n\tTldrawUiMenuActionItem,\n\ttype TLUiMenuActionItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuActionItem'\nexport {\n\tTldrawUiMenuToolItem,\n\ttype TLUiMenuToolItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuToolItem'\nexport { DefaultToasts } from './lib/ui/components/Toasts'\nexport {\n\tF,\n\tuseTldrawI18n,\n\ttype TLUiMessageProps,\n\ttype TLUiMessageValues,\n} from './lib/ui/context/i18n'\nexport { TldrawUiTranslationProvider } from './lib/ui/hooks/useTranslation/useTranslation'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/editor'\nexport { BookmarkAssetUtil } from './lib/assets/BookmarkAssetUtil'\nexport { ImageAssetUtil } from './lib/assets/ImageAssetUtil'\nexport { VideoAssetUtil } from './lib/assets/VideoAssetUtil'\nexport {\n\tArrowBindingHintOverlayUtil,\n\ttype TLArrowBindingHintOverlay,\n} from './lib/overlays/ArrowBindingHintOverlayUtil'\nexport { ArrowBindingUtil } from './lib/bindings/arrow/ArrowBindingUtil'\nexport { ArrowHintOverlayUtil, type TLArrowHintOverlay } from './lib/overlays/ArrowHintOverlayUtil'\nexport {\n\tBrushOverlayUtil,\n\ttype BrushOverlayUtilDisplayValues,\n\ttype BrushOverlayUtilOptions,\n\ttype TLBrushOverlay,\n} from './lib/overlays/BrushOverlayUtil'\nexport { ZoomBrushOverlayUtil, type TLZoomBrushOverlay } from './lib/overlays/ZoomBrushOverlayUtil'\nexport { ScribbleOverlayUtil, type TLScribbleOverlay } from './lib/overlays/ScribbleOverlayUtil'\nexport {\n\tCollaboratorHintOverlayUtil,\n\ttype TLCollaboratorHintOverlay,\n} from './lib/overlays/CollaboratorHintOverlayUtil'\n// Deprecated, but still exported so apps that customized canvas-drawn cursors keep working.\n// oxlint-disable-next-line typescript/no-deprecated\nexport { CollaboratorCursorOverlayUtil } from './lib/overlays/CollaboratorCursorOverlayUtil'\n// oxlint-disable-next-line typescript/no-deprecated\nexport type { TLCollaboratorCursorOverlay } from './lib/overlays/CollaboratorCursorOverlayUtil'\nexport {\n\tCollaboratorBrushOverlayUtil,\n\ttype TLCollaboratorBrushOverlay,\n} from './lib/overlays/CollaboratorBrushOverlayUtil'\nexport {\n\tCollaboratorScribbleOverlayUtil,\n\ttype TLCollaboratorScribbleOverlay,\n} from './lib/overlays/CollaboratorScribbleOverlayUtil'\nexport {\n\tCollaboratorShapeIndicatorOverlayUtil,\n\ttype TLCollaboratorShapeIndicatorOverlay,\n} from './lib/overlays/CollaboratorShapeIndicatorOverlayUtil'\nexport {\n\tShapeHandleOverlayUtil,\n\ttype TLShapeHandleOverlay,\n} from './lib/overlays/ShapeHandleOverlayUtil'\nexport {\n\tShapeIndicatorOverlayUtil,\n\ttype TLShapeIndicatorOverlay,\n} from './lib/overlays/ShapeIndicatorOverlayUtil'\nexport {\n\tSelectionForegroundOverlayUtil,\n\ttype TLSelectionForegroundOverlay,\n} from './lib/overlays/SelectionForegroundOverlayUtil'\nexport {\n\tSnapIndicatorOverlayUtil,\n\ttype TLSnapIndicatorOverlay,\n} from './lib/overlays/SnapIndicatorOverlayUtil'\nexport { defaultAssetUtils } from './lib/defaultAssetUtils'\nexport { defaultBindingUtils } from './lib/defaultBindingUtils'\nexport { defaultOverlayUtils } from './lib/defaultOverlayUtils'\nexport {\n\tDEFAULT_EMBED_DEFINITIONS,\n\tembedShapePermissionDefaults,\n\tunknownEmbedShapePermissionOverrides,\n\ttype CustomEmbedDefinition,\n\ttype DefaultEmbedConfig,\n\ttype DefaultEmbedDefinitionType,\n\ttype EmbedDefinition,\n\ttype GoogleMapsEmbedConfig,\n\ttype TLEmbedDefinition,\n\ttype TLEmbedShapePermissions,\n} from './lib/defaultEmbedDefinitions'\nexport {\n\tcenterSelectionAroundPoint,\n\tcreateEmptyBookmarkShape,\n\tcreateShapesForAssets,\n\tDEFAULT_MAX_ASSET_SIZE,\n\tDEFAULT_MAX_IMAGE_DIMENSION,\n\tdefaultHandleExternalEmbedContent,\n\tdefaultHandleExternalExcalidrawContent,\n\tdefaultHandleExternalFileAsset,\n\tdefaultHandleExternalFileContent,\n\tdefaultHandleExternalFileReplaceContent,\n\tdefaultHandleExternalSvgTextContent,\n\tdefaultHandleExternalTextContent,\n\tdefaultHandleExternalTldrawContent,\n\tdefaultHandleExternalUrlAsset,\n\tdefaultHandleExternalUrlContent,\n\tgetAssetInfo,\n\tnotifyIfFileNotAllowed,\n\tregisterDefaultExternalContentHandlers,\n\ttype TLDefaultExternalContentHandlerOpts,\n\ttype TLExternalContentProps,\n} from './lib/defaultExternalContentHandlers'\nexport { defaultShapeTools } from './lib/defaultShapeTools'\nexport { defaultShapeUtils } from './lib/defaultShapeUtils'\nexport { registerDefaultSideEffects } from './lib/defaultSideEffects'\nexport { defaultTools } from './lib/defaultTools'\nexport {\n\ttype ArrowShapeOptions,\n\ttype ArrowShapeUtilDisplayValues,\n\ttype TLArcArrowInfo,\n\ttype TLArcInfo,\n\ttype TLArrowInfo,\n\ttype TLArrowPoint,\n\ttype TLElbowArrowInfo,\n\ttype TLStraightArrowInfo,\n} from './lib/shapes/arrow/arrow-types'\nexport { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'\nexport { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'\nexport {\n\tclearArrowTargetState,\n\tgetArrowTargetState,\n\tupdateArrowTargetState,\n\ttype ArrowTargetState,\n\ttype UpdateArrowTargetStateOpts,\n} from './lib/shapes/arrow/arrowTargetState'\nexport {\n\ttype ElbowArrowBox,\n\ttype ElbowArrowBoxEdges,\n\ttype ElbowArrowBoxes,\n\ttype ElbowArrowEdge,\n\ttype ElbowArrowInfo,\n\ttype ElbowArrowInfoWithoutRoute,\n\ttype ElbowArrowMidpointHandle,\n\ttype ElbowArrowOptions,\n\ttype ElbowArrowRange,\n\ttype ElbowArrowRoute,\n\ttype ElbowArrowSide,\n\ttype ElbowArrowSideReason,\n\ttype ElbowArrowTargetBox,\n} from './lib/shapes/arrow/elbow/definitions'\nexport { getArrowInfo } from './lib/shapes/arrow/getArrowInfo'\nexport {\n\tgetArrowBindings,\n\tgetArrowTerminalsInArrowSpace,\n\ttype TLArrowBindings,\n} from './lib/shapes/arrow/shared'\nexport { createBookmarkFromUrl } from './lib/shapes/bookmark/bookmarks'\nexport {\n\tBookmarkShapeUtil,\n\ttype BookmarkShapeOptions,\n\ttype BookmarkShapeUtilDisplayValues,\n} from './lib/shapes/bookmark/BookmarkShapeUtil'\nexport { DrawShapeTool } from './lib/shapes/draw/DrawShapeTool'\nexport {\n\tDrawShapeUtil,\n\ttype DrawShapeOptions,\n\ttype DrawShapeUtilDisplayValues,\n} from './lib/shapes/draw/DrawShapeUtil'\nexport {\n\tEmbedShapeUtil,\n\ttype EmbedShapeOptions,\n\ttype EmbedShapeUtilDisplayValues,\n} from './lib/shapes/embed/EmbedShapeUtil'\nexport { FrameShapeTool } from './lib/shapes/frame/FrameShapeTool'\nexport {\n\tFrameShapeUtil,\n\ttype FrameShapeOptions,\n\ttype FrameShapeUtilDisplayValues,\n} from './lib/shapes/frame/FrameShapeUtil'\nexport { GeoShapeTool } from './lib/shapes/geo/GeoShapeTool'\nexport {\n\tGeoShapeUtil,\n\ttype GeoShapeOptions,\n\ttype GeoShapeUtilDisplayValues,\n} from './lib/shapes/geo/GeoShapeUtil'\nexport {\n\tdefaultGeoTypeDefinitions,\n\tgetGeoTypeDefinition,\n\ttype GeoTypeDefinition,\n} from './lib/shapes/geo/getGeoShapePath'\nexport { HighlightShapeTool } from './lib/shapes/highlight/HighlightShapeTool'\nexport {\n\tHighlightShapeUtil,\n\ttype HighlightShapeOptions,\n\ttype HighlightShapeUtilDisplayValues,\n} from './lib/shapes/highlight/HighlightShapeUtil'\nexport {\n\tImageShapeUtil,\n\ttype ImageShapeOptions,\n\ttype ImageShapeUtilDisplayValues,\n} from './lib/shapes/image/ImageShapeUtil'\nexport { LineShapeTool } from './lib/shapes/line/LineShapeTool'\nexport {\n\tLineShapeUtil,\n\ttype LineShapeOptions,\n\ttype LineShapeUtilDisplayValues,\n} from './lib/shapes/line/LineShapeUtil'\nexport {\n\tDefaultNoteShapeAttribution,\n\ttype TLNoteShapeAttributionComponent,\n\ttype TLNoteShapeAttributionProps,\n} from './lib/shapes/note/DefaultNoteShapeAttribution'\nexport { NoteShapeTool } from './lib/shapes/note/NoteShapeTool'\nexport {\n\tNoteShapeUtil,\n\ttype NoteShapeOptions,\n\ttype NoteShapeUtilDisplayValues,\n} from './lib/shapes/note/NoteShapeUtil'\nexport {\n\tASPECT_RATIO_OPTIONS,\n\tASPECT_RATIO_TO_VALUE,\n\tgetCropBox,\n\tgetDefaultCrop,\n\tgetUncroppedSize,\n\ttype ASPECT_RATIO_OPTION,\n\ttype CropBoxOptions,\n} from './lib/shapes/shared/crop'\nexport { getFontFamily } from './lib/shapes/shared/default-shape-constants'\nexport {\n\tallDefaultFontFaces,\n\tDefaultFontFaces,\n\ttype TLDefaultFont,\n\ttype TLDefaultFonts,\n} from './lib/shapes/shared/defaultFonts'\nexport { getStroke } from './lib/shapes/shared/freehand/getStroke'\nexport { getStrokeOutlinePoints } from './lib/shapes/shared/freehand/getStrokeOutlinePoints'\nexport { getStrokePoints } from './lib/shapes/shared/freehand/getStrokePoints'\nexport { getSvgPathFromStrokePoints } from './lib/shapes/shared/freehand/svg'\nexport { type StrokeOptions, type StrokePoint } from './lib/shapes/shared/freehand/types'\nexport {\n\tgetDisplayValues,\n\ttype ShapeOptionsWithDisplayValues,\n} from './lib/shapes/shared/getDisplayValues'\nexport { PlainTextLabel, type PlainTextLabelProps } from './lib/shapes/shared/PlainTextLabel'\nexport {\n\tRichTextLabel,\n\tRichTextSVG,\n\ttype RichTextLabelProps,\n\ttype RichTextSVGProps,\n} from './lib/shapes/shared/RichTextLabel'\nexport { useEditablePlainText } from './lib/shapes/shared/useEditablePlainText'\nexport { useEditableRichText } from './lib/shapes/shared/useEditableRichText'\nexport {\n\tuseImageOrVideoAsset,\n\ttype UseImageOrVideoAssetOptions,\n} from './lib/shapes/shared/useImageOrVideoAsset'\nexport { PlainTextArea } from './lib/shapes/text/PlainTextArea'\nexport { RichTextArea, type TextAreaProps } from './lib/shapes/text/RichTextArea'\nexport { TextShapeTool } from './lib/shapes/text/TextShapeTool'\nexport {\n\tTextShapeUtil,\n\ttype TextShapeOptions,\n\ttype TextShapeUtilDisplayValues,\n} from './lib/shapes/text/TextShapeUtil'\nexport {\n\tVideoShapeUtil,\n\ttype VideoShapeOptions,\n\ttype VideoShapeUtilDisplayValues,\n} from './lib/shapes/video/VideoShapeUtil'\nexport { getColorStyleItems, getFontStyleItems, type StyleValuesForUi } from './lib/styles'\nexport { Tldraw, type TLComponents, type TldrawBaseProps, type TldrawProps } from './lib/Tldraw'\nexport { TldrawImage, type TldrawImageProps } from './lib/TldrawImage'\nexport { EraserTool } from './lib/tools/EraserTool/EraserTool'\nexport { HandTool } from './lib/tools/HandTool/HandTool'\nexport { LaserTool } from './lib/tools/LaserTool/LaserTool'\nexport { getHitShapeOnCanvasPointerDown } from './lib/tools/selection-logic/getHitShapeOnCanvasPointerDown'\nexport { SelectTool } from './lib/tools/SelectTool/SelectTool'\nexport { ZoomTool } from './lib/tools/ZoomTool/ZoomTool'\nexport {\n\tsetDefaultUiAssetUrls,\n\ttype TLUiAssetUrlOverrides,\n\ttype TLUiAssetUrls,\n} from './lib/ui/assetUrls'\nexport {\n\tDefaultActionsMenu,\n\ttype TLUiActionsMenuProps,\n} from './lib/ui/components/ActionsMenu/DefaultActionsMenu'\nexport {\n\tAlignMenuItems,\n\tDefaultActionsMenuContent,\n\tDistributeMenuItems,\n\tGroupOrUngroupMenuItem,\n\tReorderMenuItems,\n\tRotateCWMenuItem,\n\tStackMenuItems,\n\tZoomOrRotateMenuItem,\n} from './lib/ui/components/ActionsMenu/DefaultActionsMenuContent'\nexport {\n\tDefaultContextMenu as ContextMenu,\n\tDefaultContextMenu,\n\ttype TLUiContextMenuProps,\n} from './lib/ui/components/ContextMenu/DefaultContextMenu'\nexport { DefaultContextMenuContent } from './lib/ui/components/ContextMenu/DefaultContextMenuContent'\nexport {\n\tDefaultDebugMenu,\n\ttype TLUiDebugMenuProps,\n} from './lib/ui/components/DebugMenu/DefaultDebugMenu'\nexport {\n\tDebugFlags,\n\tDefaultDebugMenuContent,\n\tExampleDialog,\n\tFeatureFlags,\n\ttype CustomDebugFlags,\n\ttype DebugFlagsProps,\n\ttype ExampleDialogProps,\n\ttype FeatureFlagsProps,\n} from './lib/ui/components/DebugMenu/DefaultDebugMenuContent'\nexport { DefaultMenuPanel } from './lib/ui/components/DefaultMenuPanel'\nexport {\n\tDefaultHelperButtons,\n\ttype TLUiHelperButtonsProps,\n} from './lib/ui/components/HelperButtons/DefaultHelperButtons'\nexport { DefaultHelperButtonsContent } from './lib/ui/components/HelperButtons/DefaultHelperButtonsContent'\nexport {\n\tDefaultHelpMenu,\n\ttype TLUiHelpMenuProps,\n} from './lib/ui/components/HelpMenu/DefaultHelpMenu'\nexport {\n\tDefaultHelpMenuContent,\n\tKeyboardShortcutsMenuItem,\n} from './lib/ui/components/HelpMenu/DefaultHelpMenuContent'\nexport {\n\tDefaultKeyboardShortcutsDialog,\n\ttype TLUiKeyboardShortcutsDialogProps,\n} from './lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog'\nexport { DefaultKeyboardShortcutsDialogContent } from './lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent'\nexport { LanguageMenu } from './lib/ui/components/LanguageMenu'\nexport { InputModeMenu } from './lib/ui/components/InputModeMenu'\nexport {\n\tDefaultMainMenu,\n\ttype TLUiMainMenuProps,\n} from './lib/ui/components/MainMenu/DefaultMainMenu'\nexport {\n\tDefaultMainMenuContent,\n\tEditSubmenu,\n\tExportFileContentSubMenu,\n\tExtrasGroup,\n\tLockGroup,\n\tMiscMenuGroup,\n\tPreferencesGroup,\n\tUndoRedoGroup,\n\tViewSubmenu,\n} from './lib/ui/components/MainMenu/DefaultMainMenuContent'\nexport {\n\tArrangeMenuSubmenu,\n\tClipboardMenuGroup,\n\tConversionsMenuGroup,\n\tConvertToBookmarkMenuItem,\n\tConvertToEmbedMenuItem,\n\tCopyAsMenuGroup,\n\tCopyMenuItem,\n\tCursorChatItem,\n\tCutMenuItem,\n\tDeleteMenuItem,\n\tDuplicateMenuItem,\n\tEditLinkMenuItem,\n\tEditMenuSubmenu,\n\tExportAsMenuGroup,\n\tFitFrameToContentMenuItem,\n\tGroupMenuItem,\n\tMoveToPageMenu,\n\tPasteMenuItem,\n\tPrintItem,\n\tRemoveFrameMenuItem,\n\tReorderMenuSubmenu,\n\tSelectAllMenuItem,\n\tToggleAutoSizeMenuItem,\n\tToggleDebugModeItem,\n\tToggleDynamicSizeModeItem,\n\tToggleEdgeScrollingItem,\n\tToggleEnhancedA11yModeItem,\n\tToggleFocusModeItem,\n\tToggleGridItem,\n\tToggleInvertZoomItem,\n\tToggleKeyboardShortcutsItem,\n\tToggleLockMenuItem,\n\tTogglePasteAtCursorItem,\n\tToggleReduceMotionItem,\n\tToggleSnapModeItem,\n\tToggleToolLockItem,\n\tToggleTransparentBgMenuItem,\n\tToggleWrapModeItem,\n\tUngroupMenuItem,\n\tUnlockAllMenuItem,\n\tZoomTo100MenuItem,\n\tZoomToFitMenuItem,\n\tZoomToSelectionMenuItem,\n} from './lib/ui/components/menu-items'\nexport { DefaultMinimap } from './lib/ui/components/Minimap/DefaultMinimap'\nexport { MobileStylePanel } from './lib/ui/components/MobileStylePanel'\nexport { DefaultNavigationPanel } from './lib/ui/components/NavigationPanel/DefaultNavigationPanel'\nexport { OfflineIndicator } from './lib/ui/components/OfflineIndicator/OfflineIndicator'\nexport { DefaultPageMenu } from './lib/ui/components/PageMenu/DefaultPageMenu'\nexport { PageItemInput, type PageItemInputProps } from './lib/ui/components/PageMenu/PageItemInput'\nexport {\n\tPageItemSubmenu,\n\ttype PageItemSubmenuProps,\n} from './lib/ui/components/PageMenu/PageItemSubmenu'\nexport {\n\tTldrawUiButton,\n\ttype TLUiButtonProps,\n} from './lib/ui/components/primitives/Button/TldrawUiButton'\nexport {\n\tTldrawUiButtonCheck,\n\ttype TLUiButtonCheckProps,\n} from './lib/ui/components/primitives/Button/TldrawUiButtonCheck'\nexport {\n\tTldrawUiButtonIcon,\n\ttype TLUiButtonIconProps,\n} from './lib/ui/components/primitives/Button/TldrawUiButtonIcon'\nexport {\n\tTldrawUiButtonLabel,\n\ttype TLUiButtonLabelProps,\n} from './lib/ui/components/primitives/Button/TldrawUiButtonLabel'\nexport {\n\tTldrawUiMenuCheckboxItem,\n\ttype TLUiMenuCheckboxItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem'\nexport {\n\tTldrawUiMenuContextProvider,\n\ttype TLUiMenuContextProviderProps,\n\ttype TLUiMenuContextType,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuContext'\nexport {\n\tTldrawUiMenuGroup,\n\ttype TLUiMenuGroupProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuGroup'\nexport {\n\tTldrawUiMenuItem,\n\ttype TLUiMenuItemProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuItem'\nexport {\n\tTldrawUiMenuSubmenu,\n\ttype TLUiMenuSubmenuProps,\n} from './lib/ui/components/primitives/menus/TldrawUiMenuSubmenu'\nexport {\n\tTldrawUiContextualToolbar,\n\ttype TLUiContextualToolbarProps,\n} from './lib/ui/components/primitives/TldrawUiContextualToolbar'\nexport {\n\tTldrawUiDialogBody,\n\tTldrawUiDialogCloseButton,\n\tTldrawUiDialogFooter,\n\tTldrawUiDialogHeader,\n\tTldrawUiDialogTitle,\n\ttype TLUiDialogBodyProps,\n\ttype TLUiDialogFooterProps,\n\ttype TLUiDialogHeaderProps,\n\ttype TLUiDialogTitleProps,\n} from './lib/ui/components/primitives/TldrawUiDialog'\nexport {\n\tTldrawUiDropdownMenuCheckboxItem,\n\tTldrawUiDropdownMenuContent,\n\tTldrawUiDropdownMenuGroup,\n\tTldrawUiDropdownMenuIndicator,\n\tTldrawUiDropdownMenuItem,\n\tTldrawUiDropdownMenuRoot,\n\tTldrawUiDropdownMenuSub,\n\tTldrawUiDropdownMenuSubContent,\n\tTldrawUiDropdownMenuSubTrigger,\n\tTldrawUiDropdownMenuTrigger,\n\ttype TLUiDropdownMenuCheckboxItemProps,\n\ttype TLUiDropdownMenuContentProps,\n\ttype TLUiDropdownMenuGroupProps,\n\ttype TLUiDropdownMenuItemProps,\n\ttype TLUiDropdownMenuRootProps,\n\ttype TLUiDropdownMenuSubContentProps,\n\ttype TLUiDropdownMenuSubProps,\n\ttype TLUiDropdownMenuSubTriggerProps,\n\ttype TLUiDropdownMenuTriggerProps,\n} from './lib/ui/components/primitives/TldrawUiDropdownMenu'\nexport {\n\tTldrawUiIcon,\n\ttype TLUiIconJsx,\n\ttype TLUiIconProps,\n} from './lib/ui/components/primitives/TldrawUiIcon'\nexport { TldrawUiInput, type TLUiInputProps } from './lib/ui/components/primitives/TldrawUiInput'\nexport { TldrawUiKbd, type TLUiKbdProps } from './lib/ui/components/primitives/TldrawUiKbd'\nexport {\n\tTldrawUiPopover,\n\tTldrawUiPopoverContent,\n\tTldrawUiPopoverTrigger,\n\ttype TLUiPopoverContentProps,\n\ttype TLUiPopoverProps,\n\ttype TLUiPopoverTriggerProps,\n} from './lib/ui/components/primitives/TldrawUiPopover'\nexport {\n\tTldrawUiSelect,\n\tTldrawUiSelectContent,\n\tTldrawUiSelectItem,\n\tTldrawUiSelectTrigger,\n\tTldrawUiSelectValue,\n\ttype TLUiSelectContentProps,\n\ttype TLUiSelectItemProps,\n\ttype TLUiSelectProps,\n\ttype TLUiSelectTriggerProps,\n\ttype TLUiSelectValueProps,\n} from './lib/ui/components/primitives/TldrawUiSelect'\nexport { TldrawUiSlider, type TLUiSliderProps } from './lib/ui/components/primitives/TldrawUiSlider'\nexport {\n\tTldrawUiToolbar,\n\tTldrawUiToolbarButton,\n\tTldrawUiToolbarToggleGroup,\n\tTldrawUiToolbarToggleItem,\n\ttype TLUiToolbarButtonProps,\n\ttype TLUiToolbarProps,\n\ttype TLUiToolbarToggleGroupProps,\n\ttype TLUiToolbarToggleItemProps,\n} from './lib/ui/components/primitives/TldrawUiToolbar'\nexport {\n\thideAllTooltips,\n\tTldrawUiTooltip,\n\tTldrawUiTooltipProvider,\n\ttype TldrawUiTooltipProps,\n\ttype TldrawUiTooltipProviderProps,\n} from './lib/ui/components/primitives/TldrawUiTooltip'\nexport {\n\tDefaultQuickActions,\n\ttype TLUiQuickActionsProps,\n} from './lib/ui/components/QuickActions/DefaultQuickActions'\nexport { DefaultQuickActionsContent } from './lib/ui/components/QuickActions/DefaultQuickActionsContent'\nexport {\n\tDefaultPeopleMenu,\n\t// legacy\n\tDefaultPeopleMenu as PeopleMenu,\n\ttype DefaultPeopleMenuProps,\n\ttype DefaultPeopleMenuProps as PeopleMenuProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenu'\nexport {\n\tDefaultPeopleMenuAvatar,\n\ttype TLUiPeopleMenuAvatarProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenuAvatar'\nexport {\n\tDefaultPeopleMenuContent,\n\ttype DefaultPeopleMenuContentProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenuContent'\nexport {\n\tDefaultPeopleMenuFacePile,\n\ttype TLUiPeopleMenuFacePileProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenuFacePile'\nexport {\n\tDefaultPeopleMenuItem,\n\ttype TLUiPeopleMenuItemProps,\n} from './lib/ui/components/SharePanel/DefaultPeopleMenuItem'\nexport { DefaultSharePanel } from './lib/ui/components/SharePanel/DefaultSharePanel'\nexport { DefaultUserPresenceEditor } from './lib/ui/components/SharePanel/DefaultUserPresenceEditor'\nexport { Spinner } from './lib/ui/components/Spinner'\nexport {\n\tDefaultStylePanel,\n\ttype TLUiStylePanelProps,\n} from './lib/ui/components/StylePanel/DefaultStylePanel'\nexport {\n\tDefaultStylePanelContent,\n\tStylePanelArrowheadPicker,\n\tStylePanelArrowKindPicker,\n\tStylePanelColorPicker,\n\tStylePanelDashPicker,\n\tStylePanelFillPicker,\n\tStylePanelFontPicker,\n\tStylePanelGeoShapePicker,\n\tStylePanelLabelAlignPicker,\n\tStylePanelOpacityPicker,\n\tStylePanelSection,\n\tStylePanelSizePicker,\n\tStylePanelSplinePicker,\n\tStylePanelTextAlignPicker,\n\ttype StylePanelSectionProps,\n} from './lib/ui/components/StylePanel/DefaultStylePanelContent'\nexport {\n\tStylePanelButtonPicker,\n\tStylePanelButtonPickerInline,\n\ttype StylePanelButtonPickerProps,\n} from './lib/ui/components/StylePanel/StylePanelButtonPicker'\nexport {\n\tStylePanelContextProvider,\n\tuseStylePanelContext,\n\ttype StylePanelContext,\n\ttype StylePanelContextProviderProps,\n} from './lib/ui/components/StylePanel/StylePanelContext'\nexport {\n\tStylePanelDoubleDropdownPicker,\n\tStylePanelDoubleDropdownPickerInline,\n\ttype StylePanelDoubleDropdownPickerProps,\n} from './lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker'\nexport {\n\tStylePanelDropdownPicker,\n\tStylePanelDropdownPickerInline,\n\ttype StylePanelDropdownPickerProps,\n} from './lib/ui/components/StylePanel/StylePanelDropdownPicker'\nexport {\n\tStylePanelSubheading,\n\ttype StylePanelSubheadingProps,\n} from './lib/ui/components/StylePanel/StylePanelSubheading'\nexport {\n\tDefaultImageToolbar,\n\ttype TLUiImageToolbarProps,\n} from './lib/ui/components/Toolbar/DefaultImageToolbar'\nexport {\n\tDefaultImageToolbarContent,\n\ttype DefaultImageToolbarContentProps,\n} from './lib/ui/components/Toolbar/DefaultImageToolbarContent'\nexport {\n\tDefaultRichTextToolbar,\n\ttype TLUiRichTextToolbarProps,\n} from './lib/ui/components/Toolbar/DefaultRichTextToolbar'\nexport {\n\tDefaultRichTextToolbarContent,\n\ttype DefaultRichTextToolbarContentProps,\n} from './lib/ui/components/Toolbar/DefaultRichTextToolbarContent'\nexport {\n\tDefaultToolbar,\n\ttype DefaultToolbarProps,\n} from './lib/ui/components/Toolbar/DefaultToolbar'\nexport {\n\tArrowDownToolbarItem,\n\tArrowLeftToolbarItem,\n\tArrowRightToolbarItem,\n\tArrowToolbarItem,\n\tArrowUpToolbarItem,\n\tAssetToolbarItem,\n\tCheckBoxToolbarItem,\n\tCloudToolbarItem,\n\tCommentToolbarItem,\n\tDefaultToolbarContent,\n\tDiamondToolbarItem,\n\tDrawToolbarItem,\n\tEllipseToolbarItem,\n\tEraserToolbarItem,\n\tFrameToolbarItem,\n\tHandToolbarItem,\n\tHeartToolbarItem,\n\tHexagonToolbarItem,\n\tHighlightToolbarItem,\n\tLaserToolbarItem,\n\tLineToolbarItem,\n\tNoteToolbarItem,\n\tOvalToolbarItem,\n\tRectangleToolbarItem,\n\tRhombusToolbarItem,\n\tSelectToolbarItem,\n\tStarToolbarItem,\n\tTextToolbarItem,\n\tToolbarItem,\n\tTrapezoidToolbarItem,\n\tTriangleToolbarItem,\n\tuseIsToolSelected,\n\tXBoxToolbarItem,\n\ttype ToolbarItemProps,\n} from './lib/ui/components/Toolbar/DefaultToolbarContent'\nexport {\n\tDefaultVideoToolbar,\n\ttype TLUiVideoToolbarProps,\n} from './lib/ui/components/Toolbar/DefaultVideoToolbar'\nexport {\n\tDefaultVideoToolbarContent,\n\ttype DefaultVideoToolbarContentProps,\n} from './lib/ui/components/Toolbar/DefaultVideoToolbarContent'\nexport {\n\tOverflowingToolbar,\n\ttype OverflowingToolbarProps,\n} from './lib/ui/components/Toolbar/OverflowingToolbar'\nexport {\n\tToggleToolLockedButton,\n\ttype ToggleToolLockedButtonProps,\n} from './lib/ui/components/Toolbar/ToggleToolLockedButton'\nexport {\n\tCenteredTopPanelContainer,\n\ttype CenteredTopPanelContainerProps,\n} from './lib/ui/components/TopPanel/CenteredTopPanelContainer'\nexport {\n\tDefaultZoomMenu,\n\ttype TLUiZoomMenuProps,\n} from './lib/ui/components/ZoomMenu/DefaultZoomMenu'\nexport { DefaultZoomMenuContent } from './lib/ui/components/ZoomMenu/DefaultZoomMenuContent'\nexport { PORTRAIT_BREAKPOINT } from './lib/ui/constants'\nexport {\n\tTldrawUiA11yProvider,\n\tuseA11y,\n\ttype A11yPriority,\n\ttype A11yProviderProps,\n\ttype TLUiA11y,\n\ttype TLUiA11yContextType,\n} from './lib/ui/context/a11y'\nexport {\n\tunwrapLabel,\n\tuseActions,\n\ttype ActionsProviderProps,\n\ttype TLUiActionItem,\n\ttype TLUiActionsContextType,\n} from './lib/ui/context/actions'\nexport {\n\tAssetUrlsProvider,\n\tuseAssetUrls,\n\ttype AssetUrlsProviderProps,\n} from './lib/ui/context/asset-urls'\nexport {\n\tBreakPointProvider,\n\tuseBreakpoint,\n\ttype BreakPointProviderProps,\n} from './lib/ui/context/breakpoints'\nexport {\n\tTldrawUiComponentsProvider,\n\tuseTldrawUiComponents,\n\ttype TLUiComponents,\n\ttype TLUiComponentsProviderProps,\n} from './lib/ui/context/components'\nexport {\n\tTldrawUiDialogsProvider,\n\tuseDialogs,\n\ttype TLUiDialog,\n\ttype TLUiDialogProps,\n\ttype TLUiDialogsContextType,\n\ttype TLUiDialogsProviderProps,\n} from './lib/ui/context/dialogs'\nexport {\n\tTldrawUiEventsProvider,\n\tuseUiEvents,\n\ttype EventsProviderProps,\n\ttype TLUiEventContextType,\n\ttype TLUiEventData,\n\ttype TLUiEventHandler,\n\ttype TLUiEventMap,\n\ttype TLUiEventSource,\n} from './lib/ui/context/events'\nexport {\n\tTldrawUiContextProvider,\n\ttype TLUiContextProviderProps,\n} from './lib/ui/context/TldrawUiContextProvider'\nexport {\n\tTldrawUiToastsProvider,\n\tuseToasts,\n\ttype AlertSeverity,\n\ttype TLUiToast,\n\ttype TLUiToastAction,\n\ttype TLUiToastsContextType,\n\ttype TLUiToastsProviderProps,\n} from './lib/ui/context/toasts'\nexport {\n\tuseCanApplySelectionAction,\n\tuseCanRedo,\n\tuseCanUndo,\n\tuseUnlockedSelectedShapesCount,\n} from './lib/ui/hooks/menu-hooks'\nexport {\n\thandleNativeOrMenuCopy,\n\tuseMenuClipboardEvents,\n\tuseNativeClipboardEvents,\n} from './lib/ui/hooks/useClipboardEvents'\nexport {\n\tuseCollaborationStatus,\n\tuseShowCollaborationUi,\n} from './lib/ui/hooks/useCollaborationStatus'\nexport { useCopyAs } from './lib/ui/hooks/useCopyAs'\nexport { useExportAs } from './lib/ui/hooks/useExportAs'\nexport { useKeyboardShortcuts } from './lib/ui/hooks/useKeyboardShortcuts'\nexport { useLocalStorageState } from './lib/ui/hooks/useLocalStorageState'\nexport { useMenuIsOpen } from './lib/ui/hooks/useMenuIsOpen'\nexport { useReadonly } from './lib/ui/hooks/useReadonly'\nexport { useSomeActionsEnabled } from './lib/ui/hooks/useActionState'\nexport { useRelevantStyles } from './lib/ui/hooks/useRelevantStyles'\nexport {\n\tonDragFromToolbarToCreateShape,\n\tuseTools,\n\ttype OnDragFromToolbarToCreateShapesOpts,\n\ttype TLUiToolItem,\n\ttype TLUiToolsContextType,\n\ttype TLUiToolsProviderProps,\n} from './lib/ui/hooks/useTools'\nexport { type TLUiTranslationKey } from './lib/ui/hooks/useTranslation/TLUiTranslationKey'\nexport { RTL_LANGUAGES, type TLUiTranslation } from './lib/ui/hooks/useTranslation/translations'\nexport {\n\tuseCurrentTranslation,\n\tuseDirection,\n\tuseMaybeCurrentTranslation,\n\tuseTranslation,\n\ttype TLUiTranslationContextType,\n\ttype TLUiTranslationProviderProps,\n\ttype TLUiTranslationValues,\n} from './lib/ui/hooks/useTranslation/useTranslation'\nexport { iconTypes, type TLUiIconType } from './lib/ui/icon-types'\nexport { useDefaultHelpers, type TLUiOverrideHelpers, type TLUiOverrides } from './lib/ui/overrides'\nexport { TldrawUi, TldrawUiInFrontOfTheCanvas, type TldrawUiProps } from './lib/ui/TldrawUi'\nexport { containBoxSize, downsizeImage, type BoxWidthHeight } from './lib/utils/assets/assets'\nexport { preloadFont, type TLTypeFace } from './lib/utils/assets/preload-font'\nexport { getEmbedInfo, type TLEmbedResult } from './lib/utils/embeds/embeds'\nexport { putExcalidrawContent } from './lib/utils/excalidraw/putExcalidrawContent'\nexport { copyAs, type CopyAsOptions, type TLCopyType } from './lib/utils/export/copyAs'\nexport { downloadFile, exportAs, type ExportAsOptions } from './lib/utils/export/exportAs'\nexport { fitFrameToContent, removeFrame } from './lib/utils/frames/frames'\nexport {\n\tdefaultEditorAssetUrls,\n\tsetDefaultEditorAssetUrls,\n\ttype TLEditorAssetUrls,\n} from './lib/utils/static-assets/assetUrls'\nexport { getLinkOpenPolicy, openLink, type TLLinkOpenPolicy } from './lib/utils/openLink'\nexport { sanitizeSvg } from './lib/utils/svg/sanitizeSvg'\nexport {\n\tdefaultAddFontsFromNode,\n\tgetTipTapDefaultExtensions,\n\tKeyboardShiftEnterTweakExtension,\n\trenderHtmlFromRichText,\n\trenderHtmlFromRichTextForMeasurement,\n\trenderHtmlFromRichTextWithExtensions,\n\trenderPlaintextFromRichText,\n\trenderRichTextFromHTML,\n\ttipTapDefaultExtensions,\n} from './lib/utils/text/richText'\nexport { truncateStringWithEllipsis } from './lib/utils/text/text'\nexport {\n\tExtension,\n\tgetSchema,\n\tMark,\n\tmergeAttributes,\n\tNode,\n\tTaskItem,\n\tTaskList,\n\ttype Extensions,\n\ttype JSONContent,\n\ttype TaskItemOptions,\n\ttype TaskListOptions,\n} from './lib/utils/text/tiptap'\nexport {\n\tdefaultWrappingPairs,\n\tWrapSelectionExtension,\n\ttype WrapSelectionOptions,\n} from './lib/utils/text/wrapSelection'\nexport {\n\tbuildFromV1Document,\n\tTLV1AlignStyle,\n\tTLV1AssetType,\n\tTLV1ColorStyle,\n\tTLV1DashStyle,\n\tTLV1Decoration,\n\tTLV1FontStyle,\n\tTLV1ShapeType,\n\tTLV1SizeStyle,\n\ttype TLV1ArrowBinding,\n\ttype TLV1ArrowShape,\n\ttype TLV1Asset,\n\ttype TLV1BaseAsset,\n\ttype TLV1BaseBinding,\n\ttype TLV1BaseShape,\n\ttype TLV1Binding,\n\ttype TLV1Bounds,\n\ttype TLV1Document,\n\ttype TLV1DrawShape,\n\ttype TLV1EllipseShape,\n\ttype TLV1GroupShape,\n\ttype TLV1Handle,\n\ttype TLV1ImageAsset,\n\ttype TLV1ImageShape,\n\ttype TLV1Page,\n\ttype TLV1PageState,\n\ttype TLV1RectangleShape,\n\ttype TLV1Shape,\n\ttype TLV1ShapeStyles,\n\ttype TLV1StickyShape,\n\ttype TLV1TextShape,\n\ttype TLV1TriangleShape,\n\ttype TLV1VideoAsset,\n\ttype TLV1VideoShape,\n} from './lib/utils/tldr/buildFromV1Document'\nexport {\n\tparseAndLoadDocument,\n\tparseTldrawJsonFile,\n\tserializeTldrawJson,\n\tserializeTldrawJsonBlob,\n\tTLDRAW_FILE_EXTENSION,\n\ttype TldrawFile,\n\ttype TldrawFileParseError,\n} from './lib/utils/tldr/file'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,0BAA6C;AAC7C,oBAAiD;AACjD,kCAAqC;AACrC,oBAA4D;AAC5D,sBAA6D;AAC7D,oBAA+C;AAC/C,IAAAC,oBAIO;AACP,sBAAmE;AACnE,yBAA4B;AAC5B,sBAUO;AACP,kBAA2C;AAC3C,oBAYO;AACP,2BAIO;AACP,iCAmCO;AACP,kBAQO;AAAA,IAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": ["import_useTranslation", "import_assetUrls"]
7
7
  }
@@ -40,6 +40,7 @@ var import_text = require("../../utils/text/text");
40
40
  var import_HyperlinkButton = require("../shared/HyperlinkButton");
41
41
  var import_icons_editor = require("../shared/icons-editor");
42
42
  var import_rotated_box_shadow = require("../shared/rotated-box-shadow");
43
+ var import_useOpenLinkHandler = require("../shared/useOpenLinkHandler");
43
44
  var import_bookmarks = require("./bookmarks");
44
45
  const messages = (0, import_editor.defineMessages)({
45
46
  name: { id: "tool.bookmark", defaultMessage: "Bookmark" }
@@ -110,7 +111,7 @@ class BookmarkShapeUtil extends import_editor.BaseBoxShapeUtil {
110
111
  }
111
112
  next = (0, import_bookmarks.resolveBookmarkAssetForUrlChange)(this.editor, shape);
112
113
  }
113
- if (prev.props.assetId !== next.props.assetId) {
114
+ if (prev.props.assetId !== next.props.assetId || prev.props.url !== next.props.url) {
114
115
  return (0, import_bookmarks.setBookmarkHeight)(this.editor, next);
115
116
  }
116
117
  return next === shape ? void 0 : next;
@@ -135,8 +136,10 @@ function BookmarkShapeComponent({
135
136
  const asset = resolvedAssetId ? editor.getAsset(resolvedAssetId) : null;
136
137
  const isSafariExport = !!(0, import_editor.useSvgExportContext)() && import_editor.tlenv.isSafari;
137
138
  const address = (0, import_bookmarks.getHumanReadableAddress)(url);
139
+ const title = asset ? asset.props.title : (0, import_bookmarks.isUrlOnlyBookmarkUrl)(url) ? url : "";
138
140
  const [isFaviconValid, setIsFaviconValid] = (0, import_react.useState)(true);
139
141
  const onFaviconError = () => setIsFaviconValid(false);
142
+ const handleOpenLink = (0, import_useOpenLinkHandler.useOpenLinkHandler)(url);
140
143
  const markAsHandledOnShiftKey = (0, import_react.useCallback)(
141
144
  (e) => {
142
145
  if (!editor.inputs.getShiftKey()) editor.markEventAsHandled(e);
@@ -155,7 +158,7 @@ function BookmarkShapeComponent({
155
158
  maxHeight: h
156
159
  },
157
160
  children: [
158
- showImageContainer && (!asset || asset.props.image) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-bookmark__image_container", children: [
161
+ showImageContainer && (asset ? asset.props.image : !(0, import_bookmarks.isUrlOnlyBookmarkUrl)(url)) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-bookmark__image_container", children: [
159
162
  asset ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
160
163
  "img",
161
164
  {
@@ -169,7 +172,7 @@ function BookmarkShapeComponent({
169
172
  asset?.props.image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_HyperlinkButton.HyperlinkButton, { url })
170
173
  ] }),
171
174
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-bookmark__copy_container", children: [
172
- asset?.props.title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
175
+ title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
173
176
  "a",
174
177
  {
175
178
  className: "tl-bookmark__link",
@@ -179,7 +182,9 @@ function BookmarkShapeComponent({
179
182
  draggable: false,
180
183
  onPointerDown: markAsHandledOnShiftKey,
181
184
  onPointerUp: markAsHandledOnShiftKey,
182
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "tl-bookmark__heading", children: (0, import_text.convertCommonTitleHTMLEntities)(asset.props.title) })
185
+ onClick: handleOpenLink,
186
+ onAuxClick: handleOpenLink,
187
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "tl-bookmark__heading", children: (0, import_text.convertCommonTitleHTMLEntities)(title) })
183
188
  }
184
189
  ) : null,
185
190
  asset?.props.description && asset?.props.image ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "tl-bookmark__description", children: asset.props.description }) : null,
@@ -193,6 +198,8 @@ function BookmarkShapeComponent({
193
198
  draggable: false,
194
199
  onPointerDown: markAsHandledOnShiftKey,
195
200
  onPointerUp: markAsHandledOnShiftKey,
201
+ onClick: handleOpenLink,
202
+ onAuxClick: handleOpenLink,
196
203
  children: [
197
204
  isFaviconValid && asset?.props.favicon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
198
205
  "img",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/shapes/bookmark/BookmarkShapeUtil.tsx"],
4
- "sourcesContent": ["// oxlint-disable typescript/no-empty-object-type\nimport {\n\tBaseBoxShapeUtil,\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\tdefineMessages,\n\tHTMLContainer,\n\tlerp,\n\tRectangle2d,\n\tT,\n\tTLAssetId,\n\tTLBookmarkAsset,\n\tTLBookmarkShape,\n\tTLBookmarkShapeProps,\n\ttlenv,\n\ttranslateMessage,\n\tuseEditor,\n\tuseSvgExportContext,\n} from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { PointerEventHandler, useCallback, useState } from 'react'\nimport { convertCommonTitleHTMLEntities } from '../../utils/text/text'\nimport type { ShapeOptionsWithDisplayValues } from '../shared/getDisplayValues'\nimport { HyperlinkButton } from '../shared/HyperlinkButton'\nimport { LINK_ICON } from '../shared/icons-editor'\nimport { getRotatedBoxShadow } from '../shared/rotated-box-shadow'\nimport {\n\tBOOKMARK_HEIGHT,\n\tBOOKMARK_WIDTH,\n\tgetBookmarkShapeHeight,\n\tgetHumanReadableAddress,\n\tgetResolvedBookmarkAssetId,\n\tsetBookmarkHeight,\n\tresolveBookmarkAssetForUrlChange,\n} from './bookmarks'\n\n/** @public */\nexport type BookmarkShapeUtilDisplayValues = object\n\n/** @public */\nexport interface BookmarkShapeOptions extends ShapeOptionsWithDisplayValues<\n\tTLBookmarkShape,\n\tBookmarkShapeUtilDisplayValues\n> {}\n\nconst messages = defineMessages({\n\tname: { id: 'tool.bookmark', defaultMessage: 'Bookmark' },\n})\n\n/** @public */\nexport class BookmarkShapeUtil extends BaseBoxShapeUtil<TLBookmarkShape> {\n\tstatic override type = 'bookmark' as const\n\tstatic override props = bookmarkShapeProps\n\tstatic override migrations = bookmarkShapeMigrations\n\n\toverride options: BookmarkShapeOptions = {\n\t\tgetDefaultDisplayValues(): BookmarkShapeUtilDisplayValues {\n\t\t\treturn {}\n\t\t},\n\t\tgetCustomDisplayValues(): Partial<BookmarkShapeUtilDisplayValues> {\n\t\t\treturn {}\n\t\t},\n\t}\n\n\toverride getShapeName() {\n\t\treturn translateMessage(this.editor.i18n(), messages.name)\n\t}\n\n\toverride canResize(shape: TLBookmarkShape) {\n\t\treturn false\n\t}\n\n\toverride hideSelectionBoundsFg(shape: TLBookmarkShape) {\n\t\treturn true\n\t}\n\n\toverride getText(shape: TLBookmarkShape) {\n\t\treturn shape.props.url\n\t}\n\n\toverride getAriaDescriptor(shape: TLBookmarkShape) {\n\t\tconst asset = (\n\t\t\tshape.props.assetId ? this.editor.getAsset(shape.props.assetId) : null\n\t\t) as TLBookmarkAsset | null\n\n\t\tif (!asset?.props.title) return undefined\n\n\t\treturn (\n\t\t\tconvertCommonTitleHTMLEntities(asset.props.title) +\n\t\t\t(asset.props.description ? ', ' + asset.props.description : '')\n\t\t)\n\t}\n\n\toverride getDefaultProps(): TLBookmarkShape['props'] {\n\t\treturn {\n\t\t\turl: '',\n\t\t\tw: BOOKMARK_WIDTH,\n\t\t\th: BOOKMARK_HEIGHT,\n\t\t\tassetId: null,\n\t\t}\n\t}\n\n\toverride getGeometry(shape: TLBookmarkShape) {\n\t\treturn new Rectangle2d({\n\t\t\twidth: shape.props.w,\n\t\t\theight: getBookmarkShapeHeight(this.editor, shape),\n\t\t\tisFilled: true,\n\t\t})\n\t}\n\n\toverride component(shape: TLBookmarkShape) {\n\t\tconst { assetId, url } = shape.props\n\t\tconst h = getBookmarkShapeHeight(this.editor, shape)\n\t\tconst rotation = this.editor.getShapePageTransform(shape)!.rotation()\n\n\t\treturn <BookmarkShapeComponent assetId={assetId} url={url} h={h} rotation={rotation} />\n\t}\n\n\toverride getIndicatorPath(shape: TLBookmarkShape): Path2D {\n\t\tconst path = new Path2D()\n\t\tpath.rect(0, 0, shape.props.w, getBookmarkShapeHeight(this.editor, shape))\n\t\treturn path\n\t}\n\n\toverride onBeforeCreate(next: TLBookmarkShape) {\n\t\treturn setBookmarkHeight(this.editor, next)\n\t}\n\n\toverride onBeforeUpdate(prev: TLBookmarkShape, shape: TLBookmarkShape) {\n\t\tlet next = shape\n\t\tif (prev.props.url !== shape.props.url) {\n\t\t\tif (!T.linkUrl.isValid(shape.props.url)) {\n\t\t\t\treturn { ...shape, props: { ...shape.props, url: prev.props.url } }\n\t\t\t}\n\t\t\tnext = resolveBookmarkAssetForUrlChange(this.editor, shape)\n\t\t}\n\n\t\tif (prev.props.assetId !== next.props.assetId) {\n\t\t\treturn setBookmarkHeight(this.editor, next)\n\t\t}\n\n\t\treturn next === shape ? undefined : next\n\t}\n\toverride getInterpolatedProps(\n\t\tstartShape: TLBookmarkShape,\n\t\tendShape: TLBookmarkShape,\n\t\tt: number\n\t): TLBookmarkShapeProps {\n\t\treturn {\n\t\t\t...(t > 0.5 ? endShape.props : startShape.props),\n\t\t\tw: lerp(startShape.props.w, endShape.props.w, t),\n\t\t\th: lerp(startShape.props.h, endShape.props.h, t),\n\t\t}\n\t}\n}\n\nexport function BookmarkShapeComponent({\n\tassetId,\n\trotation,\n\turl,\n\th,\n\tshowImageContainer = true,\n}: {\n\tassetId: TLAssetId | null\n\trotation: number\n\th: number\n\turl: string\n\tshowImageContainer?: boolean\n}) {\n\tconst editor = useEditor()\n\n\tconst resolvedAssetId = getResolvedBookmarkAssetId(editor, assetId, url)\n\tconst asset = resolvedAssetId ? (editor.getAsset(resolvedAssetId) as TLBookmarkAsset) : null\n\n\tconst isSafariExport = !!useSvgExportContext() && tlenv.isSafari\n\n\tconst address = getHumanReadableAddress(url)\n\n\tconst [isFaviconValid, setIsFaviconValid] = useState(true)\n\tconst onFaviconError = () => setIsFaviconValid(false)\n\n\tconst markAsHandledOnShiftKey = useCallback<PointerEventHandler>(\n\t\t(e) => {\n\t\t\tif (!editor.inputs.getShiftKey()) editor.markEventAsHandled(e)\n\t\t},\n\t\t[editor]\n\t)\n\n\treturn (\n\t\t<HTMLContainer>\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'tl-bookmark__container',\n\t\t\t\t\tisSafariExport && 'tl-bookmark__container--safariExport'\n\t\t\t\t)}\n\t\t\t\tstyle={{\n\t\t\t\t\tboxShadow: isSafariExport ? undefined : getRotatedBoxShadow(rotation),\n\t\t\t\t\tmaxHeight: h,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{showImageContainer && (!asset || asset.props.image) && (\n\t\t\t\t\t<div className=\"tl-bookmark__image_container\">\n\t\t\t\t\t\t{asset ? (\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\tclassName=\"tl-bookmark__image\"\n\t\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\t\treferrerPolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\t\t\t\t\tsrc={asset?.props.image}\n\t\t\t\t\t\t\t\talt={asset?.props.title || ''}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div className=\"tl-bookmark__placeholder\" />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{asset?.props.image && <HyperlinkButton url={url} />}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<div className=\"tl-bookmark__copy_container\">\n\t\t\t\t\t{asset?.props.title ? (\n\t\t\t\t\t\t<a\n\t\t\t\t\t\t\tclassName=\"tl-bookmark__link\"\n\t\t\t\t\t\t\thref={url || ''}\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\tonPointerDown={markAsHandledOnShiftKey}\n\t\t\t\t\t\t\tonPointerUp={markAsHandledOnShiftKey}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<h2 className=\"tl-bookmark__heading\">\n\t\t\t\t\t\t\t\t{convertCommonTitleHTMLEntities(asset.props.title)}\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{asset?.props.description && asset?.props.image ? (\n\t\t\t\t\t\t<p className=\"tl-bookmark__description\">{asset.props.description}</p>\n\t\t\t\t\t) : null}\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName=\"tl-bookmark__link\"\n\t\t\t\t\t\thref={url || ''}\n\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\tonPointerDown={markAsHandledOnShiftKey}\n\t\t\t\t\t\tonPointerUp={markAsHandledOnShiftKey}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isFaviconValid && asset?.props.favicon ? (\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\tclassName=\"tl-bookmark__favicon\"\n\t\t\t\t\t\t\t\tsrc={asset?.props.favicon}\n\t\t\t\t\t\t\t\treferrerPolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\t\t\t\t\tonError={onFaviconError}\n\t\t\t\t\t\t\t\talt={`favicon of ${address}`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"tl-hyperlink__icon\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tmask: `url(\"${LINK_ICON}\") center 100% / 100% no-repeat`,\n\t\t\t\t\t\t\t\t\tWebkitMask: `url(\"${L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kShapeMigrations,\n\tbookmarkShapeProps,\n\tdefineMessages,\n\tHTMLContainer,\n\tlerp,\n\tRectangle2d,\n\tT,\n\tTLAssetId,\n\tTLBookmarkAsset,\n\tTLBookmarkShape,\n\tTLBookmarkShapeProps,\n\ttlenv,\n\ttranslateMessage,\n\tuseEditor,\n\tuseSvgExportContext,\n} from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { PointerEventHandler, useCallback, useState } from 'react'\nimport { convertCommonTitleHTMLEntities } from '../../utils/text/text'\nimport type { ShapeOptionsWithDisplayValues } from '../shared/getDisplayValues'\nimport { HyperlinkButton } from '../shared/HyperlinkButton'\nimport { LINK_ICON } from '../shared/icons-editor'\nimport { getRotatedBoxShadow } from '../shared/rotated-box-shadow'\nimport { useOpenLinkHandler } from '../shared/useOpenLinkHandler'\nimport {\n\tBOOKMARK_HEIGHT,\n\tBOOKMARK_WIDTH,\n\tgetBookmarkShapeHeight,\n\tgetHumanReadableAddress,\n\tgetResolvedBookmarkAssetId,\n\tisUrlOnlyBookmarkUrl,\n\tsetBookmarkHeight,\n\tresolveBookmarkAssetForUrlChange,\n} from './bookmarks'\n\n/** @public */\nexport type BookmarkShapeUtilDisplayValues = object\n\n/** @public */\nexport interface BookmarkShapeOptions extends ShapeOptionsWithDisplayValues<\n\tTLBookmarkShape,\n\tBookmarkShapeUtilDisplayValues\n> {}\n\nconst messages = defineMessages({\n\tname: { id: 'tool.bookmark', defaultMessage: 'Bookmark' },\n})\n\n/** @public */\nexport class BookmarkShapeUtil extends BaseBoxShapeUtil<TLBookmarkShape> {\n\tstatic override type = 'bookmark' as const\n\tstatic override props = bookmarkShapeProps\n\tstatic override migrations = bookmarkShapeMigrations\n\n\toverride options: BookmarkShapeOptions = {\n\t\tgetDefaultDisplayValues(): BookmarkShapeUtilDisplayValues {\n\t\t\treturn {}\n\t\t},\n\t\tgetCustomDisplayValues(): Partial<BookmarkShapeUtilDisplayValues> {\n\t\t\treturn {}\n\t\t},\n\t}\n\n\toverride getShapeName() {\n\t\treturn translateMessage(this.editor.i18n(), messages.name)\n\t}\n\n\toverride canResize(shape: TLBookmarkShape) {\n\t\treturn false\n\t}\n\n\toverride hideSelectionBoundsFg(shape: TLBookmarkShape) {\n\t\treturn true\n\t}\n\n\toverride getText(shape: TLBookmarkShape) {\n\t\treturn shape.props.url\n\t}\n\n\toverride getAriaDescriptor(shape: TLBookmarkShape) {\n\t\tconst asset = (\n\t\t\tshape.props.assetId ? this.editor.getAsset(shape.props.assetId) : null\n\t\t) as TLBookmarkAsset | null\n\n\t\tif (!asset?.props.title) return undefined\n\n\t\treturn (\n\t\t\tconvertCommonTitleHTMLEntities(asset.props.title) +\n\t\t\t(asset.props.description ? ', ' + asset.props.description : '')\n\t\t)\n\t}\n\n\toverride getDefaultProps(): TLBookmarkShape['props'] {\n\t\treturn {\n\t\t\turl: '',\n\t\t\tw: BOOKMARK_WIDTH,\n\t\t\th: BOOKMARK_HEIGHT,\n\t\t\tassetId: null,\n\t\t}\n\t}\n\n\toverride getGeometry(shape: TLBookmarkShape) {\n\t\treturn new Rectangle2d({\n\t\t\twidth: shape.props.w,\n\t\t\theight: getBookmarkShapeHeight(this.editor, shape),\n\t\t\tisFilled: true,\n\t\t})\n\t}\n\n\toverride component(shape: TLBookmarkShape) {\n\t\tconst { assetId, url } = shape.props\n\t\tconst h = getBookmarkShapeHeight(this.editor, shape)\n\t\tconst rotation = this.editor.getShapePageTransform(shape)!.rotation()\n\n\t\treturn <BookmarkShapeComponent assetId={assetId} url={url} h={h} rotation={rotation} />\n\t}\n\n\toverride getIndicatorPath(shape: TLBookmarkShape): Path2D {\n\t\tconst path = new Path2D()\n\t\tpath.rect(0, 0, shape.props.w, getBookmarkShapeHeight(this.editor, shape))\n\t\treturn path\n\t}\n\n\toverride onBeforeCreate(next: TLBookmarkShape) {\n\t\treturn setBookmarkHeight(this.editor, next)\n\t}\n\n\toverride onBeforeUpdate(prev: TLBookmarkShape, shape: TLBookmarkShape) {\n\t\tlet next = shape\n\t\tif (prev.props.url !== shape.props.url) {\n\t\t\tif (!T.linkUrl.isValid(shape.props.url)) {\n\t\t\t\treturn { ...shape, props: { ...shape.props, url: prev.props.url } }\n\t\t\t}\n\t\t\tnext = resolveBookmarkAssetForUrlChange(this.editor, shape)\n\t\t}\n\n\t\tif (prev.props.assetId !== next.props.assetId || prev.props.url !== next.props.url) {\n\t\t\treturn setBookmarkHeight(this.editor, next)\n\t\t}\n\n\t\treturn next === shape ? undefined : next\n\t}\n\toverride getInterpolatedProps(\n\t\tstartShape: TLBookmarkShape,\n\t\tendShape: TLBookmarkShape,\n\t\tt: number\n\t): TLBookmarkShapeProps {\n\t\treturn {\n\t\t\t...(t > 0.5 ? endShape.props : startShape.props),\n\t\t\tw: lerp(startShape.props.w, endShape.props.w, t),\n\t\t\th: lerp(startShape.props.h, endShape.props.h, t),\n\t\t}\n\t}\n}\n\nexport function BookmarkShapeComponent({\n\tassetId,\n\trotation,\n\turl,\n\th,\n\tshowImageContainer = true,\n}: {\n\tassetId: TLAssetId | null\n\trotation: number\n\th: number\n\turl: string\n\tshowImageContainer?: boolean\n}) {\n\tconst editor = useEditor()\n\n\tconst resolvedAssetId = getResolvedBookmarkAssetId(editor, assetId, url)\n\tconst asset = resolvedAssetId ? (editor.getAsset(resolvedAssetId) as TLBookmarkAsset) : null\n\n\tconst isSafariExport = !!useSvgExportContext() && tlenv.isSafari\n\n\tconst address = getHumanReadableAddress(url)\n\tconst title = asset ? asset.props.title : isUrlOnlyBookmarkUrl(url) ? url : ''\n\n\tconst [isFaviconValid, setIsFaviconValid] = useState(true)\n\tconst onFaviconError = () => setIsFaviconValid(false)\n\n\tconst handleOpenLink = useOpenLinkHandler(url)\n\tconst markAsHandledOnShiftKey = useCallback<PointerEventHandler>(\n\t\t(e) => {\n\t\t\tif (!editor.inputs.getShiftKey()) editor.markEventAsHandled(e)\n\t\t},\n\t\t[editor]\n\t)\n\n\treturn (\n\t\t<HTMLContainer>\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'tl-bookmark__container',\n\t\t\t\t\tisSafariExport && 'tl-bookmark__container--safariExport'\n\t\t\t\t)}\n\t\t\t\tstyle={{\n\t\t\t\t\tboxShadow: isSafariExport ? undefined : getRotatedBoxShadow(rotation),\n\t\t\t\t\tmaxHeight: h,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{showImageContainer && (asset ? asset.props.image : !isUrlOnlyBookmarkUrl(url)) && (\n\t\t\t\t\t<div className=\"tl-bookmark__image_container\">\n\t\t\t\t\t\t{asset ? (\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\tclassName=\"tl-bookmark__image\"\n\t\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\t\treferrerPolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\t\t\t\t\tsrc={asset?.props.image}\n\t\t\t\t\t\t\t\talt={asset?.props.title || ''}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div className=\"tl-bookmark__placeholder\" />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{asset?.props.image && <HyperlinkButton url={url} />}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<div className=\"tl-bookmark__copy_container\">\n\t\t\t\t\t{title ? (\n\t\t\t\t\t\t<a\n\t\t\t\t\t\t\tclassName=\"tl-bookmark__link\"\n\t\t\t\t\t\t\thref={url || ''}\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\tonPointerDown={markAsHandledOnShiftKey}\n\t\t\t\t\t\t\tonPointerUp={markAsHandledOnShiftKey}\n\t\t\t\t\t\t\tonClick={handleOpenLink}\n\t\t\t\t\t\t\tonAuxClick={handleOpenLink}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<h2 className=\"tl-bookmark__heading\">{convertCommonTitleHTMLEntities(title)}</h2>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{asset?.props.description && asset?.props.image ? (\n\t\t\t\t\t\t<p className=\"tl-bookmark__description\">{asset.props.description}</p>\n\t\t\t\t\t) : null}\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName=\"tl-bookmark__link\"\n\t\t\t\t\t\thref={url || ''}\n\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\tonPointerDown={markAsHandledOnShiftKey}\n\t\t\t\t\t\tonPointerUp={markAsHandledOnShiftKey}\n\t\t\t\t\t\tonClick={handleOpenLink}\n\t\t\t\t\t\tonAuxClick={handleOpenLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isFaviconValid && asset?.props.favicon ? (\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\tclassName=\"tl-bookmark__favicon\"\n\t\t\t\t\t\t\t\tsrc={asset?.props.favicon}\n\t\t\t\t\t\t\t\treferrerPolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\t\t\t\t\tonError={onFaviconError}\n\t\t\t\t\t\t\t\talt={`favicon of ${address}`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"tl-hyperlink__icon\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tmask: `url(\"${LINK_ICON}\") center 100% / 100% no-repeat`,\n\t\t\t\t\t\t\t\t\tWebkitMask: `url(\"${LINK_ICON}\") center 100% / 100% no-repeat`,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<span>{address}</span>\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</HTMLContainer>\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;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: () => BOOKMARK_HEIGHT,
22
22
  BOOKMARK_JUST_URL_HEIGHT: () => BOOKMARK_JUST_URL_HEIGHT,
23
23
  BOOKMARK_WIDTH: () => BOOKMARK_WIDTH,
24
+ SHORT_BOOKMARK_HEIGHT: () => SHORT_BOOKMARK_HEIGHT,
24
25
  createBookmarkFromUrl: () => createBookmarkFromUrl,
25
26
  getBookmarkHeight: () => getBookmarkHeight,
26
27
  getBookmarkShapeHeight: () => getBookmarkShapeHeight,
27
28
  getHumanReadableAddress: () => getHumanReadableAddress,
28
29
  getResolvedBookmarkAssetId: () => getResolvedBookmarkAssetId,
30
+ isUrlOnlyBookmarkUrl: () => isUrlOnlyBookmarkUrl,
29
31
  resolveBookmarkAssetForUrlChange: () => resolveBookmarkAssetForUrlChange,
30
32
  setBookmarkHeight: () => setBookmarkHeight
31
33
  });
@@ -35,7 +37,18 @@ const BOOKMARK_WIDTH = 300;
35
37
  const BOOKMARK_HEIGHT = 320;
36
38
  const BOOKMARK_JUST_URL_HEIGHT = 46;
37
39
  const SHORT_BOOKMARK_HEIGHT = 101;
38
- function getBookmarkHeight(editor, assetId) {
40
+ function canUnfurlUrl(url) {
41
+ try {
42
+ const { protocol } = new URL(url);
43
+ return protocol === "http:" || protocol === "https:";
44
+ } catch {
45
+ return false;
46
+ }
47
+ }
48
+ function isUrlOnlyBookmarkUrl(url) {
49
+ return url !== "" && !canUnfurlUrl(url);
50
+ }
51
+ function getBookmarkHeight(editor, assetId, url) {
39
52
  const asset = assetId ? editor.getAsset(assetId) : null;
40
53
  if (asset) {
41
54
  if (!asset.props.image) {
@@ -45,18 +58,24 @@ function getBookmarkHeight(editor, assetId) {
45
58
  return SHORT_BOOKMARK_HEIGHT;
46
59
  }
47
60
  }
61
+ } else if (isUrlOnlyBookmarkUrl(url)) {
62
+ return SHORT_BOOKMARK_HEIGHT;
48
63
  }
49
64
  return BOOKMARK_HEIGHT;
50
65
  }
51
66
  function setBookmarkHeight(editor, shape) {
52
67
  return {
53
68
  ...shape,
54
- props: { ...shape.props, h: getBookmarkHeight(editor, shape.props.assetId) }
69
+ props: {
70
+ ...shape.props,
71
+ h: getBookmarkHeight(editor, shape.props.assetId, shape.props.url)
72
+ }
55
73
  };
56
74
  }
57
75
  function getHumanReadableAddress(url) {
58
76
  try {
59
77
  const objUrl = new URL(url);
78
+ if (isUrlOnlyBookmarkUrl(url)) return objUrl.protocol.slice(0, -1);
60
79
  return objUrl.hostname.replace(/^www\./, "");
61
80
  } catch {
62
81
  return url;
@@ -82,11 +101,12 @@ function getResolvedBookmarkAssetId(editor, assetId, url) {
82
101
  function getBookmarkShapeHeight(editor, shape) {
83
102
  const resolvedAssetId = getResolvedBookmarkAssetId(editor, shape.props.assetId, shape.props.url);
84
103
  if (resolvedAssetId === shape.props.assetId) return shape.props.h;
85
- return getBookmarkHeight(editor, resolvedAssetId);
104
+ return getBookmarkHeight(editor, resolvedAssetId, shape.props.url);
86
105
  }
87
106
  async function _createBookmarkAssetOnUrlChange(editor, shape) {
88
107
  if (editor.isDisposed) return;
89
108
  const { url } = shape.props;
109
+ if (!canUnfurlUrl(url)) return;
90
110
  const asset = await editor.getAssetForExternalContent({ type: "url", url });
91
111
  if (!asset) {
92
112
  return;
@@ -130,7 +150,7 @@ async function createBookmarkFromUrl(editor, {
130
150
  url,
131
151
  assetId: existingAsset?.id ?? null,
132
152
  w: BOOKMARK_WIDTH,
133
- h: getBookmarkHeight(editor, existingAsset?.id)
153
+ h: getBookmarkHeight(editor, existingAsset?.id, url)
134
154
  }
135
155
  };
136
156
  editor.run(() => {
@@ -150,6 +170,7 @@ async function createBookmarkFromUrl(editor, {
150
170
  }
151
171
  }
152
172
  async function hydrateBookmarkShape(editor, shapeId, url) {
173
+ if (!canUnfurlUrl(url)) return;
153
174
  let asset;
154
175
  try {
155
176
  asset = await editor.getAssetForExternalContent({ type: "url", url });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/shapes/bookmark/bookmarks.ts"],
4
- "sourcesContent": ["import {\n\tAssetRecordType,\n\tEditor,\n\tResult,\n\tTLAssetId,\n\tTLBookmarkAsset,\n\tTLBookmarkShape,\n\tTLShapeId,\n\tTLShapePartial,\n\tcreateShapeId,\n\tdebounce,\n\tgetHashForString,\n} from '@tldraw/editor'\n\nexport const BOOKMARK_WIDTH = 300\nexport const BOOKMARK_HEIGHT = 320\nexport const BOOKMARK_JUST_URL_HEIGHT = 46\nconst SHORT_BOOKMARK_HEIGHT = 101\n\nexport function getBookmarkHeight(editor: Editor, assetId?: TLAssetId | null) {\n\tconst asset = (assetId ? editor.getAsset(assetId) : null) as TLBookmarkAsset | null\n\n\tif (asset) {\n\t\tif (!asset.props.image) {\n\t\t\tif (!asset.props.title) {\n\t\t\t\treturn BOOKMARK_JUST_URL_HEIGHT\n\t\t\t} else {\n\t\t\t\treturn SHORT_BOOKMARK_HEIGHT\n\t\t\t}\n\t\t}\n\t}\n\n\treturn BOOKMARK_HEIGHT\n}\n\nexport function setBookmarkHeight(editor: Editor, shape: TLBookmarkShape) {\n\treturn {\n\t\t...shape,\n\t\tprops: { ...shape.props, h: getBookmarkHeight(editor, shape.props.assetId) },\n\t}\n}\n\n/** @internal */\nexport function getHumanReadableAddress(url: string) {\n\ttry {\n\t\tconst objUrl = new URL(url)\n\t\t// we want the hostname without any www\n\t\treturn objUrl.hostname.replace(/^www\\./, '')\n\t} catch {\n\t\treturn url\n\t}\n}\n\n/**\n * Resolve the asset for a bookmark whose url just changed: the existing asset for the new url\n * if there is one, otherwise `null` while a new one is fetched in the background.\n *\n * Must not write to the store: this runs inside `onBeforeUpdate`, where a nested `updateShapes`\n * is overwritten by the outer put and the old asset would stick.\n */\nexport function resolveBookmarkAssetForUrlChange(\n\teditor: Editor,\n\tshape: TLBookmarkShape\n): TLBookmarkShape {\n\tconst { url } = shape.props\n\n\t// Derive the asset id from the URL\n\tconst assetId: TLAssetId = AssetRecordType.createId(getHashForString(url))\n\n\tif (editor.getAsset(assetId)) {\n\t\tif (shape.props.assetId === assetId) return shape\n\t\treturn { ...shape, props: { ...shape.props, assetId } }\n\t}\n\n\t// No asset for this URL yet: drop the stale reference and fetch one asynchronously\n\tcreateBookmarkAssetOnUrlChange(editor, shape)\n\tif (shape.props.assetId === null) return shape\n\treturn { ...shape, props: { ...shape.props, assetId: null } }\n}\n\n/**\n * Resolve the asset id to render for a bookmark. Bookmark assets are keyed\n * deterministically by URL, so if the shape has no `assetId` but an asset for\n * its URL already exists in the store, use that.\n *\n * This keeps a bookmark from staying stuck on its placeholder after the shape\n * is recreated outside of the hydration flow \u2014 e.g. on redo, where the\n * placeholder is restored with a null `assetId` but its hydrated asset (created\n * with `history: 'ignore'`) still lives in the store.\n */\nexport function getResolvedBookmarkAssetId(\n\teditor: Editor,\n\tassetId: TLAssetId | null,\n\turl: string\n): TLAssetId | null {\n\tif (assetId) return assetId\n\tif (!url) return null\n\n\tconst derivedId: TLAssetId = AssetRecordType.createId(getHashForString(url))\n\treturn editor.getAsset(derivedId) ? derivedId : null\n}\n\n/**\n * The effective height to render and measure a bookmark at.\n *\n * Normally this is the stored `props.h`. But when the shape's `assetId` resolves\n * to a different asset than it stores \u2014 e.g. a placeholder restored on redo with\n * a null `assetId` whose asset already exists in the store \u2014 `props.h` is stale\n * (it still holds the placeholder height). In that case recompute the height\n * from the resolved asset so rendering, the indicator, and the geometry/selection\n * bounds all stay in sync.\n */\nexport function getBookmarkShapeHeight(editor: Editor, shape: TLBookmarkShape): number {\n\tconst resolvedAssetId = getResolvedBookmarkAssetId(editor, shape.props.assetId, shape.props.url)\n\tif (resolvedAssetId === shape.props.assetId) return shape.props.h\n\treturn getBookmarkHeight(editor, resolvedAssetId)\n}\n\nasync function _createBookmarkAssetOnUrlChange(editor: Editor, shape: TLBookmarkShape) {\n\tif (editor.isDisposed) return\n\n\tconst { url } = shape.props\n\n\t// Create the asset using the external content manager's createAssetFromUrl method.\n\t// This may be overwritten by the user (for example, we overwrite it on tldraw.com)\n\tconst asset = await editor.getAssetForExternalContent({ type: 'url', url })\n\n\tif (!asset) {\n\t\t// No asset? Just leave the bookmark as a null assetId.\n\t\treturn\n\t}\n\n\teditor.run(() => {\n\t\t// Create the new asset\n\t\teditor.createAssets([asset])\n\n\t\t// And update the shape\n\t\teditor.updateShapes([\n\t\t\t{\n\t\t\t\tid: shape.id,\n\t\t\t\ttype: shape.type,\n\t\t\t\tprops: { assetId: asset.id },\n\t\t\t},\n\t\t])\n\t})\n}\n\nconst bookmarkDebouncers = new WeakMap<\n\tEditor,\n\tReturnType<typeof debounce<[Editor, TLBookmarkShape], void>>\n>()\n\nfunction createBookmarkAssetOnUrlChange(editor: Editor, shape: TLBookmarkShape) {\n\tlet fn = bookmarkDebouncers.get(editor)\n\tif (!fn) {\n\t\tfn = debounce(_createBookmarkAssetOnUrlChange, 500)\n\t\tbookmarkDebouncers.set(editor, fn)\n\t}\n\tfn(editor, shape)\n}\n\n/**\n * Creates a bookmark shape from a URL.\n *\n * The shape is created immediately as a placeholder so the user gets visible\n * feedback at the paste location, and the bookmark metadata (title, description,\n * image, favicon) is fetched in the background. Once metadata resolves, the\n * shape is patched with the resulting asset. If the fetch fails, the shape is\n * left as a URL-only bookmark.\n *\n * @returns A Result containing the created bookmark shape or an error\n * @public\n */\nexport async function createBookmarkFromUrl(\n\teditor: Editor,\n\t{\n\t\turl,\n\t\tcenter = editor.getViewportPageBounds().center,\n\t}: {\n\t\turl: string\n\t\tcenter?: { x: number; y: number }\n\t}\n): Promise<Result<TLBookmarkShape, string>> {\n\ttry {\n\t\t// If we already have a bookmark asset for this URL (e.g. another bookmark\n\t\t// shape was created from the same URL earlier), use it immediately rather\n\t\t// than re-fetching.\n\t\tconst expectedAssetId: TLAssetId = AssetRecordType.createId(getHashForString(url))\n\t\tconst existingAsset = editor.getAsset(expectedAssetId) as TLBookmarkAsset | null\n\n\t\tconst shapeId = createShapeId()\n\t\tconst shapePartial: TLShapePartial<TLBookmarkShape> = {\n\t\t\tid: shapeId,\n\t\t\ttype: 'bookmark',\n\t\t\tx: center.x - BOOKMARK_WIDTH / 2,\n\t\t\ty: center.y - BOOKMARK_HEIGHT / 2,\n\t\t\trotation: 0,\n\t\t\topacity: 1,\n\t\t\tprops: {\n\t\t\t\turl,\n\t\t\t\tassetId: existingAsset?.id ?? null,\n\t\t\t\tw: BOOKMARK_WIDTH,\n\t\t\t\th: getBookmarkHeight(editor, existingAsset?.id),\n\t\t\t},\n\t\t}\n\n\t\teditor.run(() => {\n\t\t\teditor.createShapes([shapePartial])\n\t\t})\n\n\t\tconst createdShape = editor.getShape<TLBookmarkShape>(shapeId)\n\t\tif (!createdShape) {\n\t\t\treturn Result.err('Failed to create bookmark shape')\n\t\t}\n\n\t\t// If we already had the asset, we're done \u2014 no metadata fetch needed.\n\t\tif (existingAsset) {\n\t\t\treturn Result.ok(createdShape)\n\t\t}\n\n\t\t// Otherwise kick off the metadata fetch in the background. The shape is\n\t\t// already visible as a placeholder; once the asset resolves we'll patch\n\t\t// the shape with its assetId.\n\t\tvoid hydrateBookmarkShape(editor, shapeId, url)\n\n\t\treturn Result.ok(createdShape)\n\t} catch (error) {\n\t\treturn Result.err(error instanceof Error ? error.message : 'Failed to create bookmark')\n\t}\n}\n\nasync function hydrateBookmarkShape(editor: Editor, shapeId: TLShapeId, url: string) {\n\tlet asset\n\ttry {\n\t\tasset = await editor.getAssetForExternalContent({ type: 'url', url })\n\t} catch (error) {\n\t\tconsole.error(error)\n\t\treturn\n\t}\n\n\tif (editor.isDisposed) return\n\tif (!asset) return\n\n\t// The shape may have been deleted (e.g. via undo), had its URL changed, or\n\t// had its asset replaced before the fetch resolved. In any of those cases we\n\t// don't want to attach metadata for the old URL.\n\tconst shape = editor.getShape<TLBookmarkShape>(shapeId)\n\tif (!shape) return\n\tif (shape.props.url !== url) return\n\tif (shape.props.assetId) return\n\n\teditor.run(\n\t\t() => {\n\t\t\tif (!editor.getAsset(asset.id)) {\n\t\t\t\teditor.createAssets([asset])\n\t\t\t}\n\t\t\te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O;AAKZ,QAAM,QAAQ,OAAO,SAA0B,OAAO;AACtD,MAAI,CAAC,MAAO;AACZ,MAAI,MAAM,MAAM,QAAQ,IAAK;AAC7B,MAAI,MAAM,MAAM,QAAS;AAEzB,SAAO;AAAA,IACN,MAAM;AACL,UAAI,CAAC,OAAO,SAAS,MAAM,EAAE,GAAG;AAC/B,eAAO,aAAa,CAAC,KAAK,CAAC;AAAA,MAC5B;AACA,aAAO,aAAa;AAAA,QACnB;AAAA,UACC,IAAI;AAAA,UACJ,MAAM;AAAA,UACN,OAAO,EAAE,SAAS,MAAM,GAAG;AAAA,QAC5B;AAAA,MACD,CAAC;AAAA,IACF;AAAA,IACA,EAAE,SAAS,SAAS;AAAA,EACrB;AACD;",
4
+ "sourcesContent": ["import {\n\tAssetRecordType,\n\tEditor,\n\tResult,\n\tTLAssetId,\n\tTLBookmarkAsset,\n\tTLBookmarkShape,\n\tTLShapeId,\n\tTLShapePartial,\n\tcreateShapeId,\n\tdebounce,\n\tgetHashForString,\n} from '@tldraw/editor'\n\nexport const BOOKMARK_WIDTH = 300\nexport const BOOKMARK_HEIGHT = 320\nexport const BOOKMARK_JUST_URL_HEIGHT = 46\nexport const SHORT_BOOKMARK_HEIGHT = 101\n\n// A bookmark asset's `src` is a `T.srcUrl`, which rejects app links and `mailto:`. Not\n// `T.httpUrl`: it accepts `''` and relative paths, so clearing a bookmark's url would unfurl.\nfunction canUnfurlUrl(url: string) {\n\ttry {\n\t\tconst { protocol } = new URL(url)\n\t\treturn protocol === 'http:' || protocol === 'https:'\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/**\n * Whether a bookmark without an asset will never get one, rather than still loading. Without\n * this, an app link bookmark shows the loading placeholder forever.\n */\nexport function isUrlOnlyBookmarkUrl(url: string) {\n\treturn url !== '' && !canUnfurlUrl(url)\n}\n\nexport function getBookmarkHeight(\n\teditor: Editor,\n\tassetId: TLAssetId | null | undefined,\n\turl: string\n) {\n\tconst asset = (assetId ? editor.getAsset(assetId) : null) as TLBookmarkAsset | null\n\n\tif (asset) {\n\t\tif (!asset.props.image) {\n\t\t\tif (!asset.props.title) {\n\t\t\t\treturn BOOKMARK_JUST_URL_HEIGHT\n\t\t\t} else {\n\t\t\t\treturn SHORT_BOOKMARK_HEIGHT\n\t\t\t}\n\t\t}\n\t} else if (isUrlOnlyBookmarkUrl(url)) {\n\t\treturn SHORT_BOOKMARK_HEIGHT\n\t}\n\n\treturn BOOKMARK_HEIGHT\n}\n\nexport function setBookmarkHeight(editor: Editor, shape: TLBookmarkShape) {\n\treturn {\n\t\t...shape,\n\t\tprops: {\n\t\t\t...shape.props,\n\t\t\th: getBookmarkHeight(editor, shape.props.assetId, shape.props.url),\n\t\t},\n\t}\n}\n\n/** @internal */\nexport function getHumanReadableAddress(url: string) {\n\ttry {\n\t\tconst objUrl = new URL(url)\n\t\t// An app link's host (`file` in `vscode://file/\u2026`) doesn't say where it goes, but its app does.\n\t\tif (isUrlOnlyBookmarkUrl(url)) return objUrl.protocol.slice(0, -1)\n\t\t// we want the hostname without any www\n\t\treturn objUrl.hostname.replace(/^www\\./, '')\n\t} catch {\n\t\treturn url\n\t}\n}\n\n/**\n * Resolve the asset for a bookmark whose url just changed: the existing asset for the new url\n * if there is one, otherwise `null` while a new one is fetched in the background.\n *\n * Must not write to the store: this runs inside `onBeforeUpdate`, where a nested `updateShapes`\n * is overwritten by the outer put and the old asset would stick.\n */\nexport function resolveBookmarkAssetForUrlChange(\n\teditor: Editor,\n\tshape: TLBookmarkShape\n): TLBookmarkShape {\n\tconst { url } = shape.props\n\n\t// Derive the asset id from the URL\n\tconst assetId: TLAssetId = AssetRecordType.createId(getHashForString(url))\n\n\tif (editor.getAsset(assetId)) {\n\t\tif (shape.props.assetId === assetId) return shape\n\t\treturn { ...shape, props: { ...shape.props, assetId } }\n\t}\n\n\t// No asset for this URL yet: drop the stale reference and fetch one asynchronously\n\tcreateBookmarkAssetOnUrlChange(editor, shape)\n\tif (shape.props.assetId === null) return shape\n\treturn { ...shape, props: { ...shape.props, assetId: null } }\n}\n\n/**\n * Resolve the asset id to render for a bookmark. Bookmark assets are keyed\n * deterministically by URL, so if the shape has no `assetId` but an asset for\n * its URL already exists in the store, use that.\n *\n * This keeps a bookmark from staying stuck on its placeholder after the shape\n * is recreated outside of the hydration flow \u2014 e.g. on redo, where the\n * placeholder is restored with a null `assetId` but its hydrated asset (created\n * with `history: 'ignore'`) still lives in the store.\n */\nexport function getResolvedBookmarkAssetId(\n\teditor: Editor,\n\tassetId: TLAssetId | null,\n\turl: string\n): TLAssetId | null {\n\tif (assetId) return assetId\n\tif (!url) return null\n\n\tconst derivedId: TLAssetId = AssetRecordType.createId(getHashForString(url))\n\treturn editor.getAsset(derivedId) ? derivedId : null\n}\n\n/**\n * The effective height to render and measure a bookmark at.\n *\n * Normally this is the stored `props.h`. But when the shape's `assetId` resolves\n * to a different asset than it stores \u2014 e.g. a placeholder restored on redo with\n * a null `assetId` whose asset already exists in the store \u2014 `props.h` is stale\n * (it still holds the placeholder height). In that case recompute the height\n * from the resolved asset so rendering, the indicator, and the geometry/selection\n * bounds all stay in sync.\n */\nexport function getBookmarkShapeHeight(editor: Editor, shape: TLBookmarkShape): number {\n\tconst resolvedAssetId = getResolvedBookmarkAssetId(editor, shape.props.assetId, shape.props.url)\n\tif (resolvedAssetId === shape.props.assetId) return shape.props.h\n\treturn getBookmarkHeight(editor, resolvedAssetId, shape.props.url)\n}\n\nasync function _createBookmarkAssetOnUrlChange(editor: Editor, shape: TLBookmarkShape) {\n\tif (editor.isDisposed) return\n\n\tconst { url } = shape.props\n\tif (!canUnfurlUrl(url)) return\n\n\t// Create the asset using the external content manager's createAssetFromUrl method.\n\t// This may be overwritten by the user (for example, we overwrite it on tldraw.com)\n\tconst asset = await editor.getAssetForExternalContent({ type: 'url', url })\n\n\tif (!asset) {\n\t\t// No asset? Just leave the bookmark as a null assetId.\n\t\treturn\n\t}\n\n\teditor.run(() => {\n\t\t// Create the new asset\n\t\teditor.createAssets([asset])\n\n\t\t// And update the shape\n\t\teditor.updateShapes([\n\t\t\t{\n\t\t\t\tid: shape.id,\n\t\t\t\ttype: shape.type,\n\t\t\t\tprops: { assetId: asset.id },\n\t\t\t},\n\t\t])\n\t})\n}\n\nconst bookmarkDebouncers = new WeakMap<\n\tEditor,\n\tReturnType<typeof debounce<[Editor, TLBookmarkShape], void>>\n>()\n\nfunction createBookmarkAssetOnUrlChange(editor: Editor, shape: TLBookmarkShape) {\n\tlet fn = bookmarkDebouncers.get(editor)\n\tif (!fn) {\n\t\tfn = debounce(_createBookmarkAssetOnUrlChange, 500)\n\t\tbookmarkDebouncers.set(editor, fn)\n\t}\n\tfn(editor, shape)\n}\n\n/**\n * Creates a bookmark shape from a URL.\n *\n * The shape is created immediately as a placeholder so the user gets visible\n * feedback at the paste location, and the bookmark metadata (title, description,\n * image, favicon) is fetched in the background. Once metadata resolves, the\n * shape is patched with the resulting asset. If the fetch fails, the shape is\n * left as a URL-only bookmark.\n *\n * @returns A Result containing the created bookmark shape or an error\n * @public\n */\nexport async function createBookmarkFromUrl(\n\teditor: Editor,\n\t{\n\t\turl,\n\t\tcenter = editor.getViewportPageBounds().center,\n\t}: {\n\t\turl: string\n\t\tcenter?: { x: number; y: number }\n\t}\n): Promise<Result<TLBookmarkShape, string>> {\n\ttry {\n\t\t// If we already have a bookmark asset for this URL (e.g. another bookmark\n\t\t// shape was created from the same URL earlier), use it immediately rather\n\t\t// than re-fetching.\n\t\tconst expectedAssetId: TLAssetId = AssetRecordType.createId(getHashForString(url))\n\t\tconst existingAsset = editor.getAsset(expectedAssetId) as TLBookmarkAsset | null\n\n\t\tconst shapeId = createShapeId()\n\t\tconst shapePartial: TLShapePartial<TLBookmarkShape> = {\n\t\t\tid: shapeId,\n\t\t\ttype: 'bookmark',\n\t\t\tx: center.x - BOOKMARK_WIDTH / 2,\n\t\t\ty: center.y - BOOKMARK_HEIGHT / 2,\n\t\t\trotation: 0,\n\t\t\topacity: 1,\n\t\t\tprops: {\n\t\t\t\turl,\n\t\t\t\tassetId: existingAsset?.id ?? null,\n\t\t\t\tw: BOOKMARK_WIDTH,\n\t\t\t\th: getBookmarkHeight(editor, existingAsset?.id, url),\n\t\t\t},\n\t\t}\n\n\t\teditor.run(() => {\n\t\t\teditor.createShapes([shapePartial])\n\t\t})\n\n\t\tconst createdShape = editor.getShape<TLBookmarkShape>(shapeId)\n\t\tif (!createdShape) {\n\t\t\treturn Result.err('Failed to create bookmark shape')\n\t\t}\n\n\t\t// If we already had the asset, we're done \u2014 no metadata fetch needed.\n\t\tif (existingAsset) {\n\t\t\treturn Result.ok(createdShape)\n\t\t}\n\n\t\t// Otherwise kick off the metadata fetch in the background. The shape is\n\t\t// already visible as a placeholder; once the asset resolves we'll patch\n\t\t// the shape with its assetId.\n\t\tvoid hydrateBookmarkShape(editor, shapeId, url)\n\n\t\treturn Result.ok(createdShape)\n\t} catch (error) {\n\t\treturn Result.err(error instanceof Error ? error.message : 'Failed to create bookmark')\n\t}\n}\n\nasync function hydrateBookmarkShape(editor: Editor, shapeId: TLShapeId, url: string) {\n\tif (!canUnfurlUrl(url)) return\n\n\tlet asset\n\ttry {\n\t\tasset = await editor.getAssetForExternalContent({ type: 'url', url })\n\t} catch (error) {\n\t\tconsole.error(error)\n\t\treturn\n\t}\n\n\tif (editor.isDisposed) return\n\tif (!asset) return\n\n\t// The shape may have been deleted (e.g. via undo), had its URL changed, or\n\t// had its asset replaced before the fetch resolved. In any of those cases we\n\t// don't want to attach metadata for the old URL.\n\tconst shape = editor.getShape<TLBookmarkShape>(shapeId)\n\tif (!shape) return\n\tif (shape.props.url !== url) return\n\tif (shape.props.assetId) return\n\n\teditor.run(\n\t\t() => {\n\t\t\tif (!editor.getAsset(asset.id)) {\n\t\t\t\teditor.createAssets([asset])\n\t\t\t}\n\t\t\teditor.updateShapes([\n\t\t\t\t{\n\t\t\t\t\tid: shapeId,\n\t\t\t\t\ttype: 'bookmark',\n\t\t\t\t\tprops: { assetId: asset.id },\n\t\t\t\t},\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AAA,EAC9B,SAAS,OAAO;AACf,WAAO,qBAAO,IAAI,iBAAiB,QAAQ,MAAM,UAAU,2BAA2B;AAAA,EACvF;AACD;AAEA,eAAe,qBAAqB,QAAgB,SAAoB,KAAa;AACpF,MAAI,CAAC,aAAa,GAAG,EAAG;AAExB,MAAI;AACJ,MAAI;AACH,YAAQ,MAAM,OAAO,2BAA2B,EAAE,MAAM,OAAO,IAAI,CAAC;AAAA,EACrE,SAAS,OAAO;AACf,YAAQ,MAAM,KAAK;AACnB;AAAA,EACD;AAEA,MAAI,OAAO,WAAY;AACvB,MAAI,CAAC,MAAO;AAKZ,QAAM,QAAQ,OAAO,SAA0B,OAAO;AACtD,MAAI,CAAC,MAAO;AACZ,MAAI,MAAM,MAAM,QAAQ,IAAK;AAC7B,MAAI,MAAM,MAAM,QAAS;AAEzB,SAAO;AAAA,IACN,MAAM;AACL,UAAI,CAAC,OAAO,SAAS,MAAM,EAAE,GAAG;AAC/B,eAAO,aAAa,CAAC,KAAK,CAAC;AAAA,MAC5B;AACA,aAAO,aAAa;AAAA,QACnB;AAAA,UACC,IAAI;AAAA,UACJ,MAAM;AAAA,UACN,OAAO,EAAE,SAAS,MAAM,GAAG;AAAA,QAC5B;AAAA,MACD,CAAC;AAAA,IACF;AAAA,IACA,EAAE,SAAS,SAAS;AAAA,EACrB;AACD;",
6
6
  "names": []
7
7
  }
@@ -36,10 +36,12 @@ var import_editor = require("@tldraw/editor");
36
36
  var import_classnames = __toESM(require("classnames"), 1);
37
37
  var import_react = require("react");
38
38
  var import_useEfficientZoomThreshold = require("./useEfficientZoomThreshold");
39
+ var import_useOpenLinkHandler = require("./useOpenLinkHandler");
39
40
  const LINK_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' fill='none'%3E%3Cpath stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 5H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6M19 5h6m0 0v6m0-6L13 17'/%3E%3C/svg%3E";
40
41
  function HyperlinkButton({ url }) {
41
42
  const editor = (0, import_editor.useEditor)();
42
43
  const hideButton = (0, import_useEfficientZoomThreshold.useEfficientZoomThreshold)();
44
+ const handleOpenLink = (0, import_useOpenLinkHandler.useOpenLinkHandler)(url);
43
45
  const markAsHandledOnShiftKey = (0, import_react.useCallback)(
44
46
  (e) => {
45
47
  if (!editor.inputs.getShiftKey()) editor.markEventAsHandled(e);
@@ -57,6 +59,8 @@ function HyperlinkButton({ url }) {
57
59
  rel: "noopener noreferrer",
58
60
  onPointerDown: markAsHandledOnShiftKey,
59
61
  onPointerUp: markAsHandledOnShiftKey,
62
+ onClick: handleOpenLink,
63
+ onAuxClick: handleOpenLink,
60
64
  title: url,
61
65
  draggable: false,
62
66
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/shapes/shared/HyperlinkButton.tsx"],
4
- "sourcesContent": ["import { useEditor } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { PointerEventHandler, useCallback } from 'react'\nimport { useEfficientZoomThreshold } from './useEfficientZoomThreshold'\n\nconst LINK_ICON =\n\t\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' fill='none'%3E%3Cpath stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 5H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6M19 5h6m0 0v6m0-6L13 17'/%3E%3C/svg%3E\"\n\nexport function HyperlinkButton({ url }: { url: string }) {\n\tconst editor = useEditor()\n\tconst hideButton = useEfficientZoomThreshold()\n\tconst markAsHandledOnShiftKey = useCallback<PointerEventHandler>(\n\t\t(e) => {\n\t\t\tif (!editor.inputs.getShiftKey()) editor.markEventAsHandled(e)\n\t\t},\n\t\t[editor]\n\t)\n\treturn (\n\t\t<a\n\t\t\tclassName={classNames('tl-hyperlink-button', {\n\t\t\t\t'tl-hyperlink-button__hidden': hideButton,\n\t\t\t})}\n\t\t\thref={url}\n\t\t\ttarget=\"_blank\"\n\t\t\trel=\"noopener noreferrer\"\n\t\t\tonPointerDown={markAsHandledOnShiftKey}\n\t\t\tonPointerUp={markAsHandledOnShiftKey}\n\t\t\ttitle={url}\n\t\t\tdraggable={false}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"tl-hyperlink__icon\"\n\t\t\t\tstyle={{\n\t\t\t\t\tmask: `url(\"${LINK_ICON}\") center 100% / 100% no-repeat`,\n\t\t\t\t\tWebkitMask: `url(\"${LINK_ICON}\") center 100% / 100% no-repeat`,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</a>\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BG;AA9BH,oBAA0B;AAC1B,wBAAuB;AACvB,mBAAiD;AACjD,uCAA0C;AAE1C,MAAM,YACL;AAEM,SAAS,gBAAgB,EAAE,IAAI,GAAoB;AACzD,QAAM,aAAS,yBAAU;AACzB,QAAM,iBAAa,4DAA0B;AAC7C,QAAM,8BAA0B;AAAA,IAC/B,CAAC,MAAM;AACN,UAAI,CAAC,OAAO,OAAO,YAAY,EAAG,QAAO,mBAAmB,CAAC;AAAA,IAC9D;AAAA,IACA,CAAC,MAAM;AAAA,EACR;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,eAAW,kBAAAA,SAAW,uBAAuB;AAAA,QAC5C,+BAA+B;AAAA,MAChC,CAAC;AAAA,MACD,MAAM;AAAA,MACN,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,eAAe;AAAA,MACf,aAAa;AAAA,MACb,OAAO;AAAA,MACP,WAAW;AAAA,MAEX;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,OAAO;AAAA,YACN,MAAM,QAAQ,SAAS;AAAA,YACvB,YAAY,QAAQ,SAAS;AAAA,UAC9B;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["import { useEditor } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { PointerEventHandler, useCallback } from 'react'\nimport { useEfficientZoomThreshold } from './useEfficientZoomThreshold'\nimport { useOpenLinkHandler } from './useOpenLinkHandler'\n\nconst LINK_ICON =\n\t\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' fill='none'%3E%3Cpath stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 5H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6M19 5h6m0 0v6m0-6L13 17'/%3E%3C/svg%3E\"\n\nexport function HyperlinkButton({ url }: { url: string }) {\n\tconst editor = useEditor()\n\tconst hideButton = useEfficientZoomThreshold()\n\tconst handleOpenLink = useOpenLinkHandler(url)\n\tconst markAsHandledOnShiftKey = useCallback<PointerEventHandler>(\n\t\t(e) => {\n\t\t\tif (!editor.inputs.getShiftKey()) editor.markEventAsHandled(e)\n\t\t},\n\t\t[editor]\n\t)\n\treturn (\n\t\t<a\n\t\t\tclassName={classNames('tl-hyperlink-button', {\n\t\t\t\t'tl-hyperlink-button__hidden': hideButton,\n\t\t\t})}\n\t\t\thref={url}\n\t\t\ttarget=\"_blank\"\n\t\t\trel=\"noopener noreferrer\"\n\t\t\tonPointerDown={markAsHandledOnShiftKey}\n\t\t\tonPointerUp={markAsHandledOnShiftKey}\n\t\t\tonClick={handleOpenLink}\n\t\t\tonAuxClick={handleOpenLink}\n\t\t\ttitle={url}\n\t\t\tdraggable={false}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"tl-hyperlink__icon\"\n\t\t\t\tstyle={{\n\t\t\t\t\tmask: `url(\"${LINK_ICON}\") center 100% / 100% no-repeat`,\n\t\t\t\t\tWebkitMask: `url(\"${LINK_ICON}\") center 100% / 100% no-repeat`,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</a>\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCG;AAlCH,oBAA0B;AAC1B,wBAAuB;AACvB,mBAAiD;AACjD,uCAA0C;AAC1C,gCAAmC;AAEnC,MAAM,YACL;AAEM,SAAS,gBAAgB,EAAE,IAAI,GAAoB;AACzD,QAAM,aAAS,yBAAU;AACzB,QAAM,iBAAa,4DAA0B;AAC7C,QAAM,qBAAiB,8CAAmB,GAAG;AAC7C,QAAM,8BAA0B;AAAA,IAC/B,CAAC,MAAM;AACN,UAAI,CAAC,OAAO,OAAO,YAAY,EAAG,QAAO,mBAAmB,CAAC;AAAA,IAC9D;AAAA,IACA,CAAC,MAAM;AAAA,EACR;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,eAAW,kBAAAA,SAAW,uBAAuB;AAAA,QAC5C,+BAA+B;AAAA,MAChC,CAAC;AAAA,MACD,MAAM;AAAA,MACN,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,eAAe;AAAA,MACf,aAAa;AAAA,MACb,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,WAAW;AAAA,MAEX;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,OAAO;AAAA,YACN,MAAM,QAAQ,SAAS;AAAA,YACvB,YAAY,QAAQ,SAAS;AAAA,UAC9B;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": ["classNames"]
7
7
  }
@@ -36,6 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_editor = require("@tldraw/editor");
37
37
  var import_classnames = __toESM(require("classnames"), 1);
38
38
  var import_react = __toESM(require("react"), 1);
39
+ var import_openLink = require("../../utils/openLink");
39
40
  var import_richText = require("../../utils/text/richText");
40
41
  var import_RichTextArea = require("../text/RichTextArea");
41
42
  var import_legacyProps = require("./legacyProps");
@@ -93,13 +94,22 @@ const RichTextLabel = import_react.default.memo(function RichTextLabel2({
93
94
  const handlePointerUp = (e2) => {
94
95
  if (e2.name !== "pointer_up" || !link) return;
95
96
  if (!isDragging.current) {
96
- (0, import_editor.openWindow)(link, "_blank", false);
97
+ (0, import_openLink.openLink)(editor, link);
97
98
  }
98
99
  editor.off("event", handlePointerUp);
99
100
  };
100
101
  editor.on("event", handlePointerUp);
101
102
  }
102
103
  };
104
+ const handleLinkClick = (e) => {
105
+ if (e.type === "auxclick" && e.button !== 1) return;
106
+ const HTMLElementCtor = editor.getContainerWindow().HTMLElement;
107
+ if (!(e.target instanceof HTMLElementCtor)) return;
108
+ const anchor = e.target.closest("a");
109
+ if (!anchor) return;
110
+ (0, import_editor.preventDefault)(e);
111
+ if (e.detail === 0) (0, import_openLink.openLink)(editor, anchor.getAttribute("href") ?? "");
112
+ };
103
113
  if (!isEditing && isEmpty) return null;
104
114
  const cssPrefix = classNamePrefix || "tl-text";
105
115
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -145,6 +155,8 @@ const RichTextLabel = import_react.default.memo(function RichTextLabel2({
145
155
  "data-is-select-tool-active": selectToolActive,
146
156
  dangerouslySetInnerHTML: { __html: html || "" },
147
157
  onPointerDown: handlePointerDown,
158
+ onClick: handleLinkClick,
159
+ onAuxClick: handleLinkClick,
148
160
  "data-is-ready-for-editing": isReadyForEditing
149
161
  }
150
162
  ) }),