@mocanvas/mocanvas 4.0.2 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +8 -2
- package/MIGRATION.md +48 -22
- package/README.md +27 -2
- package/UI.md +24 -2
- package/dist/{chunk-TWCVRVK2.js → chunk-3F2HKY37.js} +3 -3
- package/dist/{chunk-TWCVRVK2.js.map → chunk-3F2HKY37.js.map} +1 -1
- package/dist/{chunk-DMCI6V5Y.js → chunk-HRUFJLK5.js} +3 -3
- package/dist/{chunk-DMCI6V5Y.js.map → chunk-HRUFJLK5.js.map} +1 -1
- package/dist/{chunk-OCYJAMXT.js → chunk-S7FPGQAA.js} +22 -3
- package/dist/chunk-S7FPGQAA.js.map +1 -0
- package/dist/{chunk-QDUQZXE4.js → chunk-YMUR46N6.js} +456 -19
- package/dist/chunk-YMUR46N6.js.map +1 -0
- package/dist/{export-VQGOVONC.js → export-UA6X35ZW.js} +4 -4
- package/dist/{export-VQGOVONC.js.map → export-UA6X35ZW.js.map} +1 -1
- package/dist/index.d.ts +302 -46
- package/dist/index.js +435 -416
- package/dist/index.js.map +1 -1
- package/dist/{ui-4C5V5GYT.css → mocanvas.css} +73 -241
- package/dist/mocanvas.css.map +1 -0
- package/dist/panel-shortcuts-4GIFCQQR.js +4 -0
- package/dist/{panel-shortcuts-R2PDTDUN.js.map → panel-shortcuts-4GIFCQQR.js.map} +1 -1
- package/dist/urlContent-WYYVQYYN.js +4 -0
- package/dist/{urlContent-GC44EU52.js.map → urlContent-WYYVQYYN.js.map} +1 -1
- package/package.json +8 -4
- package/dist/chunk-OCYJAMXT.js.map +0 -1
- package/dist/chunk-QDUQZXE4.js.map +0 -1
- package/dist/panel-shortcuts-R2PDTDUN.js +0 -4
- package/dist/urlContent-GC44EU52.js +0 -4
package/dist/index.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { getSvgString, exportToBlob, getTextMeasure, copyBlobToClipboard, downloadBlob, DEFAULT_GEO_TYPE_DEFINITIONS, GeoShapeUtil, ArrowShapeUtil, TextShapeUtil, NoteShapeUtil, FrameShapeUtil, VideoShapeUtil, getRichTextExtensions, TextLabel, textToSvg, getFontFamily, getArrowTerminalsInArrowSpace, getArrowBindings, getElbowBody, getArrowBody, getBodyLength, getArrowheadLength, getArrowheadInset, shortenBody, getElbowRoute, getArrowBindingTargetAtPoint, getNormalizedAnchor, getThemeColors, getDashId, getFillRgba, getStrokeRgba } from './chunk-
|
|
2
|
-
export { ARROW_KINDS, ARROW_LABEL_PADDING, ARROW_TERMINAL_GAP_STROKES, AVG_CHAR_WIDTH, ArrowShapeUtil, DEFAULT_GEO_TYPE_DEFINITIONS, ELBOW_CORNER_STROKES, FALLBACK_THEME_COLORS, FRAME_FILL, FRAME_NAME_COLOR, FRAME_NAME_FONT_SIZE, FRAME_NAME_GAP, FRAME_NAME_HEIGHT, FRAME_NAME_OFFSET, FRAME_STROKE, FRAME_STROKE_WIDTH, FrameShapeUtil, GEO_DEFAULT_SIZE, GEO_LABEL_PADDING, GeoShapeUtil, LINE_HEIGHT, MAX_TEXT_TEXTURE_PX, NOTE_GRADIENT_TOP_SCALE, NOTE_PADDING, NOTE_SHADOW_BLUR, NOTE_SHADOW_COLOR, NOTE_SHADOW_OFFSET_Y, NOTE_SHADOW_OPACITY, NOTE_SHADOW_SPREAD, NOTE_SIZE, NoteShapeUtil, RICH_TEXT_BLOCK_CSS, SVG_DARK_BACKGROUND, SVG_EXPORT_DEFAULT_PADDING, SVG_LIGHT_BACKGROUND, TEXT_SHAPE_MIN_WIDTH, TextLabel, TextMeasure, TextShapeUtil, VIDEO_HEIGHT, VIDEO_PLACEHOLDER_FILL, VIDEO_PLACEHOLDER_STROKE, VIDEO_PLAY_COLOR, VIDEO_PLAY_SIZE, VIDEO_TIME_EPSILON, VIDEO_WIDTH, VideoShapeUtil, alignToJustify, alignToTextAlign, applyTransform, bodyToGeometry, computeGrowY, copyBlobToClipboard, dashArray, defaultShapeSvgRenderer, downloadBlob, escapeXml, estimateTextSize, exportToBlob, geoShapeMigrations, geoShapeVersions, geometryFallbackSvg, geometryToSvgPaths, getAnchorInShapeSpace, getArrowBindingTargetAtPoint, getArrowBindings, getArrowBody, getArrowDisplayValues, getArrowTerminalGap, getArrowTerminalsInArrowSpace, getArrowheadGeometry, getArrowheadInset, getArrowheadLength, getBendFromPoint, getBodyLength, getBoundElbowAxes, getDashId, getDominantAxis, getElbowBody, getElbowMidPointFromPoint, getElbowRoute, getExportBounds, getExportShapes, getFillRgba, getFontFamily, getFrameDisplayValues, getGeoDisplayValues, getGeoGrowY, getGeoTypeDefinition, getLabelFontFaces, getLabelOpticalLift, getNormalizedAnchor, getNoteBodyGradientCss, getNoteDisplayValues, getNoteFillCssColor, getNoteFillRgba, getNoteFontSize, getNoteGradientTopCssColor, getNoteGradientTopFrom, getNoteGrowY, getNoteShadowCss, getNoteShadowSvgRect, getNoteTextCssColor, getOutlineSegments, getPointOnBody, getRichTextExtensions, getStrokeRgba, getSvgString, getTangentOnBody, getTextCssColor, getTextDisplayValues, getTextMeasure, getTextShapeBox, getTextShapeHeight, getTextShapeSize, getTextShapeSizeFor, getTextShapeTextureSpec, getTextTextureKey, getTextTextureScale, getTheme, getThemeColors, getVideoDisplayValues, getVideoPlayTriangle, getVideoSource, hexToCssRgba, horizontalAlignToFlex, horizontalAlignToTextAlign, intersectSegments, isVideoAutoplayAllowed, labelFontFamily, labelFontStyle, labelGapOnBody, labelTextAlign, matrixAttr, measureGeoLabel, measureLabel, measureRichText, readArrowProps, readArrowShape, readGeoProps, readNoteProps, readTextProps, registerShapeSvgRenderer, renderHtmlFromRichTextForMeasurement, renderHtmlFromRichTextWithExtensions, renderTextToCanvas, rgbaToHex, roundElbowCorners, shapeSvgRenderers, shapeToBackgroundSvg, shapeToSvg, shortenBody, svgResultToMarkup, textTextureAlign, textTextureText, textToSvg, toDisplayText, trimTrailingWhitespace, verticalAlignToAlignItems, verticalAlignToFlex, wrapTextLines, wrapTextTextureLines, wrapTextTextureRuns } from './chunk-
|
|
1
|
+
import { getSvgString, exportToBlob, getTextMeasure, copyBlobToClipboard, downloadBlob, DEFAULT_GEO_TYPE_DEFINITIONS, GeoShapeUtil, ArrowShapeUtil, TextShapeUtil, NoteShapeUtil, FrameShapeUtil, VideoShapeUtil, getRichTextExtensions, TextLabel, textToSvg, getFontFamily, getArrowTerminalsInArrowSpace, getArrowBindings, getElbowBody, getArrowBody, getBodyLength, getArrowheadLength, getArrowheadInset, shortenBody, getElbowRoute, getArrowBindingTargetAtPoint, getNormalizedAnchor, getThemeColors, getDashId, getFillRgba, getStrokeRgba } from './chunk-HRUFJLK5.js';
|
|
2
|
+
export { ARROW_KINDS, ARROW_LABEL_PADDING, ARROW_TERMINAL_GAP_STROKES, AVG_CHAR_WIDTH, ArrowShapeUtil, DEFAULT_GEO_TYPE_DEFINITIONS, ELBOW_CORNER_STROKES, FALLBACK_THEME_COLORS, FRAME_FILL, FRAME_NAME_COLOR, FRAME_NAME_FONT_SIZE, FRAME_NAME_GAP, FRAME_NAME_HEIGHT, FRAME_NAME_OFFSET, FRAME_STROKE, FRAME_STROKE_WIDTH, FrameShapeUtil, GEO_DEFAULT_SIZE, GEO_LABEL_PADDING, GeoShapeUtil, LINE_HEIGHT, MAX_TEXT_TEXTURE_PX, NOTE_GRADIENT_TOP_SCALE, NOTE_PADDING, NOTE_SHADOW_BLUR, NOTE_SHADOW_COLOR, NOTE_SHADOW_OFFSET_Y, NOTE_SHADOW_OPACITY, NOTE_SHADOW_SPREAD, NOTE_SIZE, NoteShapeUtil, RICH_TEXT_BLOCK_CSS, SVG_DARK_BACKGROUND, SVG_EXPORT_DEFAULT_PADDING, SVG_LIGHT_BACKGROUND, TEXT_SHAPE_MIN_WIDTH, TextLabel, TextMeasure, TextShapeUtil, VIDEO_HEIGHT, VIDEO_PLACEHOLDER_FILL, VIDEO_PLACEHOLDER_STROKE, VIDEO_PLAY_COLOR, VIDEO_PLAY_SIZE, VIDEO_TIME_EPSILON, VIDEO_WIDTH, VideoShapeUtil, alignToJustify, alignToTextAlign, applyTransform, bodyToGeometry, computeGrowY, copyBlobToClipboard, dashArray, defaultShapeSvgRenderer, downloadBlob, escapeXml, estimateTextSize, exportToBlob, geoShapeMigrations, geoShapeVersions, geometryFallbackSvg, geometryToSvgPaths, getAnchorInShapeSpace, getArrowBindingTargetAtPoint, getArrowBindings, getArrowBody, getArrowDisplayValues, getArrowTerminalGap, getArrowTerminalsInArrowSpace, getArrowheadGeometry, getArrowheadInset, getArrowheadLength, getBendFromPoint, getBodyLength, getBoundElbowAxes, getDashId, getDominantAxis, getElbowBody, getElbowMidPointFromPoint, getElbowRoute, getExportBounds, getExportShapes, getFillRgba, getFontFamily, getFrameDisplayValues, getGeoDisplayValues, getGeoGrowY, getGeoTypeDefinition, getLabelFontFaces, getLabelOpticalLift, getNormalizedAnchor, getNoteBodyGradientCss, getNoteDisplayValues, getNoteFillCssColor, getNoteFillRgba, getNoteFontSize, getNoteGradientTopCssColor, getNoteGradientTopFrom, getNoteGrowY, getNoteShadowCss, getNoteShadowSvgRect, getNoteTextCssColor, getOutlineSegments, getPointOnBody, getRichTextExtensions, getStrokeRgba, getSvgString, getTangentOnBody, getTextCssColor, getTextDisplayValues, getTextMeasure, getTextShapeBox, getTextShapeHeight, getTextShapeSize, getTextShapeSizeFor, getTextShapeTextureSpec, getTextTextureKey, getTextTextureScale, getTheme, getThemeColors, getVideoDisplayValues, getVideoPlayTriangle, getVideoSource, hexToCssRgba, horizontalAlignToFlex, horizontalAlignToTextAlign, intersectSegments, isVideoAutoplayAllowed, labelFontFamily, labelFontStyle, labelGapOnBody, labelTextAlign, matrixAttr, measureGeoLabel, measureLabel, measureRichText, readArrowProps, readArrowShape, readGeoProps, readNoteProps, readTextProps, registerShapeSvgRenderer, renderHtmlFromRichTextForMeasurement, renderHtmlFromRichTextWithExtensions, renderTextToCanvas, rgbaToHex, roundElbowCorners, shapeSvgRenderers, shapeToBackgroundSvg, shapeToSvg, shortenBody, svgResultToMarkup, textTextureAlign, textTextureText, textToSvg, toDisplayText, trimTrailingWhitespace, verticalAlignToAlignItems, verticalAlignToFlex, wrapTextLines, wrapTextTextureLines, wrapTextTextureRuns } from './chunk-HRUFJLK5.js';
|
|
3
3
|
export { TLDRAW_FILE_EXTENSION, loadMocanvasFile, parseTldrawJsonFile, serializeMocanvasFile, serializeTldrawJson, serializeTldrawJsonBlob } from './chunk-GYF6AY4N.js';
|
|
4
|
-
import { registerDefaultExternalContentHandlers, createTextShapeAt, createImageAssetFromSvgText, defaultHandleExternalUrlContent, createBookmarkShape, readFileAsDataUrl, classifyExternalText } from './chunk-
|
|
5
|
-
export { BOOKMARK_UNFURL_FAILED, DEFAULT_MAX_IMAGE_DIMENSION, classifyExternalText, createBookmarkShape, createEmbedShape, createImageAssetFromFile, createImageAssetFromSvgText, createImageShapesForAssets, createTextShapeAt, defaultHandleExternalUrlContent, fitImageSize, getSvgTextSize, isAnimatedImageType, isImageFile, isSvgFile, loadImageSizeInBrowser, looksLikeSvg, looksLikeUrl, readFileAsDataUrl, registerDefaultExternalContentHandlers, svgTextToDataUrl } from './chunk-
|
|
6
|
-
import { registerRichTextEditorFactory, BookmarkShapeUtil, EmbedShapeUtil, richTextToHtml, richTextToText, asRichText, RICH_TEXT_NODES, RICH_TEXT_MARKS, readArray, propsOf, readNumber, readEnum, readBoolean, readStyle, drawShapeProps, drawShapeMigrations, polylinePath, highlightShapeProps, highlightShapeMigrations, readString, imageShapeProps, imageShapeMigrations, rectPath, lineShapeProps, lineShapeMigrations, svgPath, groupShapeProps, groupShapeMigrations, boxPath, toRichText } from './chunk-
|
|
7
|
-
export { BOOKMARK_BANNER_FILL, BOOKMARK_BANNER_HEIGHT, BOOKMARK_FAVICON_SIZE, BOOKMARK_FILL, BOOKMARK_GAP, BOOKMARK_HEIGHT, BOOKMARK_META_COLOR, BOOKMARK_META_FONT_SIZE, BOOKMARK_META_HEIGHT, BOOKMARK_MIN_BODY_HEIGHT, BOOKMARK_PADDING, BOOKMARK_RADIUS, BOOKMARK_STROKE, BOOKMARK_STROKE_WIDTH, BOOKMARK_TEXT_COLOR, BOOKMARK_TEXT_FONT_SIZE, BOOKMARK_TITLE_COLOR, BOOKMARK_TITLE_FONT_SIZE, BOOKMARK_TITLE_HEIGHT, BOOKMARK_WIDTH, BookmarkShapeUtil, DEFAULT_EMBED_DEFINITIONS, EMBED_HEIGHT, EMBED_PLACEHOLDER_FILL, EMBED_PLACEHOLDER_FONT_SIZE, EMBED_PLACEHOLDER_PADDING, EMBED_PLACEHOLDER_STROKE, EMBED_PLACEHOLDER_TEXT, EMBED_RADIUS, EMBED_SANDBOX, EMBED_SHAPE_PERMISSION_NAMES, EMBED_WIDTH, EmbedShapeUtil, RICH_TEXT_MARKS, RICH_TEXT_NODES, applyPlainTextToRichText, arrowBindingMigrations, arrowBindingProps, arrowShapeMigrations, arrowShapeProps, arrowShapeVersions, asRichText, bookmarkShapeMigrations, bookmarkShapeProps, boxPath, canBuildPath, createEmptyBookmarkShape, drawShapeMigrations, drawShapeProps, embedDefinitions, embedShapeMigrations, embedShapePermissionsToAllow, embedShapeProps, escapeHtml, frameShapeMigrations, frameShapeProps, geoShapeProps, getBookmarkAsset, getBookmarkCard, getBookmarkHostname, getBookmarkLayout, getEmbedDefinition, getEmbedDisplayValues, getEmbedInfo, getRichTextEditorFactory, groupShapeMigrations, groupShapeProps, highlightShapeMigrations, highlightShapeProps, imageShapeMigrations, imageShapeProps, isRichText, lineShapeMigrations, lineShapeProps, loadTipTapStarterExtensions, noteShapeMigrations, noteShapeProps, polylinePath, propsOf, readArray, readBoolean, readEnum, readNumber, readPoint, readRecord, readRichText, readString, readStyle, readText, rectPath, registerRichTextEditorFactory, richTextEquals, richTextToBlocks, richTextToHtml, richTextToText, richTextValidator, safeHref, svgPath, textShapeMigrations, textShapeProps, tipTapDefaultExtensions, toRichText, unknownEmbedShapePermissionOverrides, videoShapeMigrations, videoShapeProps } from './chunk-
|
|
8
|
-
import { Icon, Popover, TldrawUiMenuItem, TldrawUiMenuSubmenu, TldrawUiMenuGroup, TldrawUiMenuCheckboxItem,
|
|
9
|
-
export { DefaultDialogs, DefaultKeyboardShortcutsDialog, DefaultKeyboardShortcutsDialogContent, ExampleDialog, FloatingLayer, GEO_BOX, GEO_ICON_PATHS, ICONS, ICON_GRID, ICON_NAMES, Icon, KeyboardShortcutsDialogContents, LANGUAGES, Popover, RTL_LANGUAGES, TldrawUiButton, TldrawUiButtonCheck, TldrawUiButtonIcon, TldrawUiButtonLabel, TldrawUiDialogBody, TldrawUiDialogCloseButton, TldrawUiDialogFooter, TldrawUiDialogHeader, TldrawUiDialogTitle, TldrawUiDialogsProvider, TldrawUiDropdownMenuCheckboxItem, TldrawUiDropdownMenuContent, TldrawUiDropdownMenuGroup, TldrawUiDropdownMenuIndicator, TldrawUiDropdownMenuItem, TldrawUiDropdownMenuRoot, TldrawUiDropdownMenuSub, TldrawUiDropdownMenuSubContent, TldrawUiDropdownMenuSubTrigger, TldrawUiDropdownMenuTrigger, TldrawUiEventsProvider, TldrawUiIcon, TldrawUiKbd, TldrawUiMenuActionCheckboxItem, TldrawUiMenuActionItem, TldrawUiMenuCheckboxItem, TldrawUiMenuContextProvider, TldrawUiMenuGroup, TldrawUiMenuItem, TldrawUiMenuSubmenu, TldrawUiMenuToolItem, TldrawUiTranslationProvider, UiTooltip, getDefaultTranslationLocale, getGeoIconBox, isRtlLanguage, kbdToKeys, placeNear, useActionState, useAnchoredPosition, useCanApplySelectionAction, useCanRedo, useCanUndo, useCurrentTranslation, useDialogs, useDirection, useDismissable, useHasLockedShapes, useIsDarkMode, useIsGridMode, useMaybeCurrentTranslation, useMenuKeyboard, useMsg, useReadonly, useRelevantStyles, useTldrawUiMenuContext, useTranslation, useUiEvents, useUnlockedSelectedShapesCount } from './chunk-
|
|
4
|
+
import { registerDefaultExternalContentHandlers, createTextShapeAt, createImageAssetFromSvgText, defaultHandleExternalUrlContent, createBookmarkShape, readFileAsDataUrl, classifyExternalText } from './chunk-3F2HKY37.js';
|
|
5
|
+
export { BOOKMARK_UNFURL_FAILED, DEFAULT_MAX_IMAGE_DIMENSION, classifyExternalText, createBookmarkShape, createEmbedShape, createImageAssetFromFile, createImageAssetFromSvgText, createImageShapesForAssets, createTextShapeAt, defaultHandleExternalUrlContent, fitImageSize, getSvgTextSize, isAnimatedImageType, isImageFile, isSvgFile, loadImageSizeInBrowser, looksLikeSvg, looksLikeUrl, readFileAsDataUrl, registerDefaultExternalContentHandlers, svgTextToDataUrl } from './chunk-3F2HKY37.js';
|
|
6
|
+
import { registerRichTextEditorFactory, BookmarkShapeUtil, EmbedShapeUtil, richTextToHtml, richTextToText, asRichText, RICH_TEXT_NODES, RICH_TEXT_MARKS, readArray, propsOf, readNumber, readEnum, readBoolean, readStyle, drawShapeProps, drawShapeMigrations, polylinePath, highlightShapeProps, highlightShapeMigrations, readString, imageShapeProps, imageShapeMigrations, rectPath, lineShapeProps, lineShapeMigrations, svgPath, groupShapeProps, groupShapeMigrations, boxPath, toRichText } from './chunk-S7FPGQAA.js';
|
|
7
|
+
export { BOOKMARK_BANNER_FILL, BOOKMARK_BANNER_HEIGHT, BOOKMARK_FAVICON_SIZE, BOOKMARK_FILL, BOOKMARK_GAP, BOOKMARK_HEIGHT, BOOKMARK_META_COLOR, BOOKMARK_META_FONT_SIZE, BOOKMARK_META_HEIGHT, BOOKMARK_MIN_BODY_HEIGHT, BOOKMARK_PADDING, BOOKMARK_RADIUS, BOOKMARK_STROKE, BOOKMARK_STROKE_WIDTH, BOOKMARK_TEXT_COLOR, BOOKMARK_TEXT_FONT_SIZE, BOOKMARK_TITLE_COLOR, BOOKMARK_TITLE_FONT_SIZE, BOOKMARK_TITLE_HEIGHT, BOOKMARK_WIDTH, BookmarkShapeUtil, DEFAULT_EMBED_DEFINITIONS, EMBED_HEIGHT, EMBED_PLACEHOLDER_FILL, EMBED_PLACEHOLDER_FONT_SIZE, EMBED_PLACEHOLDER_PADDING, EMBED_PLACEHOLDER_STROKE, EMBED_PLACEHOLDER_TEXT, EMBED_RADIUS, EMBED_SANDBOX, EMBED_SHAPE_PERMISSION_NAMES, EMBED_WIDTH, EmbedShapeUtil, RICH_TEXT_MARKS, RICH_TEXT_NODES, applyPlainTextToRichText, arrowBindingMigrations, arrowBindingProps, arrowShapeMigrations, arrowShapeProps, arrowShapeVersions, asRichText, bookmarkShapeMigrations, bookmarkShapeProps, boxPath, canBuildPath, createEmptyBookmarkShape, drawShapeMigrations, drawShapeProps, embedDefinitions, embedShapeMigrations, embedShapePermissionsToAllow, embedShapeProps, escapeHtml, frameShapeMigrations, frameShapeProps, geoShapeProps, getBookmarkAsset, getBookmarkCard, getBookmarkHostname, getBookmarkLayout, getEmbedDefinition, getEmbedDisplayValues, getEmbedInfo, getRichTextEditorFactory, groupShapeMigrations, groupShapeProps, highlightShapeMigrations, highlightShapeProps, imageShapeMigrations, imageShapeProps, isRichText, lineShapeMigrations, lineShapeProps, loadTipTapStarterExtensions, noteShapeMigrations, noteShapeProps, polylinePath, propsOf, readArray, readBoolean, readEnum, readNumber, readPoint, readRecord, readRichText, readString, readStyle, readText, rectPath, registerRichTextEditorFactory, richTextEquals, richTextToBlocks, richTextToHtml, richTextToText, richTextValidator, safeHref, svgPath, textShapeMigrations, textShapeProps, tipTapDefaultExtensions, toRichText, unknownEmbedShapePermissionOverrides, videoShapeMigrations, videoShapeProps } from './chunk-S7FPGQAA.js';
|
|
8
|
+
import { Icon, Popover, TldrawUiMenuItem, TldrawUiMenuSubmenu, TldrawUiMenuGroup, TldrawUiMenuCheckboxItem, useAvailableTranslationLocales, TldrawUiDropdownMenuRoot, TldrawUiDropdownMenuTrigger, TldrawUiDropdownMenuContent, TldrawUiMenuContextProvider, useRelevantStyles, ICONS, ToolShortcuts, ActionShortcuts, TldrawUiMenuActionItem, TldrawUiDropdownMenuSub, TldrawUiDropdownMenuSubTrigger, TldrawUiDropdownMenuSubContent, FloatingLayer, TldrawUiIcon, DefaultDialogs, useUiEvents, useCanApplySelectionAction, useReadonly, useHasLockedShapes, TldrawUiMenuActionCheckboxItem, useDialogs, UiTooltip, ICON_NAMES, TldrawUiEventsProvider, TldrawUiTranslationProvider, TldrawUiDialogsProvider, useTranslation, useKeyboardShortcuts, debugStatsOpen } from './chunk-YMUR46N6.js';
|
|
9
|
+
export { ActionShortcuts, DefaultDialogs, DefaultKeyboardShortcutsDialog, DefaultKeyboardShortcutsDialogContent, ExampleDialog, FloatingLayer, GEO_BOX, GEO_ICON_PATHS, ICONS, ICON_GRID, ICON_NAMES, Icon, KEYBOARD_SHORTCUTS, KeyboardShortcutsDialogContents, LANGUAGES, Popover, RTL_LANGUAGES, TldrawUiButton, TldrawUiButtonCheck, TldrawUiButtonIcon, TldrawUiButtonLabel, TldrawUiDialogBody, TldrawUiDialogCloseButton, TldrawUiDialogFooter, TldrawUiDialogHeader, TldrawUiDialogTitle, TldrawUiDialogsProvider, TldrawUiDropdownMenuCheckboxItem, TldrawUiDropdownMenuContent, TldrawUiDropdownMenuGroup, TldrawUiDropdownMenuIndicator, TldrawUiDropdownMenuItem, TldrawUiDropdownMenuRoot, TldrawUiDropdownMenuSub, TldrawUiDropdownMenuSubContent, TldrawUiDropdownMenuSubTrigger, TldrawUiDropdownMenuTrigger, TldrawUiEventsProvider, TldrawUiIcon, TldrawUiKbd, TldrawUiMenuActionCheckboxItem, TldrawUiMenuActionItem, TldrawUiMenuCheckboxItem, TldrawUiMenuContextProvider, TldrawUiMenuGroup, TldrawUiMenuItem, TldrawUiMenuSubmenu, TldrawUiMenuToolItem, TldrawUiTranslationProvider, ToolShortcuts, UiTooltip, actionKeyMap, buildShortcutIndex, debugStatsOpen, getDefaultTranslationLocale, getGeoIconBox, groupKeyboardShortcuts, isRtlLanguage, kbdToKeys, normalizeKbd, placeNear, toolKeyMap, useActionShortcuts, useActionState, useAnchoredPosition, useAvailableTranslationLocales, useBoundActionShortcuts, useBoundToolShortcuts, useCanApplySelectionAction, useCanRedo, useCanUndo, useCurrentTranslation, useDialogs, useDirection, useDismissable, useHasLockedShapes, useIsDarkMode, useIsGridMode, useKeyboardShortcuts, useMaybeCurrentTranslation, useMenuKeyboard, useMsg, useReadonly, useRelevantStyles, useTldrawUiMenuContext, useToolShortcuts, useTranslation, useUiEvents, useUnlockedSelectedShapesCount } from './chunk-YMUR46N6.js';
|
|
10
10
|
import { catmullRomToBezier, pathWordsToSvgD } from './chunk-OMUOD53T.js';
|
|
11
11
|
export { HEXAGON_FLAT_SIDE_SPAN, STAR_INNER_RATIO, arcToCubicSegments, catmullRomToBezier, fitPointsToBox, getCloudSegments, getGeoDecorations, getGeoGeometry, getGeoPolygonPoints, getHeartSegments, getStadiumSegments, hasGeoFlip, lineSegment, mirrorPointsInBox, mirrorSegmentsInBox, pathWordsToSvgD, pointOnCubic, transformPathWords } from './chunk-OMUOD53T.js';
|
|
12
|
-
import { registerExportImplementation, registerTextMeasureImplementation, registerEngineProvider, getLoadedEngine, DEFAULT_COLORS, track, useEditor, GeoShapeGeoStyle, DefaultColorStyle, DefaultLabelColorStyle, DefaultFillStyle, DefaultDashStyle, DefaultSizeStyle, DefaultFontStyle, DefaultHorizontalAlignStyle, DefaultVerticalAlignStyle, GEO_SHAPE_KINDS, useTools, useGlobalMenuIsOpen, useIsToolSelected, DefaultFontFaces, LIGHT_THEME, useValue, EditorPortal, LineShapeSplineStyle, ArrowShapeKindStyle, ArrowShapeArrowheadStartStyle, ArrowShapeArrowheadEndStyle, DefaultTextAlignStyle, atom
|
|
12
|
+
import { registerExportImplementation, registerTextMeasureImplementation, registerEngineProvider, getLoadedEngine, DEFAULT_COLORS, track, useEditor, GeoShapeGeoStyle, DefaultColorStyle, DefaultLabelColorStyle, DefaultFillStyle, DefaultDashStyle, DefaultSizeStyle, DefaultFontStyle, DefaultHorizontalAlignStyle, DefaultVerticalAlignStyle, GEO_SHAPE_KINDS, useTools, useGlobalMenuIsOpen, useIsToolSelected, DefaultFontFaces, LIGHT_THEME, useValue, EditorPortal, LineShapeSplineStyle, ArrowShapeKindStyle, ArrowShapeArrowheadStartStyle, ArrowShapeArrowheadEndStyle, DefaultTextAlignStyle, atom, ShapeIndicatorCompositor, OverlayUtil, getOverlayDisplayValues, getSelectionHandlePositions, Rectangle2d, stopEventPropagation, MocanvasUiProvider, useContainerIfExists, BindingUtil, Vec, DIM_3D, DIM_2D, b64Vecs, getDefaultDisplayValues, ShapeUtil, Polygon2d, Polyline2d, STROKE_SIZES, getColorValue, hexToRgba, getUncroppedSize, BaseBoxShapeUtil, CubicSpline2d, Box, createStore, Editor as Editor$1, StateNode, loadEngine, Canvas, AssetUrlsProvider, EditorProvider, ContainerProvider, createShapeId, AssetRecordType, Geometry2d, PATH_OP, Group2d, Mat, useEditorComponents, useMaybeEditor, dropShapesOnFrameLike, getFrameLikeDropTarget } from '@mocanvas/editor';
|
|
13
13
|
export * from '@mocanvas/editor';
|
|
14
|
-
import { useState, useRef, Fragment,
|
|
14
|
+
import { createContext, useState, useRef, Fragment, useEffect, useMemo, useId, useCallback, useLayoutEffect, useContext, Children } from 'react';
|
|
15
15
|
import { Editor } from '@tiptap/core';
|
|
16
16
|
import StarterKit from '@tiptap/starter-kit';
|
|
17
|
-
import './ui-4C5V5GYT.css';
|
|
18
17
|
import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
19
|
-
import { atom } from '@mocanvas/state';
|
|
20
18
|
import { sortByIndex, getIndexBetween, getIndexAbove } from '@mocanvas/store';
|
|
21
19
|
|
|
22
20
|
// src/text/rich-text-render.ts
|
|
@@ -395,10 +393,25 @@ function traceCross(ctx, x, y, arm) {
|
|
|
395
393
|
ctx.moveTo(x - arm, y + arm);
|
|
396
394
|
ctx.lineTo(x + arm, y - arm);
|
|
397
395
|
}
|
|
396
|
+
function truncateToWidth(ctx, text, maxWidth) {
|
|
397
|
+
if (maxWidth === void 0 || maxWidth <= 0) return text;
|
|
398
|
+
if (ctx.measureText(text).width <= maxWidth) return text;
|
|
399
|
+
const ellipsis = "\u2026";
|
|
400
|
+
if (ctx.measureText(ellipsis).width > maxWidth) return "";
|
|
401
|
+
let lo = 0;
|
|
402
|
+
let hi = text.length;
|
|
403
|
+
while (lo < hi) {
|
|
404
|
+
const mid = Math.ceil((lo + hi) / 2);
|
|
405
|
+
if (ctx.measureText(text.slice(0, mid) + ellipsis).width <= maxWidth) lo = mid;
|
|
406
|
+
else hi = mid - 1;
|
|
407
|
+
}
|
|
408
|
+
return text.slice(0, lo) + ellipsis;
|
|
409
|
+
}
|
|
398
410
|
function drawLabelChip(ctx, text, x, y, opts) {
|
|
399
411
|
ctx.font = opts.font;
|
|
400
412
|
ctx.textBaseline = "top";
|
|
401
413
|
ctx.textAlign = "left";
|
|
414
|
+
text = truncateToWidth(ctx, text, opts.maxWidth === void 0 ? void 0 : opts.maxWidth - opts.paddingX * 2);
|
|
402
415
|
const metrics = ctx.measureText(text);
|
|
403
416
|
const ascent = metrics.actualBoundingBoxAscent;
|
|
404
417
|
const descent = metrics.actualBoundingBoxDescent;
|
|
@@ -645,8 +658,14 @@ var ZoomBrushOverlayUtil = class extends BaseBrushOverlayUtil {
|
|
|
645
658
|
}
|
|
646
659
|
};
|
|
647
660
|
var DEFAULT_COLLABORATOR_OVERLAY_OPTIONS = {
|
|
648
|
-
idleOpacity: 0.5
|
|
661
|
+
idleOpacity: 0.5,
|
|
662
|
+
fontSize: 12,
|
|
663
|
+
nameMaxWidth: 120,
|
|
664
|
+
chatMaxWidth: 200
|
|
649
665
|
};
|
|
666
|
+
function chipFont(fontSize) {
|
|
667
|
+
return `${fontSize}px system-ui, -apple-system, "Segoe UI", sans-serif`;
|
|
668
|
+
}
|
|
650
669
|
var CollaboratorOverlayUtil = class extends OverlayUtil {
|
|
651
670
|
/** Everybody present and on this page. Never the local user. */
|
|
652
671
|
getPeople() {
|
|
@@ -688,11 +707,11 @@ var CollaboratorCursorOverlayUtil = class extends CollaboratorOverlayUtil {
|
|
|
688
707
|
}
|
|
689
708
|
return out;
|
|
690
709
|
}
|
|
691
|
-
render(ctx) {
|
|
692
|
-
const overlays = this.getOverlays();
|
|
710
|
+
render(ctx, given) {
|
|
711
|
+
const overlays = given ?? this.getOverlays();
|
|
693
712
|
if (overlays.length === 0) return;
|
|
694
713
|
const editor = this.editor;
|
|
695
|
-
const idleOpacity = this.options
|
|
714
|
+
const { idleOpacity, fontSize, nameMaxWidth, chatMaxWidth } = this.options;
|
|
696
715
|
isolate(ctx, (c) => {
|
|
697
716
|
for (const overlay of overlays) {
|
|
698
717
|
const at = editor.pageToViewport(overlay.point);
|
|
@@ -715,6 +734,7 @@ var CollaboratorCursorOverlayUtil = class extends CollaboratorOverlayUtil {
|
|
|
715
734
|
c.fill();
|
|
716
735
|
c.stroke();
|
|
717
736
|
c.restore();
|
|
737
|
+
const isChat = !!overlay.chatMessage;
|
|
718
738
|
const label = overlay.chatMessage || overlay.userName;
|
|
719
739
|
if (label) {
|
|
720
740
|
drawLabelChip(c, label, at.x + 12, at.y + 16, {
|
|
@@ -722,10 +742,13 @@ var CollaboratorCursorOverlayUtil = class extends CollaboratorOverlayUtil {
|
|
|
722
742
|
// White reads on all eight presence colours, which are chosen to be
|
|
723
743
|
// dark enough for exactly this.
|
|
724
744
|
color: "#ffffff",
|
|
725
|
-
font:
|
|
745
|
+
font: chipFont(fontSize),
|
|
726
746
|
paddingX: 6,
|
|
727
747
|
paddingY: 3,
|
|
728
|
-
radius: 4
|
|
748
|
+
radius: 4,
|
|
749
|
+
// Without a cap a long name drew a chip as wide as the name, which
|
|
750
|
+
// on a zoomed-out board covered the drawing it was labelling.
|
|
751
|
+
maxWidth: isChat ? chatMaxWidth : nameMaxWidth
|
|
729
752
|
});
|
|
730
753
|
}
|
|
731
754
|
}
|
|
@@ -1583,7 +1606,9 @@ var TOOLBAR_GROUPS = [
|
|
|
1583
1606
|
],
|
|
1584
1607
|
[
|
|
1585
1608
|
{ id: "draw", tool: "draw", icon: "draw", label: "Draw", shortcut: "D", kbd: "d,p,b" },
|
|
1586
|
-
{ id: "
|
|
1609
|
+
{ id: "highlight", tool: "highlight", icon: "highlight", label: "Highlight", shortcut: "I", kbd: "i" },
|
|
1610
|
+
{ id: "eraser", tool: "eraser", icon: "eraser", label: "Eraser", shortcut: "E", kbd: "e" },
|
|
1611
|
+
{ id: "laser", tool: "laser", icon: "laser", label: "Laser", shortcut: "K", kbd: "k", readonlyOk: true }
|
|
1587
1612
|
],
|
|
1588
1613
|
[
|
|
1589
1614
|
{ id: "rectangle", tool: "geo", icon: "geo-rectangle", label: "Rectangle", shortcut: "R", kbd: "r", geo: "rectangle" },
|
|
@@ -1711,228 +1736,107 @@ function buildDefaultActionItems(editor) {
|
|
|
1711
1736
|
for (const entry of items) actions[entry.id] = entry;
|
|
1712
1737
|
return actions;
|
|
1713
1738
|
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1739
|
+
var A11yContext = createContext(null);
|
|
1740
|
+
var NOOP = { announce: () => {
|
|
1741
|
+
}, currentMsg: null };
|
|
1742
|
+
function TldrawUiA11yProvider({ children }) {
|
|
1743
|
+
const [currentMsg, setCurrentMsg] = useState(null);
|
|
1744
|
+
const seq = useRef(0);
|
|
1745
|
+
const announce = useCallback((value2) => {
|
|
1746
|
+
seq.current += 1;
|
|
1747
|
+
setCurrentMsg({ ...value2, msg: seq.current % 2 === 0 ? `${value2.msg}\u200B` : value2.msg });
|
|
1748
|
+
}, []);
|
|
1749
|
+
const value = useMemo(() => ({ announce, currentMsg }), [announce, currentMsg]);
|
|
1750
|
+
return /* @__PURE__ */ jsx(A11yContext.Provider, { value, children });
|
|
1716
1751
|
}
|
|
1717
|
-
function
|
|
1718
|
-
|
|
1719
|
-
for (const tool of Object.values(tools)) {
|
|
1720
|
-
if (tool.disabled) continue;
|
|
1721
|
-
if (isReadonly && !tool.readonlyOk) continue;
|
|
1722
|
-
if (!tool.kbd) continue;
|
|
1723
|
-
for (const raw of tool.kbd.split(",")) {
|
|
1724
|
-
const key = raw.trim().toLowerCase();
|
|
1725
|
-
if (key === "" || key.includes("+")) continue;
|
|
1726
|
-
if (!map.has(key)) map.set(key, tool.id);
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
return map;
|
|
1752
|
+
function useA11y() {
|
|
1753
|
+
return useContext(A11yContext) ?? NOOP;
|
|
1730
1754
|
}
|
|
1731
|
-
function
|
|
1755
|
+
function DefaultA11yAnnouncer() {
|
|
1756
|
+
const { currentMsg } = useA11y();
|
|
1757
|
+
const priority = currentMsg?.priority ?? "polite";
|
|
1758
|
+
const hidden = {
|
|
1759
|
+
position: "absolute",
|
|
1760
|
+
width: 1,
|
|
1761
|
+
height: 1,
|
|
1762
|
+
margin: -1,
|
|
1763
|
+
padding: 0,
|
|
1764
|
+
overflow: "hidden",
|
|
1765
|
+
clip: "rect(0 0 0 0)",
|
|
1766
|
+
whiteSpace: "nowrap",
|
|
1767
|
+
border: 0
|
|
1768
|
+
};
|
|
1769
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1770
|
+
/* @__PURE__ */ jsx("div", { className: "mocanvas-a11y-announcer", role: "status", "aria-live": "polite", "aria-atomic": "true", style: hidden, children: priority === "polite" ? currentMsg?.msg : "" }),
|
|
1771
|
+
/* @__PURE__ */ jsx("div", { className: "mocanvas-a11y-announcer", role: "alert", "aria-live": "assertive", "aria-atomic": "true", style: hidden, children: priority === "assertive" ? currentMsg?.msg : "" })
|
|
1772
|
+
] });
|
|
1773
|
+
}
|
|
1774
|
+
function describeShape(shape) {
|
|
1775
|
+
if (shape.type !== "geo") return shape.type;
|
|
1776
|
+
const geo = shape.props?.["geo"];
|
|
1777
|
+
return typeof geo === "string" && geo !== "" ? geo : shape.type;
|
|
1778
|
+
}
|
|
1779
|
+
function useSelectedShapesAnnouncer() {
|
|
1732
1780
|
const editor = useEditor();
|
|
1733
|
-
const
|
|
1734
|
-
const
|
|
1735
|
-
|
|
1781
|
+
const { announce } = useA11y();
|
|
1782
|
+
const summary = useValue(
|
|
1783
|
+
"selection summary",
|
|
1784
|
+
() => {
|
|
1785
|
+
const shapes = editor.getSelectedShapes();
|
|
1786
|
+
if (shapes.length === 0) return "";
|
|
1787
|
+
const enhanced = editor.user.getIsEnhancedA11yMode();
|
|
1788
|
+
if (shapes.length === 1) {
|
|
1789
|
+
const shape = shapes[0];
|
|
1790
|
+
const name = describeShape(shape);
|
|
1791
|
+
if (!enhanced) return `${name} selected`;
|
|
1792
|
+
const bounds2 = editor.getShapePageBounds(shape);
|
|
1793
|
+
if (!bounds2) return `${name} selected`;
|
|
1794
|
+
return `${name} selected, at ${Math.round(bounds2.x)}, ${Math.round(bounds2.y)}, ${Math.round(bounds2.w)} by ${Math.round(bounds2.h)}`;
|
|
1795
|
+
}
|
|
1796
|
+
if (!enhanced) return `${shapes.length} shapes selected`;
|
|
1797
|
+
const bounds = editor.getSelectionPageBounds();
|
|
1798
|
+
if (!bounds) return `${shapes.length} shapes selected`;
|
|
1799
|
+
return `${shapes.length} shapes selected, ${Math.round(bounds.w)} by ${Math.round(bounds.h)}`;
|
|
1800
|
+
},
|
|
1801
|
+
[editor]
|
|
1802
|
+
);
|
|
1736
1803
|
useEffect(() => {
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
if (isEditable(e.target)) return;
|
|
1740
|
-
if (editor.getEditingShapeId()) return;
|
|
1741
|
-
const map = toolKeyMap(toolsRef.current, editor.getInstanceState().isReadonly);
|
|
1742
|
-
const id = map.get(e.key.toLowerCase());
|
|
1743
|
-
if (id === void 0) return;
|
|
1744
|
-
const tool = toolsRef.current[id];
|
|
1745
|
-
if (!tool) return;
|
|
1746
|
-
e.preventDefault();
|
|
1747
|
-
tool.onSelect("kbd");
|
|
1748
|
-
};
|
|
1749
|
-
window.addEventListener("keydown", onKeyDown);
|
|
1750
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1751
|
-
}, [editor]);
|
|
1804
|
+
if (summary) announce({ msg: summary, priority: "polite" });
|
|
1805
|
+
}, [summary]);
|
|
1752
1806
|
}
|
|
1753
|
-
function
|
|
1754
|
-
|
|
1807
|
+
function SelectionAnnouncer() {
|
|
1808
|
+
useSelectedShapesAnnouncer();
|
|
1755
1809
|
return null;
|
|
1756
1810
|
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1811
|
+
function usePrefersReducedMotion() {
|
|
1812
|
+
const [os, setOs] = useState(false);
|
|
1813
|
+
useEffect(() => {
|
|
1814
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
1815
|
+
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
1816
|
+
const update = () => setOs(mq.matches);
|
|
1817
|
+
update();
|
|
1818
|
+
mq.addEventListener("change", update);
|
|
1819
|
+
return () => mq.removeEventListener("change", update);
|
|
1820
|
+
}, []);
|
|
1821
|
+
return os;
|
|
1760
1822
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
const
|
|
1823
|
+
function useReduceMotion() {
|
|
1824
|
+
const editor = useEditor();
|
|
1825
|
+
const os = usePrefersReducedMotion();
|
|
1826
|
+
const preference = useValue("animationSpeed", () => editor.user.getUserPreferences().animationSpeed, [editor]);
|
|
1827
|
+
return preference === void 0 ? os : preference === 0;
|
|
1828
|
+
}
|
|
1829
|
+
function ReduceMotionAttribute() {
|
|
1830
|
+
const editor = useEditor();
|
|
1831
|
+
const reduced = useReduceMotion();
|
|
1764
1832
|
useEffect(() => {
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
if (accel) {
|
|
1773
|
-
switch (key) {
|
|
1774
|
-
case "z":
|
|
1775
|
-
e.preventDefault();
|
|
1776
|
-
if (e.shiftKey) editor.redo();
|
|
1777
|
-
else editor.undo();
|
|
1778
|
-
return;
|
|
1779
|
-
case "y":
|
|
1780
|
-
e.preventDefault();
|
|
1781
|
-
editor.redo();
|
|
1782
|
-
return;
|
|
1783
|
-
case "a":
|
|
1784
|
-
e.preventDefault();
|
|
1785
|
-
editor.selectAll();
|
|
1786
|
-
return;
|
|
1787
|
-
case "g": {
|
|
1788
|
-
e.preventDefault();
|
|
1789
|
-
const ids = editor.getSelectedShapeIds();
|
|
1790
|
-
if (!ids.length) return;
|
|
1791
|
-
editor.markHistoryStoppingPoint(e.shiftKey ? "ungroup" : "group");
|
|
1792
|
-
if (e.shiftKey) editor.ungroupShapes(ids);
|
|
1793
|
-
else editor.groupShapes(ids);
|
|
1794
|
-
return;
|
|
1795
|
-
}
|
|
1796
|
-
case "l": {
|
|
1797
|
-
e.preventDefault();
|
|
1798
|
-
if (e.shiftKey) {
|
|
1799
|
-
editor.markHistoryStoppingPoint("lock");
|
|
1800
|
-
editor.toggleLock();
|
|
1801
|
-
}
|
|
1802
|
-
return;
|
|
1803
|
-
}
|
|
1804
|
-
case "d": {
|
|
1805
|
-
e.preventDefault();
|
|
1806
|
-
const ids = editor.getSelectedShapeIds();
|
|
1807
|
-
if (ids.length) {
|
|
1808
|
-
editor.markHistoryStoppingPoint("duplicate");
|
|
1809
|
-
const copies = editor.duplicateShapes(ids);
|
|
1810
|
-
editor.setSelectedShapes(copies);
|
|
1811
|
-
}
|
|
1812
|
-
return;
|
|
1813
|
-
}
|
|
1814
|
-
case "c":
|
|
1815
|
-
case "x": {
|
|
1816
|
-
const ids = editor.getSelectedShapeIds();
|
|
1817
|
-
if (!ids.length) return;
|
|
1818
|
-
e.preventDefault();
|
|
1819
|
-
const content = editor.getContentFromCurrentPage(ids);
|
|
1820
|
-
if (content) {
|
|
1821
|
-
const text = JSON.stringify({ type: "application/mocanvas", ...content });
|
|
1822
|
-
navigator.clipboard?.writeText(text).catch(() => {
|
|
1823
|
-
});
|
|
1824
|
-
clipboardFallback = text;
|
|
1825
|
-
}
|
|
1826
|
-
if (key === "x") {
|
|
1827
|
-
editor.markHistoryStoppingPoint("cut");
|
|
1828
|
-
editor.deleteShapes(ids);
|
|
1829
|
-
}
|
|
1830
|
-
return;
|
|
1831
|
-
}
|
|
1832
|
-
case "v": {
|
|
1833
|
-
e.preventDefault();
|
|
1834
|
-
const paste = (text) => {
|
|
1835
|
-
try {
|
|
1836
|
-
const data = JSON.parse(text);
|
|
1837
|
-
if (data.type !== "application/mocanvas" || !Array.isArray(data.shapes)) return;
|
|
1838
|
-
editor.markHistoryStoppingPoint("paste");
|
|
1839
|
-
editor.putContentOntoCurrentPage(data, { point: editor.getViewportPageCenter() });
|
|
1840
|
-
} catch {
|
|
1841
|
-
}
|
|
1842
|
-
};
|
|
1843
|
-
if (navigator.clipboard?.readText) navigator.clipboard.readText().then(paste, () => clipboardFallback && paste(clipboardFallback));
|
|
1844
|
-
else if (clipboardFallback) paste(clipboardFallback);
|
|
1845
|
-
return;
|
|
1846
|
-
}
|
|
1847
|
-
case "=":
|
|
1848
|
-
case "+":
|
|
1849
|
-
e.preventDefault();
|
|
1850
|
-
editor.zoomIn();
|
|
1851
|
-
return;
|
|
1852
|
-
case "-":
|
|
1853
|
-
e.preventDefault();
|
|
1854
|
-
editor.zoomOut();
|
|
1855
|
-
return;
|
|
1856
|
-
case "0":
|
|
1857
|
-
e.preventDefault();
|
|
1858
|
-
editor.resetZoom();
|
|
1859
|
-
return;
|
|
1860
|
-
case "1":
|
|
1861
|
-
e.preventDefault();
|
|
1862
|
-
editor.zoomToFit();
|
|
1863
|
-
return;
|
|
1864
|
-
case "2":
|
|
1865
|
-
e.preventDefault();
|
|
1866
|
-
editor.zoomToSelection();
|
|
1867
|
-
return;
|
|
1868
|
-
case "]":
|
|
1869
|
-
e.preventDefault();
|
|
1870
|
-
if (e.altKey) editor.bringToFront();
|
|
1871
|
-
else editor.bringForward();
|
|
1872
|
-
return;
|
|
1873
|
-
case "[":
|
|
1874
|
-
e.preventDefault();
|
|
1875
|
-
if (e.altKey) editor.sendToBack();
|
|
1876
|
-
else editor.sendBackward();
|
|
1877
|
-
return;
|
|
1878
|
-
default:
|
|
1879
|
-
return;
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
if (e.altKey) {
|
|
1883
|
-
if (e.code === "KeyD" || key === "d" || key === "\u2202") {
|
|
1884
|
-
e.preventDefault();
|
|
1885
|
-
debugStatsOpen.set(!debugStatsOpen.get());
|
|
1886
|
-
}
|
|
1887
|
-
return;
|
|
1888
|
-
}
|
|
1889
|
-
if (key === "q") {
|
|
1890
|
-
editor.updateInstanceState({ isToolLocked: !editor.getInstanceState().isToolLocked });
|
|
1891
|
-
return;
|
|
1892
|
-
}
|
|
1893
|
-
if (!bindTools) return;
|
|
1894
|
-
switch (key) {
|
|
1895
|
-
case "v":
|
|
1896
|
-
editor.setCurrentTool("select");
|
|
1897
|
-
break;
|
|
1898
|
-
case "h":
|
|
1899
|
-
editor.setCurrentTool("hand");
|
|
1900
|
-
break;
|
|
1901
|
-
case "r":
|
|
1902
|
-
editor.setCurrentTool("geo", { geo: "rectangle" });
|
|
1903
|
-
break;
|
|
1904
|
-
case "o":
|
|
1905
|
-
editor.setCurrentTool("geo", { geo: "ellipse" });
|
|
1906
|
-
break;
|
|
1907
|
-
case "d":
|
|
1908
|
-
case "p":
|
|
1909
|
-
case "b":
|
|
1910
|
-
editor.setCurrentTool("draw");
|
|
1911
|
-
break;
|
|
1912
|
-
case "e":
|
|
1913
|
-
editor.setCurrentTool("eraser");
|
|
1914
|
-
break;
|
|
1915
|
-
case "n":
|
|
1916
|
-
editor.setCurrentTool("note");
|
|
1917
|
-
break;
|
|
1918
|
-
case "t":
|
|
1919
|
-
editor.setCurrentTool("text");
|
|
1920
|
-
break;
|
|
1921
|
-
// arrow/line/frame are optional tools: apps may register a smaller set.
|
|
1922
|
-
case "a":
|
|
1923
|
-
if (editor.root.children?.["arrow"]) editor.setCurrentTool("arrow");
|
|
1924
|
-
break;
|
|
1925
|
-
case "l":
|
|
1926
|
-
if (editor.root.children?.["line"]) editor.setCurrentTool("line");
|
|
1927
|
-
break;
|
|
1928
|
-
case "f":
|
|
1929
|
-
if (editor.root.children?.["frame"]) editor.setCurrentTool("frame");
|
|
1930
|
-
break;
|
|
1931
|
-
}
|
|
1932
|
-
};
|
|
1933
|
-
window.addEventListener("keydown", onKeyDown);
|
|
1934
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1935
|
-
}, [editor, bindTools]);
|
|
1833
|
+
const container = editor.getContainer();
|
|
1834
|
+
if (!container) return;
|
|
1835
|
+
if (reduced) container.setAttribute("data-reduce-motion", "true");
|
|
1836
|
+
else container.removeAttribute("data-reduce-motion");
|
|
1837
|
+
return () => container.removeAttribute("data-reduce-motion");
|
|
1838
|
+
}, [editor, reduced]);
|
|
1839
|
+
return null;
|
|
1936
1840
|
}
|
|
1937
1841
|
var IS_MAC = typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent || "");
|
|
1938
1842
|
var MOD_KEY = IS_MAC ? "\u2318" : "Ctrl+";
|
|
@@ -2122,7 +2026,9 @@ function Chrome({ showStats, hidePanels }) {
|
|
|
2122
2026
|
c.Dialogs ? /* @__PURE__ */ jsx(c.Dialogs, {}) : null,
|
|
2123
2027
|
c.A11y ? /* @__PURE__ */ jsx(c.A11y, {}) : null,
|
|
2124
2028
|
c.Tooltip ? /* @__PURE__ */ jsx(c.Tooltip, {}) : null,
|
|
2125
|
-
/* @__PURE__ */ jsx(ToolShortcuts, {})
|
|
2029
|
+
/* @__PURE__ */ jsx(ToolShortcuts, {}),
|
|
2030
|
+
/* @__PURE__ */ jsx(ActionShortcuts, {}),
|
|
2031
|
+
/* @__PURE__ */ jsx(SelectionAnnouncer, {})
|
|
2126
2032
|
] });
|
|
2127
2033
|
}
|
|
2128
2034
|
function DefaultUi({ editor, components, overrides, showStats = true, canvas, hidePanels = false, children }) {
|
|
@@ -2194,70 +2100,6 @@ function useTldrawUiOrientation() {
|
|
|
2194
2100
|
const rtl = value.dir === "rtl";
|
|
2195
2101
|
return { ...value, prevKey: rtl ? "ArrowRight" : "ArrowLeft", nextKey: rtl ? "ArrowLeft" : "ArrowRight" };
|
|
2196
2102
|
}
|
|
2197
|
-
var A11yContext = createContext(null);
|
|
2198
|
-
var NOOP = { announce: () => {
|
|
2199
|
-
}, currentMsg: null };
|
|
2200
|
-
function TldrawUiA11yProvider({ children }) {
|
|
2201
|
-
const [currentMsg, setCurrentMsg] = useState(null);
|
|
2202
|
-
const seq = useRef(0);
|
|
2203
|
-
const announce = useCallback((value2) => {
|
|
2204
|
-
seq.current += 1;
|
|
2205
|
-
setCurrentMsg({ ...value2, msg: seq.current % 2 === 0 ? `${value2.msg}\u200B` : value2.msg });
|
|
2206
|
-
}, []);
|
|
2207
|
-
const value = useMemo(() => ({ announce, currentMsg }), [announce, currentMsg]);
|
|
2208
|
-
return /* @__PURE__ */ jsx(A11yContext.Provider, { value, children });
|
|
2209
|
-
}
|
|
2210
|
-
function useA11y() {
|
|
2211
|
-
return useContext(A11yContext) ?? NOOP;
|
|
2212
|
-
}
|
|
2213
|
-
function DefaultA11yAnnouncer() {
|
|
2214
|
-
const { currentMsg } = useA11y();
|
|
2215
|
-
const priority = currentMsg?.priority ?? "polite";
|
|
2216
|
-
const hidden = {
|
|
2217
|
-
position: "absolute",
|
|
2218
|
-
width: 1,
|
|
2219
|
-
height: 1,
|
|
2220
|
-
margin: -1,
|
|
2221
|
-
padding: 0,
|
|
2222
|
-
overflow: "hidden",
|
|
2223
|
-
clip: "rect(0 0 0 0)",
|
|
2224
|
-
whiteSpace: "nowrap",
|
|
2225
|
-
border: 0
|
|
2226
|
-
};
|
|
2227
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2228
|
-
/* @__PURE__ */ jsx("div", { className: "mocanvas-a11y-announcer", role: "status", "aria-live": "polite", "aria-atomic": "true", style: hidden, children: priority === "polite" ? currentMsg?.msg : "" }),
|
|
2229
|
-
/* @__PURE__ */ jsx("div", { className: "mocanvas-a11y-announcer", role: "alert", "aria-live": "assertive", "aria-atomic": "true", style: hidden, children: priority === "assertive" ? currentMsg?.msg : "" })
|
|
2230
|
-
] });
|
|
2231
|
-
}
|
|
2232
|
-
function useSelectedShapesAnnouncer() {
|
|
2233
|
-
const editor = useEditor();
|
|
2234
|
-
const { announce } = useA11y();
|
|
2235
|
-
const summary = useValue(
|
|
2236
|
-
"selection summary",
|
|
2237
|
-
() => {
|
|
2238
|
-
const shapes = editor.getSelectedShapes();
|
|
2239
|
-
if (shapes.length === 0) return "";
|
|
2240
|
-
if (shapes.length === 1) return `${shapes[0].type} selected`;
|
|
2241
|
-
return `${shapes.length} shapes selected`;
|
|
2242
|
-
},
|
|
2243
|
-
[editor]
|
|
2244
|
-
);
|
|
2245
|
-
useEffect(() => {
|
|
2246
|
-
if (summary) announce({ msg: summary, priority: "polite" });
|
|
2247
|
-
}, [summary]);
|
|
2248
|
-
}
|
|
2249
|
-
function usePrefersReducedMotion() {
|
|
2250
|
-
const [os, setOs] = useState(false);
|
|
2251
|
-
useEffect(() => {
|
|
2252
|
-
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
2253
|
-
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2254
|
-
const update = () => setOs(mq.matches);
|
|
2255
|
-
update();
|
|
2256
|
-
mq.addEventListener("change", update);
|
|
2257
|
-
return () => mq.removeEventListener("change", update);
|
|
2258
|
-
}, []);
|
|
2259
|
-
return os;
|
|
2260
|
-
}
|
|
2261
2103
|
var ToastsContext = createContext(null);
|
|
2262
2104
|
var NOOP2 = { addToast: () => "", removeToast: () => {
|
|
2263
2105
|
}, clearToasts: () => {
|
|
@@ -2347,9 +2189,23 @@ function useTooltipSuppression() {
|
|
|
2347
2189
|
[ctx]
|
|
2348
2190
|
);
|
|
2349
2191
|
}
|
|
2192
|
+
function UiListsProvider({ overrides, children }) {
|
|
2193
|
+
const editor = useMaybeEditor();
|
|
2194
|
+
if (!editor) return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
2195
|
+
return /* @__PURE__ */ jsx(
|
|
2196
|
+
MocanvasUiProvider,
|
|
2197
|
+
{
|
|
2198
|
+
editor,
|
|
2199
|
+
defaultTools: buildDefaultToolItems,
|
|
2200
|
+
defaultActions: buildDefaultActionItems,
|
|
2201
|
+
...overrides ? { overrides } : {},
|
|
2202
|
+
children
|
|
2203
|
+
}
|
|
2204
|
+
);
|
|
2205
|
+
}
|
|
2350
2206
|
function TldrawUiContextProvider({ onUiEvent, components, overrides, forceMobile, children }) {
|
|
2351
2207
|
const translations = overrides?.translations;
|
|
2352
|
-
return /* @__PURE__ */ jsx(TldrawUiEventsProvider, { ...onUiEvent ? { onEvent: onUiEvent } : {}, children: /* @__PURE__ */ jsx(TldrawUiTranslationProvider, { ...translations ? { overrides: translations } : {}, children: /* @__PURE__ */ jsx(BreakPointProvider, { ...forceMobile ? { forceMobile } : {}, children: /* @__PURE__ */ jsx(TldrawUiA11yProvider, { children: /* @__PURE__ */ jsx(TldrawUiToastsProvider, { children: /* @__PURE__ */ jsx(TldrawUiDialogsProvider, { children: /* @__PURE__ */ jsx(TldrawUiComponentsProvider, { ...components ? { overrides: components } : {}, children: /* @__PURE__ */ jsx(TldrawUiTooltipProvider, { children }) }) }) }) }) }) }) });
|
|
2208
|
+
return /* @__PURE__ */ jsx(TldrawUiEventsProvider, { ...onUiEvent ? { onEvent: onUiEvent } : {}, children: /* @__PURE__ */ jsx(TldrawUiTranslationProvider, { ...translations ? { overrides: translations } : {}, children: /* @__PURE__ */ jsx(BreakPointProvider, { ...forceMobile ? { forceMobile } : {}, children: /* @__PURE__ */ jsx(TldrawUiA11yProvider, { children: /* @__PURE__ */ jsx(TldrawUiToastsProvider, { children: /* @__PURE__ */ jsx(TldrawUiDialogsProvider, { children: /* @__PURE__ */ jsx(TldrawUiComponentsProvider, { ...components ? { overrides: components } : {}, children: /* @__PURE__ */ jsx(UiListsProvider, { ...overrides ? { overrides } : {}, children: /* @__PURE__ */ jsx(TldrawUiTooltipProvider, { children }) }) }) }) }) }) }) }) });
|
|
2353
2209
|
}
|
|
2354
2210
|
function useDefaultHelpers() {
|
|
2355
2211
|
const editor = useEditor();
|
|
@@ -2580,7 +2436,7 @@ function TldrawUiPopover({ id, open: controlled, onOpenChange, side = "below", c
|
|
|
2580
2436
|
);
|
|
2581
2437
|
return /* @__PURE__ */ jsx(PopoverContext.Provider, { value, children });
|
|
2582
2438
|
}
|
|
2583
|
-
function TldrawUiPopoverTrigger({ className, children }) {
|
|
2439
|
+
function TldrawUiPopoverTrigger({ label, className, children }) {
|
|
2584
2440
|
const { id, open, setOpen, anchorRef } = usePopoverContext("TldrawUiPopoverTrigger");
|
|
2585
2441
|
return /* @__PURE__ */ jsx(
|
|
2586
2442
|
"button",
|
|
@@ -2590,6 +2446,7 @@ function TldrawUiPopoverTrigger({ className, children }) {
|
|
|
2590
2446
|
},
|
|
2591
2447
|
type: "button",
|
|
2592
2448
|
className: ["mocanvas-btn", className].filter(Boolean).join(" "),
|
|
2449
|
+
...label ? { "aria-label": label, "data-tooltip": label } : {},
|
|
2593
2450
|
"aria-haspopup": "dialog",
|
|
2594
2451
|
"aria-expanded": open,
|
|
2595
2452
|
"aria-controls": `${id}-content`,
|
|
@@ -2745,6 +2602,7 @@ function TldrawUiToolbar({ label, orientation = "horizontal", className, style,
|
|
|
2745
2602
|
}
|
|
2746
2603
|
function TldrawUiToolbarButton({ type = "icon", isActive, disabled, title, className, ref, onClick, children, ...rest }) {
|
|
2747
2604
|
const label = rest["aria-label"] ?? title;
|
|
2605
|
+
const tool = rest["data-tool"];
|
|
2748
2606
|
return /* @__PURE__ */ jsx(
|
|
2749
2607
|
"button",
|
|
2750
2608
|
{
|
|
@@ -2752,6 +2610,7 @@ function TldrawUiToolbarButton({ type = "icon", isActive, disabled, title, class
|
|
|
2752
2610
|
type: "button",
|
|
2753
2611
|
className: ["mocanvas-btn", `mocanvas-btn--${type}`, className].filter(Boolean).join(" "),
|
|
2754
2612
|
disabled,
|
|
2613
|
+
...tool ? { "data-tool": tool } : {},
|
|
2755
2614
|
...label ? { "aria-label": label, "data-tooltip": title ?? label } : {},
|
|
2756
2615
|
...isActive === void 0 ? {} : { "aria-pressed": isActive },
|
|
2757
2616
|
onClick,
|
|
@@ -2875,8 +2734,44 @@ async function exportAs(editor, format = "png", ids = editor.getSelectedShapeIds
|
|
|
2875
2734
|
const page = editor.getCurrentPage();
|
|
2876
2735
|
downloadBlob(blob, `${name ?? page?.name ?? "drawing"}.${format}`);
|
|
2877
2736
|
}
|
|
2878
|
-
function
|
|
2879
|
-
editor.
|
|
2737
|
+
function canPrint(editor) {
|
|
2738
|
+
return editor.getCurrentPageShapeIds().size > 0;
|
|
2739
|
+
}
|
|
2740
|
+
function printSelection(editor, ids) {
|
|
2741
|
+
const doc = editor.getContainerDocument();
|
|
2742
|
+
if (!doc?.body) return false;
|
|
2743
|
+
const rendered = getSvgString(editor, ids, {
|
|
2744
|
+
background: editor.getInstanceState().exportBackground,
|
|
2745
|
+
darkMode: false
|
|
2746
|
+
});
|
|
2747
|
+
if (!rendered) return false;
|
|
2748
|
+
const title = editor.getCurrentPage()?.name ?? "Drawing";
|
|
2749
|
+
const frame = doc.createElement("iframe");
|
|
2750
|
+
frame.setAttribute("aria-hidden", "true");
|
|
2751
|
+
frame.setAttribute("title", `Print ${title}`);
|
|
2752
|
+
frame.style.cssText = "position:fixed;left:-10000px;top:0;width:1px;height:1px;border:0;opacity:0";
|
|
2753
|
+
const cleanUp = () => frame.remove();
|
|
2754
|
+
frame.addEventListener("load", () => {
|
|
2755
|
+
const view = frame.contentWindow;
|
|
2756
|
+
if (!view) {
|
|
2757
|
+
cleanUp();
|
|
2758
|
+
return;
|
|
2759
|
+
}
|
|
2760
|
+
view.addEventListener("afterprint", cleanUp, { once: true });
|
|
2761
|
+
view.setTimeout(cleanUp, 6e4);
|
|
2762
|
+
view.focus();
|
|
2763
|
+
view.print();
|
|
2764
|
+
});
|
|
2765
|
+
frame.srcdoc = `<!doctype html><html><head><meta charset="utf-8"><title>${escapeHtml2(title)}</title><style>
|
|
2766
|
+
html,body{margin:0;padding:0;background:#fff}
|
|
2767
|
+
svg{display:block;width:100%;height:auto;max-width:100%}
|
|
2768
|
+
@page{margin:12mm}
|
|
2769
|
+
</style></head><body>${rendered.svg}</body></html>`;
|
|
2770
|
+
doc.body.appendChild(frame);
|
|
2771
|
+
return true;
|
|
2772
|
+
}
|
|
2773
|
+
function escapeHtml2(value) {
|
|
2774
|
+
return value.replace(/[&<>"]/g, (c) => c === "&" ? "&" : c === "<" ? "<" : c === ">" ? ">" : """);
|
|
2880
2775
|
}
|
|
2881
2776
|
function CutMenuItem() {
|
|
2882
2777
|
const editor = useEditor();
|
|
@@ -2924,11 +2819,10 @@ function ExportFileContentSubMenu() {
|
|
|
2924
2819
|
{
|
|
2925
2820
|
id: "save-file-copy",
|
|
2926
2821
|
label: "Save a copy",
|
|
2927
|
-
kbd: "mod+s",
|
|
2928
2822
|
onSelect: () => {
|
|
2929
2823
|
void import('./file-GEHTVI2G.js').then(({ serializeMocanvasFile: serializeMocanvasFile2 }) => {
|
|
2930
2824
|
const blob = new Blob([serializeMocanvasFile2(editor)], { type: "application/json" });
|
|
2931
|
-
void import('./export-
|
|
2825
|
+
void import('./export-UA6X35ZW.js').then(({ downloadBlob: downloadBlob2 }) => downloadBlob2(blob, `${editor.getCurrentPage()?.name ?? "drawing"}.mocanvas`));
|
|
2932
2826
|
});
|
|
2933
2827
|
}
|
|
2934
2828
|
}
|
|
@@ -2936,10 +2830,11 @@ function ExportFileContentSubMenu() {
|
|
|
2936
2830
|
/* @__PURE__ */ jsx(PrintItem, {})
|
|
2937
2831
|
] }) });
|
|
2938
2832
|
}
|
|
2939
|
-
|
|
2833
|
+
var PrintItem = track(function PrintItem2() {
|
|
2940
2834
|
const editor = useEditor();
|
|
2941
|
-
|
|
2942
|
-
}
|
|
2835
|
+
const enabled = canPrint(editor);
|
|
2836
|
+
return /* @__PURE__ */ jsx(TldrawUiMenuItem, { id: "print", label: "Print", disabled: !enabled, onSelect: () => void printSelection(editor) });
|
|
2837
|
+
});
|
|
2943
2838
|
function ConversionsMenuGroup() {
|
|
2944
2839
|
return /* @__PURE__ */ jsxs(TldrawUiMenuGroup, { id: "conversions", children: [
|
|
2945
2840
|
/* @__PURE__ */ jsx(CopyAsMenuGroup, {}),
|
|
@@ -3052,7 +2947,7 @@ var ConvertToEmbedMenuItem = track(function ConvertToEmbedMenuItem2() {
|
|
|
3052
2947
|
const url = shape.props.url;
|
|
3053
2948
|
if (!url) return;
|
|
3054
2949
|
editor.markHistoryStoppingPoint("convert to embed");
|
|
3055
|
-
void import('./urlContent-
|
|
2950
|
+
void import('./urlContent-WYYVQYYN.js').then(({ createEmbedShape: createEmbedShape2 }) => {
|
|
3056
2951
|
editor.deleteShapes([shape.id]);
|
|
3057
2952
|
createEmbedShape2(editor, url, { x: shape.x, y: shape.y });
|
|
3058
2953
|
});
|
|
@@ -3073,7 +2968,7 @@ var ConvertToBookmarkMenuItem = track(function ConvertToBookmarkMenuItem2() {
|
|
|
3073
2968
|
const url = shape.props.url;
|
|
3074
2969
|
if (!url) return;
|
|
3075
2970
|
editor.markHistoryStoppingPoint("convert to bookmark");
|
|
3076
|
-
void import('./urlContent-
|
|
2971
|
+
void import('./urlContent-WYYVQYYN.js').then(({ createBookmarkShape: createBookmarkShape2 }) => {
|
|
3077
2972
|
editor.deleteShapes([shape.id]);
|
|
3078
2973
|
createBookmarkShape2(editor, url, void 0, { x: shape.x, y: shape.y });
|
|
3079
2974
|
});
|
|
@@ -3201,15 +3096,14 @@ function ToggleTransparentBgMenuItem() {
|
|
|
3201
3096
|
}
|
|
3202
3097
|
function ToggleReduceMotionItem() {
|
|
3203
3098
|
const editor = useEditor();
|
|
3204
|
-
const
|
|
3205
|
-
const off = useValue("reduceMotion", () => editor.user.getAnimationSpeed() === 0, [editor]);
|
|
3099
|
+
const reduced = useReduceMotion();
|
|
3206
3100
|
return /* @__PURE__ */ jsx(
|
|
3207
3101
|
TldrawUiMenuCheckboxItem,
|
|
3208
3102
|
{
|
|
3209
3103
|
id: "toggle-reduce-motion",
|
|
3210
3104
|
label: "Reduce motion",
|
|
3211
|
-
checked:
|
|
3212
|
-
onSelect: () => editor.user.updateUserPreferences({ animationSpeed:
|
|
3105
|
+
checked: reduced,
|
|
3106
|
+
onSelect: () => editor.user.updateUserPreferences({ animationSpeed: reduced ? 1 : 0 })
|
|
3213
3107
|
}
|
|
3214
3108
|
);
|
|
3215
3109
|
}
|
|
@@ -3227,21 +3121,19 @@ var ToggleInvertZoomItem = track(function ToggleInvertZoomItem2() {
|
|
|
3227
3121
|
}
|
|
3228
3122
|
);
|
|
3229
3123
|
});
|
|
3230
|
-
var
|
|
3231
|
-
|
|
3232
|
-
const
|
|
3233
|
-
return
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3124
|
+
var ToggleEnhancedA11yModeItem = track(function ToggleEnhancedA11yModeItem2() {
|
|
3125
|
+
const editor = useEditor();
|
|
3126
|
+
const enabled = editor.user.getIsEnhancedA11yMode();
|
|
3127
|
+
return /* @__PURE__ */ jsx(
|
|
3128
|
+
TldrawUiMenuCheckboxItem,
|
|
3129
|
+
{
|
|
3130
|
+
id: "toggle-enhanced-a11y",
|
|
3131
|
+
label: "Enhanced accessibility",
|
|
3132
|
+
checked: enabled,
|
|
3133
|
+
onSelect: () => editor.user.updateUserPreferences({ isEnhancedA11yMode: !enabled })
|
|
3238
3134
|
}
|
|
3239
|
-
|
|
3240
|
-
}
|
|
3241
|
-
function ToggleEnhancedA11yModeItem() {
|
|
3242
|
-
const [enabled, setEnabled] = useEnhancedA11yMode();
|
|
3243
|
-
return /* @__PURE__ */ jsx(TldrawUiMenuCheckboxItem, { id: "toggle-enhanced-a11y", label: "Enhanced accessibility", checked: enabled, onSelect: () => setEnabled(!enabled) });
|
|
3244
|
-
}
|
|
3135
|
+
);
|
|
3136
|
+
});
|
|
3245
3137
|
function PreferencesGroup() {
|
|
3246
3138
|
return /* @__PURE__ */ jsxs(TldrawUiMenuGroup, { id: "preferences", label: "Preferences", children: [
|
|
3247
3139
|
/* @__PURE__ */ jsx(ToggleSnapModeItem, {}),
|
|
@@ -3261,22 +3153,27 @@ function PreferencesGroup() {
|
|
|
3261
3153
|
}
|
|
3262
3154
|
var ColorSchemeMenu = track(function ColorSchemeMenu2() {
|
|
3263
3155
|
const editor = useEditor();
|
|
3264
|
-
const current = editor.
|
|
3156
|
+
const current = editor.theme.getColorScheme();
|
|
3265
3157
|
return /* @__PURE__ */ jsx(TldrawUiMenuSubmenu, { id: "color-scheme", label: "Theme", children: /* @__PURE__ */ jsx(TldrawUiMenuGroup, { id: "color-scheme-group", children: ["light", "dark", "system"].map((scheme) => /* @__PURE__ */ jsx(
|
|
3266
3158
|
TldrawUiMenuCheckboxItem,
|
|
3267
3159
|
{
|
|
3268
3160
|
id: `color-scheme-${scheme}`,
|
|
3269
3161
|
label: scheme[0].toUpperCase() + scheme.slice(1),
|
|
3270
3162
|
checked: current === scheme,
|
|
3271
|
-
onSelect: () =>
|
|
3163
|
+
onSelect: () => {
|
|
3164
|
+
editor.setColorMode(scheme);
|
|
3165
|
+
editor.user.updateUserPreferences({ colorScheme: scheme });
|
|
3166
|
+
}
|
|
3272
3167
|
},
|
|
3273
3168
|
scheme
|
|
3274
3169
|
)) }) });
|
|
3275
3170
|
});
|
|
3276
3171
|
var LanguageMenu = track(function LanguageMenu2() {
|
|
3277
3172
|
const editor = useEditor();
|
|
3173
|
+
const languages = useAvailableTranslationLocales();
|
|
3278
3174
|
const current = editor.user.getLocale();
|
|
3279
|
-
|
|
3175
|
+
if (languages.length < 2) return null;
|
|
3176
|
+
return /* @__PURE__ */ jsx(TldrawUiMenuSubmenu, { id: "language", label: "Language", children: /* @__PURE__ */ jsx(TldrawUiMenuGroup, { id: "language-group", children: languages.map((language) => /* @__PURE__ */ jsx(
|
|
3280
3177
|
TldrawUiMenuCheckboxItem,
|
|
3281
3178
|
{
|
|
3282
3179
|
id: `language-${language.locale}`,
|
|
@@ -3343,9 +3240,8 @@ function KeyboardShortcutsMenuItem() {
|
|
|
3343
3240
|
{
|
|
3344
3241
|
id: "keyboard-shortcuts",
|
|
3345
3242
|
label: "Keyboard shortcuts",
|
|
3346
|
-
kbd: "mod+/",
|
|
3347
3243
|
onSelect: () => {
|
|
3348
|
-
void import('./panel-shortcuts-
|
|
3244
|
+
void import('./panel-shortcuts-4GIFCQQR.js').then(({ KeyboardShortcutsDialogContents: KeyboardShortcutsDialogContents2 }) => {
|
|
3349
3245
|
addDialog({ component: KeyboardShortcutsDialogContents2 });
|
|
3350
3246
|
});
|
|
3351
3247
|
}
|
|
@@ -3588,9 +3484,10 @@ function PageItemInput({ id, name, onCancel }) {
|
|
|
3588
3484
|
TldrawUiInput,
|
|
3589
3485
|
{
|
|
3590
3486
|
value: name,
|
|
3591
|
-
label:
|
|
3487
|
+
label: `Rename ${name}`,
|
|
3592
3488
|
autoFocus: true,
|
|
3593
3489
|
autoSelect: true,
|
|
3490
|
+
className: "mocanvas-page-rename",
|
|
3594
3491
|
onComplete: (next) => {
|
|
3595
3492
|
const trimmed = next.trim();
|
|
3596
3493
|
if (trimmed && trimmed !== name) {
|
|
@@ -3603,12 +3500,53 @@ function PageItemInput({ id, name, onCancel }) {
|
|
|
3603
3500
|
}
|
|
3604
3501
|
);
|
|
3605
3502
|
}
|
|
3606
|
-
function PageItemSubmenu({ id, total, onRename }) {
|
|
3503
|
+
function PageItemSubmenu({ id, total, name, onRename }) {
|
|
3607
3504
|
const editor = useEditor();
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
/* @__PURE__ */ jsx(
|
|
3505
|
+
const [open, setOpen] = useState(false);
|
|
3506
|
+
const label = name ? `Actions for ${name}` : "Page actions";
|
|
3507
|
+
return /* @__PURE__ */ jsxs(TldrawUiDropdownMenuSub, { id: `page-actions-${id}`, open, onOpenChange: setOpen, children: [
|
|
3508
|
+
/* @__PURE__ */ jsx(TldrawUiDropdownMenuSubTrigger, { label, className: "mocanvas-page-row-actions", children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: label }) }),
|
|
3509
|
+
/* @__PURE__ */ jsx(TldrawUiDropdownMenuSubContent, { label, children: /* @__PURE__ */ jsxs(TldrawUiMenuGroup, { id: `page-actions-group-${id}`, children: [
|
|
3510
|
+
/* @__PURE__ */ jsx(
|
|
3511
|
+
TldrawUiMenuItem,
|
|
3512
|
+
{
|
|
3513
|
+
id: `rename-page-${id}`,
|
|
3514
|
+
label: "Rename",
|
|
3515
|
+
noClose: true,
|
|
3516
|
+
onSelect: () => {
|
|
3517
|
+
setOpen(false);
|
|
3518
|
+
onRename?.();
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
),
|
|
3522
|
+
/* @__PURE__ */ jsx(
|
|
3523
|
+
TldrawUiMenuItem,
|
|
3524
|
+
{
|
|
3525
|
+
id: `duplicate-page-${id}`,
|
|
3526
|
+
label: "Duplicate",
|
|
3527
|
+
noClose: true,
|
|
3528
|
+
onSelect: () => {
|
|
3529
|
+
setOpen(false);
|
|
3530
|
+
editor.markHistoryStoppingPoint("duplicate page");
|
|
3531
|
+
editor.duplicatePage(id);
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
),
|
|
3535
|
+
/* @__PURE__ */ jsx(
|
|
3536
|
+
TldrawUiMenuItem,
|
|
3537
|
+
{
|
|
3538
|
+
id: `delete-page-${id}`,
|
|
3539
|
+
label: "Delete",
|
|
3540
|
+
noClose: true,
|
|
3541
|
+
disabled: total < 2,
|
|
3542
|
+
onSelect: () => {
|
|
3543
|
+
setOpen(false);
|
|
3544
|
+
editor.markHistoryStoppingPoint("delete page");
|
|
3545
|
+
editor.deletePage(id);
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
)
|
|
3549
|
+
] }) })
|
|
3612
3550
|
] });
|
|
3613
3551
|
}
|
|
3614
3552
|
var DefaultPageMenu = track(function DefaultPageMenu2() {
|
|
@@ -3618,43 +3556,57 @@ var DefaultPageMenu = track(function DefaultPageMenu2() {
|
|
|
3618
3556
|
const pages = editor.getPages();
|
|
3619
3557
|
const currentId = editor.getCurrentPageId();
|
|
3620
3558
|
const current = pages.find((page) => page.id === currentId);
|
|
3621
|
-
return /* @__PURE__ */ jsxs(
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3559
|
+
return /* @__PURE__ */ jsxs(
|
|
3560
|
+
TldrawUiDropdownMenuRoot,
|
|
3561
|
+
{
|
|
3562
|
+
id: "page-menu",
|
|
3563
|
+
open: isOpen,
|
|
3564
|
+
onOpenChange: (next) => {
|
|
3565
|
+
if (!next) setRenaming(null);
|
|
3566
|
+
setIsOpen(next);
|
|
3567
|
+
},
|
|
3568
|
+
children: [
|
|
3569
|
+
/* @__PURE__ */ jsx(TldrawUiDropdownMenuTrigger, { label: `Page: ${current?.name ?? "Untitled"}`, className: "mocanvas-btn--wide", children: current?.name ?? "Untitled" }),
|
|
3570
|
+
/* @__PURE__ */ jsx(TldrawUiDropdownMenuContent, { label: "Pages", side: "below", children: /* @__PURE__ */ jsxs(TldrawUiMenuContextProvider, { type: "menu", sourceId: "menu", children: [
|
|
3571
|
+
/* @__PURE__ */ jsx("div", { className: "mocanvas-page-list", role: "radiogroup", "aria-label": "Pages", children: pages.map((page) => /* @__PURE__ */ jsx("div", { className: "mocanvas-page-row", children: renaming === page.id ? /* @__PURE__ */ jsx(PageItemInput, { id: page.id, name: page.name, onCancel: () => setRenaming(null) }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3572
|
+
/* @__PURE__ */ jsx(
|
|
3573
|
+
"button",
|
|
3574
|
+
{
|
|
3575
|
+
type: "button",
|
|
3576
|
+
role: "menuitemradio",
|
|
3577
|
+
"aria-checked": page.id === currentId,
|
|
3578
|
+
className: "mocanvas-menu-item mocanvas-page-row-name",
|
|
3579
|
+
"data-item": `page-${page.id}`,
|
|
3580
|
+
onDoubleClick: () => setRenaming(page.id),
|
|
3581
|
+
onClick: () => {
|
|
3582
|
+
editor.setCurrentPage(page.id);
|
|
3583
|
+
setIsOpen(false);
|
|
3584
|
+
},
|
|
3585
|
+
children: page.name
|
|
3586
|
+
}
|
|
3587
|
+
),
|
|
3588
|
+
/* @__PURE__ */ jsx(PageItemSubmenu, { id: page.id, index: pages.indexOf(page), total: pages.length, name: page.name, onRename: () => setRenaming(page.id) })
|
|
3589
|
+
] }) }, page.id)) }),
|
|
3590
|
+
/* @__PURE__ */ jsx(TldrawUiMenuGroup, { id: "page-menu-actions", children: /* @__PURE__ */ jsx(
|
|
3591
|
+
TldrawUiMenuItem,
|
|
3628
3592
|
{
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
"
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
editor.
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3593
|
+
id: "new-page",
|
|
3594
|
+
label: "New page",
|
|
3595
|
+
icon: "duplicate",
|
|
3596
|
+
noClose: true,
|
|
3597
|
+
onSelect: () => {
|
|
3598
|
+
const before = new Set(pages.map((page) => page.id));
|
|
3599
|
+
editor.markHistoryStoppingPoint("new page");
|
|
3600
|
+
editor.createPage({ name: `Page ${pages.length + 1}` });
|
|
3601
|
+
const created = editor.getPages().find((page) => !before.has(page.id));
|
|
3602
|
+
if (created) setRenaming(created.id);
|
|
3603
|
+
}
|
|
3639
3604
|
}
|
|
3640
|
-
)
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
TldrawUiMenuItem,
|
|
3646
|
-
{
|
|
3647
|
-
id: "new-page",
|
|
3648
|
-
label: "New page",
|
|
3649
|
-
icon: "duplicate",
|
|
3650
|
-
onSelect: () => {
|
|
3651
|
-
editor.markHistoryStoppingPoint("new page");
|
|
3652
|
-
editor.createPage({ name: `Page ${pages.length + 1}` });
|
|
3653
|
-
}
|
|
3654
|
-
}
|
|
3655
|
-
) })
|
|
3656
|
-
] }) })
|
|
3657
|
-
] });
|
|
3605
|
+
) })
|
|
3606
|
+
] }) })
|
|
3607
|
+
]
|
|
3608
|
+
}
|
|
3609
|
+
);
|
|
3658
3610
|
});
|
|
3659
3611
|
var DefaultMinimap = track(function DefaultMinimap2() {
|
|
3660
3612
|
const editor = useEditor();
|
|
@@ -4028,7 +3980,7 @@ var MobileStylePanel = track(function MobileStylePanel2() {
|
|
|
4028
3980
|
const disabled = editor.getIsReadonly();
|
|
4029
3981
|
if (!styles) return null;
|
|
4030
3982
|
return /* @__PURE__ */ jsxs(TldrawUiPopover, { id: "mobile-style-panel", side: "above", children: [
|
|
4031
|
-
/* @__PURE__ */ jsx(TldrawUiPopoverTrigger, { className: disabled ? "mocanvas-btn mocanvas-btn--disabled" : "mocanvas-btn", children: /* @__PURE__ */ jsx(Icon, { name: "fill-solid" }) }),
|
|
3983
|
+
/* @__PURE__ */ jsx(TldrawUiPopoverTrigger, { label: "Style", className: disabled ? "mocanvas-btn mocanvas-btn--disabled" : "mocanvas-btn", children: /* @__PURE__ */ jsx(Icon, { name: "fill-solid" }) }),
|
|
4032
3984
|
/* @__PURE__ */ jsx(TldrawUiPopoverContent, { label: "Style", children: /* @__PURE__ */ jsx(StylePanelContextProvider, { isMobile: true, children: /* @__PURE__ */ jsx("div", { className: "mocanvas-stylepanel mocanvas-stylepanel--mobile", children: /* @__PURE__ */ jsx(DefaultStylePanelContent, {}) }) }) })
|
|
4033
3985
|
] });
|
|
4034
3986
|
});
|
|
@@ -4214,7 +4166,7 @@ var DefaultRichTextToolbar = track(function DefaultRichTextToolbar2({ children }
|
|
|
4214
4166
|
});
|
|
4215
4167
|
var registry = [];
|
|
4216
4168
|
function createDebugValue(name, defaultValue, shouldStore = true) {
|
|
4217
|
-
const flag = { name, defaultValue, shouldStore, value: atom
|
|
4169
|
+
const flag = { name, defaultValue, shouldStore, value: atom(`debug:${name}`, defaultValue) };
|
|
4218
4170
|
registry.push(flag);
|
|
4219
4171
|
return flag;
|
|
4220
4172
|
}
|
|
@@ -4301,6 +4253,7 @@ var TldrawUiToolbarItem = track(function TldrawUiToolbarItem2({ tool: toolId, la
|
|
|
4301
4253
|
type: "tool",
|
|
4302
4254
|
isActive: isSelected,
|
|
4303
4255
|
title: text,
|
|
4256
|
+
"data-tool": tool.id,
|
|
4304
4257
|
...tool.disabled ? { disabled: true } : {},
|
|
4305
4258
|
onClick: () => tool.onSelect("toolbar"),
|
|
4306
4259
|
children: known ? /* @__PURE__ */ jsx(Icon, { name }) : /* @__PURE__ */ jsx("span", { className: "mocanvas-btn-glyph", children: text.slice(0, 1).toUpperCase() })
|
|
@@ -4320,6 +4273,7 @@ var GeoToolbarItem = track(function GeoToolbarItem2({ geo, label }) {
|
|
|
4320
4273
|
type: "tool",
|
|
4321
4274
|
isActive: current === geo,
|
|
4322
4275
|
title: text,
|
|
4276
|
+
"data-tool": geo,
|
|
4323
4277
|
onClick: () => {
|
|
4324
4278
|
editor.setStyleForNextShapes(GeoShapeGeoStyle, geo);
|
|
4325
4279
|
editor.setCurrentTool("geo", { geo, force: true });
|
|
@@ -4375,56 +4329,86 @@ var ToggleToolLockedButton = track(function ToggleToolLockedButton2({ className
|
|
|
4375
4329
|
}
|
|
4376
4330
|
);
|
|
4377
4331
|
});
|
|
4332
|
+
var DEFAULT_TOOLBAR_ITEMS = [
|
|
4333
|
+
/* @__PURE__ */ jsx(SelectToolbarItem, {}, "select"),
|
|
4334
|
+
/* @__PURE__ */ jsx(HandToolbarItem, {}, "hand"),
|
|
4335
|
+
/* @__PURE__ */ jsx(DrawToolbarItem, {}, "draw"),
|
|
4336
|
+
/* @__PURE__ */ jsx(HighlightToolbarItem, {}, "highlight"),
|
|
4337
|
+
/* @__PURE__ */ jsx(EraserToolbarItem, {}, "eraser"),
|
|
4338
|
+
/* @__PURE__ */ jsx(LaserToolbarItem, {}, "laser"),
|
|
4339
|
+
/* @__PURE__ */ jsx(ArrowToolbarItem, {}, "arrow"),
|
|
4340
|
+
/* @__PURE__ */ jsx(TextToolbarItem, {}, "text"),
|
|
4341
|
+
/* @__PURE__ */ jsx(NoteToolbarItem, {}, "note"),
|
|
4342
|
+
/* @__PURE__ */ jsx(RectangleToolbarItem, {}, "rectangle"),
|
|
4343
|
+
/* @__PURE__ */ jsx(EllipseToolbarItem, {}, "ellipse"),
|
|
4344
|
+
/* @__PURE__ */ jsx(TriangleToolbarItem, {}, "triangle"),
|
|
4345
|
+
/* @__PURE__ */ jsx(DiamondToolbarItem, {}, "diamond"),
|
|
4346
|
+
/* @__PURE__ */ jsx(StarToolbarItem, {}, "star"),
|
|
4347
|
+
/* @__PURE__ */ jsx(LineToolbarItem, {}, "line"),
|
|
4348
|
+
/* @__PURE__ */ jsx(FrameToolbarItem, {}, "frame"),
|
|
4349
|
+
/* @__PURE__ */ jsx(AssetToolbarItem, {}, "asset")
|
|
4350
|
+
];
|
|
4378
4351
|
function DefaultToolbarContent() {
|
|
4379
|
-
return /* @__PURE__ */
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4352
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: DEFAULT_TOOLBAR_ITEMS });
|
|
4353
|
+
}
|
|
4354
|
+
var FALLBACK_METRICS = { slot: 42, reserved: 634 };
|
|
4355
|
+
function readBarMetrics(el) {
|
|
4356
|
+
if (typeof getComputedStyle !== "function") return FALLBACK_METRICS;
|
|
4357
|
+
const style = getComputedStyle(el);
|
|
4358
|
+
const px = (name, fallback) => {
|
|
4359
|
+
const value = Number.parseFloat(style.getPropertyValue(name));
|
|
4360
|
+
return Number.isFinite(value) ? value : fallback;
|
|
4361
|
+
};
|
|
4362
|
+
const pad = px("--mocanvas-ui-pad", 4);
|
|
4363
|
+
const inset = px("--mocanvas-ui-inset", 12);
|
|
4364
|
+
const dock = px("--mocanvas-ui-dock", 300);
|
|
4365
|
+
return {
|
|
4366
|
+
slot: px("--mocanvas-ui-btn", 40) + px("--mocanvas-ui-gap", 2),
|
|
4367
|
+
// Matches `.mocanvas-toolbar`'s `max-width`, plus the plate's own padding
|
|
4368
|
+
// and 1px border on each side.
|
|
4369
|
+
reserved: 2 * (inset + dock + pad + 1)
|
|
4370
|
+
};
|
|
4398
4371
|
}
|
|
4399
4372
|
function OverflowingToolbar({ label = "Tools", maxInline, children }) {
|
|
4400
4373
|
const barRef = useRef(null);
|
|
4401
|
-
const [
|
|
4374
|
+
const [available, setAvailable] = useState(null);
|
|
4375
|
+
const [metrics, setMetrics] = useState(FALLBACK_METRICS);
|
|
4376
|
+
const [moreOpen, setMoreOpen] = useState(false);
|
|
4402
4377
|
useEffect(() => {
|
|
4403
4378
|
const el = barRef.current;
|
|
4404
|
-
|
|
4405
|
-
|
|
4379
|
+
const container = el?.parentElement;
|
|
4380
|
+
if (!el || !container || typeof ResizeObserver === "undefined") return;
|
|
4381
|
+
const update = () => {
|
|
4382
|
+
setMetrics(readBarMetrics(el));
|
|
4383
|
+
const width = container.getBoundingClientRect().width;
|
|
4384
|
+
setAvailable(width > 0 ? width : null);
|
|
4385
|
+
};
|
|
4406
4386
|
update();
|
|
4407
4387
|
const ro = new ResizeObserver(update);
|
|
4408
|
-
ro.observe(
|
|
4388
|
+
ro.observe(container);
|
|
4409
4389
|
return () => ro.disconnect();
|
|
4410
4390
|
}, []);
|
|
4411
4391
|
const items = Children.toArray(children);
|
|
4412
|
-
const
|
|
4392
|
+
const room = available === null ? null : available - metrics.reserved;
|
|
4393
|
+
const fits = room === null || items.length * metrics.slot <= room ? items.length : (
|
|
4394
|
+
// One slot goes to the "more" button itself.
|
|
4395
|
+
Math.max(1, Math.floor(room / metrics.slot) - 1)
|
|
4396
|
+
);
|
|
4413
4397
|
const limit = Math.min(maxInline ?? items.length, fits);
|
|
4414
4398
|
const inline = items.slice(0, limit);
|
|
4415
4399
|
const overflow = items.slice(limit);
|
|
4416
4400
|
return /* @__PURE__ */ jsxs(TldrawUiToolbar, { ref: barRef, label, children: [
|
|
4417
4401
|
inline,
|
|
4418
|
-
overflow.length > 0 ? /* @__PURE__ */ jsxs(TldrawUiPopover, { id: "toolbar-overflow", side: "above", children: [
|
|
4419
|
-
/* @__PURE__ */ jsx(TldrawUiPopoverTrigger, { className: "mocanvas-btn", children: /* @__PURE__ */ jsx(Icon, { name: "chevron-down" }) }),
|
|
4420
|
-
/* @__PURE__ */ jsx(TldrawUiPopoverContent, { label: "More tools", children: /* @__PURE__ */ jsx("div", { className: "mocanvas-toolbar-overflow", children: overflow }) })
|
|
4402
|
+
overflow.length > 0 ? /* @__PURE__ */ jsxs(TldrawUiPopover, { id: "toolbar-overflow", side: "above", open: moreOpen, onOpenChange: setMoreOpen, children: [
|
|
4403
|
+
/* @__PURE__ */ jsx(TldrawUiPopoverTrigger, { className: "mocanvas-btn", label: "More tools", children: /* @__PURE__ */ jsx(Icon, { name: "chevron-down" }) }),
|
|
4404
|
+
/* @__PURE__ */ jsx(TldrawUiPopoverContent, { label: "More tools", children: /* @__PURE__ */ jsx("div", { className: "mocanvas-toolbar-overflow", onClick: () => setMoreOpen(false), children: overflow }) })
|
|
4421
4405
|
] }) : null
|
|
4422
4406
|
] });
|
|
4423
4407
|
}
|
|
4424
4408
|
function DefaultToolbarWithOverflow() {
|
|
4425
4409
|
const breakpoint = useBreakpoint();
|
|
4426
4410
|
return /* @__PURE__ */ jsxs(OverflowingToolbar, { label: "Tools", children: [
|
|
4427
|
-
|
|
4411
|
+
DEFAULT_TOOLBAR_ITEMS,
|
|
4428
4412
|
/* @__PURE__ */ jsx(ToggleToolLockedButton, {}),
|
|
4429
4413
|
breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM ? /* @__PURE__ */ jsx(MobileStylePanel, {}) : null
|
|
4430
4414
|
] });
|
|
@@ -4674,7 +4658,11 @@ var Layout = track(function Layout2({ children }) {
|
|
|
4674
4658
|
] }),
|
|
4675
4659
|
Toasts ? /* @__PURE__ */ jsx(Toasts, {}) : null,
|
|
4676
4660
|
Dialogs ? /* @__PURE__ */ jsx(Dialogs, {}) : null,
|
|
4677
|
-
A11y ? /* @__PURE__ */ jsx(A11y, {}) : null
|
|
4661
|
+
A11y ? /* @__PURE__ */ jsx(A11y, {}) : null,
|
|
4662
|
+
/* @__PURE__ */ jsx(ToolShortcuts, {}),
|
|
4663
|
+
/* @__PURE__ */ jsx(ActionShortcuts, {}),
|
|
4664
|
+
/* @__PURE__ */ jsx(SelectionAnnouncer, {}),
|
|
4665
|
+
/* @__PURE__ */ jsx(ReduceMotionAttribute, {})
|
|
4678
4666
|
] });
|
|
4679
4667
|
});
|
|
4680
4668
|
function TldrawUi({ components, overrides, onUiEvent, hideUi, forceMobile, children }) {
|
|
@@ -4814,7 +4802,7 @@ var targetStates = /* @__PURE__ */ new WeakMap();
|
|
|
4814
4802
|
function stateAtom(editor) {
|
|
4815
4803
|
let existing = targetStates.get(editor);
|
|
4816
4804
|
if (!existing) {
|
|
4817
|
-
existing = atom
|
|
4805
|
+
existing = atom("arrowTargetState", null);
|
|
4818
4806
|
targetStates.set(editor, existing);
|
|
4819
4807
|
}
|
|
4820
4808
|
return existing;
|
|
@@ -6789,6 +6777,21 @@ var RESIZE_CURSORS = {
|
|
|
6789
6777
|
function setCursor(editor, type) {
|
|
6790
6778
|
editor.updateInstanceState({ cursor: { type, rotation: 0 } });
|
|
6791
6779
|
}
|
|
6780
|
+
function startEdgeScrolling(node, update) {
|
|
6781
|
+
const editor = node.editor;
|
|
6782
|
+
editor.edgeScrollManager.start();
|
|
6783
|
+
let camera = editor.getCamera();
|
|
6784
|
+
const off = editor.on("tick", () => {
|
|
6785
|
+
const next = editor.getCamera();
|
|
6786
|
+
if (next.x === camera.x && next.y === camera.y && next.z === camera.z) return;
|
|
6787
|
+
camera = next;
|
|
6788
|
+
update();
|
|
6789
|
+
});
|
|
6790
|
+
return () => {
|
|
6791
|
+
off();
|
|
6792
|
+
editor.edgeScrollManager.stop();
|
|
6793
|
+
};
|
|
6794
|
+
}
|
|
6792
6795
|
var Idle10 = class extends StateNode {
|
|
6793
6796
|
static id = "idle";
|
|
6794
6797
|
onEnter() {
|
|
@@ -6919,8 +6922,10 @@ var PointingCanvas = class extends StateNode {
|
|
|
6919
6922
|
var Brushing = class extends StateNode {
|
|
6920
6923
|
static id = "brushing";
|
|
6921
6924
|
initialSelection = [];
|
|
6925
|
+
stopEdgeScrolling;
|
|
6922
6926
|
onEnter() {
|
|
6923
6927
|
this.initialSelection = this.editor.inputs.shiftKey ? this.editor.getSelectedShapeIds() : [];
|
|
6928
|
+
this.stopEdgeScrolling = startEdgeScrolling(this, () => this.update());
|
|
6924
6929
|
this.update();
|
|
6925
6930
|
}
|
|
6926
6931
|
onPointerMove() {
|
|
@@ -6934,6 +6939,8 @@ var Brushing = class extends StateNode {
|
|
|
6934
6939
|
this.finish();
|
|
6935
6940
|
}
|
|
6936
6941
|
onExit() {
|
|
6942
|
+
this.stopEdgeScrolling?.();
|
|
6943
|
+
this.stopEdgeScrolling = void 0;
|
|
6937
6944
|
this.editor.updateInstanceState({ brush: null });
|
|
6938
6945
|
}
|
|
6939
6946
|
update() {
|
|
@@ -6996,9 +7003,11 @@ var Translating = class extends StateNode {
|
|
|
6996
7003
|
static id = "translating";
|
|
6997
7004
|
initialShapes = /* @__PURE__ */ new Map();
|
|
6998
7005
|
markId = "";
|
|
7006
|
+
stopEdgeScrolling;
|
|
6999
7007
|
onEnter() {
|
|
7000
7008
|
const editor = this.editor;
|
|
7001
7009
|
this.markId = editor.markHistoryStoppingPoint("translate");
|
|
7010
|
+
this.stopEdgeScrolling = startEdgeScrolling(this, () => this.update());
|
|
7002
7011
|
this.initialShapes.clear();
|
|
7003
7012
|
for (const s of editor.getSelectedShapes()) {
|
|
7004
7013
|
this.initialShapes.set(s.id, s);
|
|
@@ -7114,6 +7123,8 @@ var Translating = class extends StateNode {
|
|
|
7114
7123
|
dropShapesOnFrameLike(editor, this.dropTarget, dragging);
|
|
7115
7124
|
}
|
|
7116
7125
|
onExit() {
|
|
7126
|
+
this.stopEdgeScrolling?.();
|
|
7127
|
+
this.stopEdgeScrolling = void 0;
|
|
7117
7128
|
this.editor.snaps.clearLines();
|
|
7118
7129
|
this.editor.setHintingShapes([]);
|
|
7119
7130
|
this.initialBounds = void 0;
|
|
@@ -7482,7 +7493,7 @@ var defaultShapeTools = [
|
|
|
7482
7493
|
FrameTool
|
|
7483
7494
|
];
|
|
7484
7495
|
var defaultTools = [SelectTool, HandTool, EraserTool, LaserTool, ...defaultShapeTools];
|
|
7485
|
-
function
|
|
7496
|
+
function isEditable(t) {
|
|
7486
7497
|
return t instanceof HTMLElement && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable);
|
|
7487
7498
|
}
|
|
7488
7499
|
function useExternalContent(editor, containerRef, options) {
|
|
@@ -7502,7 +7513,7 @@ function useExternalContent(editor, containerRef, options) {
|
|
|
7502
7513
|
void editor.putExternalContent(info);
|
|
7503
7514
|
return true;
|
|
7504
7515
|
};
|
|
7505
|
-
const isEditableContext = () => !!editor.getEditingShapeId() ||
|
|
7516
|
+
const isEditableContext = () => !!editor.getEditingShapeId() || isEditable(document.activeElement);
|
|
7506
7517
|
const onDragOver = (e) => {
|
|
7507
7518
|
if (!e.dataTransfer) return;
|
|
7508
7519
|
e.preventDefault();
|
|
@@ -7526,7 +7537,7 @@ function useExternalContent(editor, containerRef, options) {
|
|
|
7526
7537
|
handleText(dt.getData("text/plain"), point);
|
|
7527
7538
|
};
|
|
7528
7539
|
const onPaste = (e) => {
|
|
7529
|
-
if (
|
|
7540
|
+
if (isEditable(e.target) || isEditableContext()) return;
|
|
7530
7541
|
const cd = e.clipboardData;
|
|
7531
7542
|
if (!cd) return;
|
|
7532
7543
|
const files = Array.from(cd.files);
|
|
@@ -7540,7 +7551,7 @@ function useExternalContent(editor, containerRef, options) {
|
|
|
7540
7551
|
const onKeyDown = (e) => {
|
|
7541
7552
|
const isMac = /Mac|iPhone|iPad/.test(navigator.platform ?? "");
|
|
7542
7553
|
const accel = isMac ? e.metaKey : e.ctrlKey;
|
|
7543
|
-
if (!accel || e.key.toLowerCase() !== "v" ||
|
|
7554
|
+
if (!accel || e.key.toLowerCase() !== "v" || isEditable(e.target) || isEditableContext()) return;
|
|
7544
7555
|
setTimeout(() => {
|
|
7545
7556
|
if (!e.defaultPrevented || !navigator.clipboard?.read) return;
|
|
7546
7557
|
navigator.clipboard.read().then(
|
|
@@ -7665,7 +7676,14 @@ function Mocanvas(props) {
|
|
|
7665
7676
|
// `TldrawUi` is the documented chrome: it owns the context
|
|
7666
7677
|
// providers the component slots read from, and renders the canvas as
|
|
7667
7678
|
// its child rather than taking it as a prop.
|
|
7668
|
-
|
|
7679
|
+
//
|
|
7680
|
+
// `ContainerProvider` publishes the element above: the chrome needs
|
|
7681
|
+
// it to portal its floating layers out of whichever panel opened
|
|
7682
|
+
// them — a popover left inside the toolbar is trapped in that
|
|
7683
|
+
// panel's stacking context and paints *under* its neighbours — and
|
|
7684
|
+
// to measure the editor for the breakpoint, which is what makes the
|
|
7685
|
+
// chrome respond to an embed's width rather than the window's.
|
|
7686
|
+
/* @__PURE__ */ jsx(EditorProvider, { editor, children: /* @__PURE__ */ jsx(ContainerProvider, { container: editor.getContainer(), children: /* @__PURE__ */ jsx(
|
|
7669
7687
|
TldrawUi,
|
|
7670
7688
|
{
|
|
7671
7689
|
...components ? { components } : {},
|
|
@@ -7675,7 +7693,7 @@ function Mocanvas(props) {
|
|
|
7675
7693
|
hideUi: hideUi === true,
|
|
7676
7694
|
children: canvas
|
|
7677
7695
|
}
|
|
7678
|
-
) })
|
|
7696
|
+
) }) })
|
|
7679
7697
|
) : /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "grid", placeItems: "center", color: "#9ca3af", fontFamily: "system-ui" }, children: "loading engine\u2026" }) }) });
|
|
7680
7698
|
}
|
|
7681
7699
|
var FALLBACK_IMAGE_SIZE = { w: 100, h: 100 };
|
|
@@ -7941,7 +7959,7 @@ async function defaultHandleExternalEmbedContent(editor, info) {
|
|
|
7941
7959
|
return;
|
|
7942
7960
|
}
|
|
7943
7961
|
editor.markHistoryStoppingPoint("insert embed");
|
|
7944
|
-
const { createEmbedShape: createEmbedShape2 } = await import('./urlContent-
|
|
7962
|
+
const { createEmbedShape: createEmbedShape2 } = await import('./urlContent-WYYVQYYN.js');
|
|
7945
7963
|
createEmbedShape2(editor, info.url, info.point);
|
|
7946
7964
|
}
|
|
7947
7965
|
async function defaultHandleExternalTldrawContent(editor, info) {
|
|
@@ -8080,7 +8098,8 @@ async function putExcalidrawContent(editor, excalidrawClipboardContent, point) {
|
|
|
8080
8098
|
const x = (element.x ?? 0) + dx;
|
|
8081
8099
|
const y = (element.y ?? 0) + dy;
|
|
8082
8100
|
const rotation = element.angle ?? 0;
|
|
8083
|
-
const common = { color: colorFor(element.strokeColor),
|
|
8101
|
+
const common = { color: colorFor(element.strokeColor), size: sizeFor(element.strokeWidth) };
|
|
8102
|
+
const stroked = { ...common, dash: dashFor(element.strokeStyle) };
|
|
8084
8103
|
const geo = GEO_BY_EXCALIDRAW_TYPE[element.type ?? ""];
|
|
8085
8104
|
if (geo && editor.hasShapeUtil("geo")) {
|
|
8086
8105
|
const id = createShapeId();
|
|
@@ -8092,7 +8111,7 @@ async function putExcalidrawContent(editor, excalidrawClipboardContent, point) {
|
|
|
8092
8111
|
y,
|
|
8093
8112
|
rotation,
|
|
8094
8113
|
props: {
|
|
8095
|
-
...
|
|
8114
|
+
...stroked,
|
|
8096
8115
|
geo,
|
|
8097
8116
|
w: Math.max(1, element.width ?? 1),
|
|
8098
8117
|
h: Math.max(1, element.height ?? 1),
|
|
@@ -8128,7 +8147,7 @@ async function putExcalidrawContent(editor, excalidrawClipboardContent, point) {
|
|
|
8128
8147
|
x,
|
|
8129
8148
|
y,
|
|
8130
8149
|
rotation,
|
|
8131
|
-
props: { ...
|
|
8150
|
+
props: { ...stroked, start: { x: first[0], y: first[1] }, end: { x: last[0], y: last[1] } }
|
|
8132
8151
|
});
|
|
8133
8152
|
continue;
|
|
8134
8153
|
}
|
|
@@ -8141,7 +8160,7 @@ async function putExcalidrawContent(editor, excalidrawClipboardContent, point) {
|
|
|
8141
8160
|
x,
|
|
8142
8161
|
y,
|
|
8143
8162
|
rotation,
|
|
8144
|
-
props: { ...
|
|
8163
|
+
props: { ...stroked, points: Object.fromEntries(points.map((p, i) => [`a${i + 1}`, { id: `a${i + 1}`, index: `a${i + 1}`, x: p[0], y: p[1] }])) }
|
|
8145
8164
|
});
|
|
8146
8165
|
}
|
|
8147
8166
|
continue;
|
|
@@ -9308,6 +9327,6 @@ function getPointsFromDrawSegments(segments, scaleX = 1, scaleY = 1) {
|
|
|
9308
9327
|
return points;
|
|
9309
9328
|
}
|
|
9310
9329
|
|
|
9311
|
-
export { ASPECT_RATIO_OPTIONS, ASPECT_RATIO_TO_VALUE, AccessibilityMenu, AlignMenuItems, ArrangeMenuSubmenu, ArrowBindingHintOverlayUtil, ArrowBindingUtil, ArrowDownToolbarItem, ArrowHintOverlayUtil, ArrowLeftToolbarItem, ArrowRightToolbarItem, ArrowTool as ArrowShapeTool, ArrowTool, ArrowToolbarItem, ArrowUpToolbarItem, AssetToolbarItem, BaseBoxShapeTool, BookmarkAssetUtil, BreakPointProvider, BrushOverlayUtil, CenteredTopPanelContainer, CheckBoxToolbarItem, ClipboardMenuGroup, CloudToolbarItem, CollaboratorBrushOverlayUtil, CollaboratorCursorOverlayUtil, CollaboratorHintOverlayUtil, CollaboratorScribbleOverlayUtil, CollaboratorShapeIndicatorOverlayUtil, ColorSchemeMenu, CommentToolbarItem, ConversionsMenuGroup, ConvertToBookmarkMenuItem, ConvertToEmbedMenuItem, CopyAsMenuGroup, CopyMenuItem, CursorChatItem, CutMenuItem, DEFAULT_ARROW_BINDING_HINT_OVERLAY_OPTIONS, DEFAULT_ARROW_HINT_OVERLAY_OPTIONS, DEFAULT_BRUSH_OVERLAY_OPTIONS, DEFAULT_COLLABORATOR_OVERLAY_OPTIONS, DEFAULT_ELBOW_ARROW_OPTIONS, DEFAULT_MAX_ASSET_SIZE, DEFAULT_SCRIBBLE_OVERLAY_OPTIONS, DEFAULT_SELECTION_FOREGROUND_OVERLAY_OPTIONS, DEFAULT_SHAPE_HANDLE_OVERLAY_OPTIONS, DEFAULT_SNAP_INDICATOR_OVERLAY_OPTIONS, DEFAULT_SUPPORTED_IMAGE_TYPES, DEFAULT_SUPPORTED_VIDEO_TYPES, DebugFlagDefaults, DebugFlags, DebugStats, DefaultA11yAnnouncer, DefaultActionsMenu, DefaultActionsMenuContent, DefaultContextMenu, DefaultContextMenuContent, DefaultDebugMenu, DefaultDebugMenuContent, DefaultDebugPanel, DefaultFollowingIndicator, DefaultHelpMenu, DefaultHelpMenuContent, DefaultHelperButtons, DefaultHelperButtonsContent, DefaultImageToolbar, DefaultImageToolbarContent, DefaultMainMenu, DefaultMainMenuContent, DefaultMenuPanel, DefaultMinimap, DefaultNavigationPanel, DefaultPageMenu, DefaultPeopleMenu, DefaultPeopleMenuAvatar, DefaultPeopleMenuContent, DefaultPeopleMenuFacePile, DefaultPeopleMenuItem, DefaultQuickActions, DefaultQuickActionsContent, DefaultRichTextToolbar, DefaultRichTextToolbarContent, DefaultSharePanel, DefaultStylePanel, DefaultStylePanelContent, DefaultToasts, DefaultToolbar, DefaultToolbarContent, DefaultToolbarWithOverflow, DefaultUi, DefaultUserPresenceEditor, DefaultVideoToolbar, DefaultVideoToolbarContent, DefaultZoomMenu, DefaultZoomMenuContent, DeleteMenuItem, DiamondToolbarItem, DistributeMenuItems, DrawTool as DrawShapeTool, DrawShapeUtil, DrawTool, DrawToolbarItem, DuplicateMenuItem, ELBOW_ARROW_SIDES, EditLinkMenuItem, EditMenuSubmenu, EditSubmenu, EllipseToolbarItem, EraserTool, EraserToolbarItem, ExportAsMenuGroup, ExportFileContentSubMenu, ExtrasGroup, FeatureFlags, FitFrameToContentMenuItem, FrameTool as FrameShapeTool, FrameTool, FrameToolbarItem, GeoTool as GeoShapeTool, GeoTool, GeoToolbarItem, GroupMenuItem, GroupOrUngroupMenuItem, GroupShapeUtil, HIGHLIGHT_OPACITY, HIGHLIGHT_STROKE_SIZES, HandTool, HandToolbarItem, HeartToolbarItem, HexagonToolbarItem, HighlightShapeTool, HighlightShapeUtil, HighlightToolbarItem, IMAGE_PLACEHOLDER_FILL, IMAGE_PLACEHOLDER_STROKE, ImageAssetUtil, ImageShapeUtil, InputModeMenu, KeyboardShiftEnterTweakExtension, KeyboardShortcutsMenuItem, LanguageMenu, LaserTool, LaserToolbarItem, LineTool as LineShapeTool, LineShapeUtil, LineTool, LineToolbarItem, LockGroup, MOCANVAS_CLIPBOARD_TYPE, MOD_KEY, MORE_GEO_KINDS, MiscMenuGroup, MobileStylePanel, Mocanvas, MocanvasUiMenuItem, MoveToPageMenu, NoteTool as NoteShapeTool, NoteTool, NoteToolbarItem, OfflineIndicator, OvalToolbarItem, OverflowingToolbar, PORTRAIT_BREAKPOINT, PRIMARY_GEO_KINDS, PageItemInput, PageItemSubmenu, PasteMenuItem, PathBuilder, PathBuilderGeometry2d, PlainTextArea, PlainTextLabel, PreferencesGroup, PrintItem, RectangleToolbarItem, RemoveFrameMenuItem, ReorderMenuItems, ReorderMenuSubmenu, ResponsiveStylePanel, RhombusToolbarItem, RichTextArea, RichTextLabel, RichTextSVG, RotateCWMenuItem, ScribbleOverlayUtil, SelectAllMenuItem, SelectTool, SelectToolbarItem, SelectionForegroundOverlayUtil, ShapeHandleOverlayUtil, ShapeIndicatorOverlayUtil, SnapIndicatorOverlayUtil, StackMenuItems, StarToolbarItem, StylePanel, StylePanelArrowKindPicker, StylePanelArrowheadPicker, StylePanelButtonPicker, StylePanelButtonPickerInline, StylePanelColorPicker, StylePanelContextProvider, StylePanelDashPicker, StylePanelDoubleDropdownPicker, StylePanelDoubleDropdownPickerInline, StylePanelDropdownPicker, StylePanelDropdownPickerInline, StylePanelFillPicker, StylePanelFontPicker, StylePanelGeoShapePicker, StylePanelLabelAlignPicker, StylePanelOpacityPicker, StylePanelSection, StylePanelSizePicker, StylePanelSplinePicker, StylePanelSubheading, StylePanelTextAlignPicker, TOOLBAR_GROUPS, TextTool as TextShapeTool, TextTool, TextToolbarItem, TldrawImage, TldrawUi, TldrawUiA11yProvider, TldrawUiActionsProvider, TldrawUiColumn, TldrawUiComponentsProvider, TldrawUiContextProvider, TldrawUiContextualToolbar, TldrawUiGrid, TldrawUiInFrontOfTheCanvas, TldrawUiInput, TldrawUiOrientationProvider, TldrawUiPopover, TldrawUiPopoverContent, TldrawUiPopoverTrigger, TldrawUiRow, TldrawUiSelect, TldrawUiSelectContent, TldrawUiSelectItem, TldrawUiSelectTrigger, TldrawUiSelectValue, TldrawUiSlider, TldrawUiToastsProvider, TldrawUiToolbar, TldrawUiToolbarButton, TldrawUiToolbarItem, TldrawUiToolbarToggleGroup, TldrawUiToolbarToggleItem, TldrawUiToolsProvider, TldrawUiTooltip, TldrawUiTooltipProvider, ToggleAutoSizeMenuItem, ToggleDebugModeItem, ToggleDynamicSizeModeItem, ToggleEdgeScrollingItem, ToggleEnhancedA11yModeItem, ToggleFocusModeItem, ToggleGridItem, ToggleInvertZoomItem, ToggleKeyboardShortcutsItem, ToggleLockMenuItem, TogglePasteAtCursorItem, ToggleReduceMotionItem, ToggleSnapModeItem, ToggleToolLockItem, ToggleToolLockedButton, ToggleTransparentBgMenuItem, ToggleWrapModeItem,
|
|
9330
|
+
export { ASPECT_RATIO_OPTIONS, ASPECT_RATIO_TO_VALUE, AccessibilityMenu, AlignMenuItems, ArrangeMenuSubmenu, ArrowBindingHintOverlayUtil, ArrowBindingUtil, ArrowDownToolbarItem, ArrowHintOverlayUtil, ArrowLeftToolbarItem, ArrowRightToolbarItem, ArrowTool as ArrowShapeTool, ArrowTool, ArrowToolbarItem, ArrowUpToolbarItem, AssetToolbarItem, BaseBoxShapeTool, BookmarkAssetUtil, BreakPointProvider, BrushOverlayUtil, CenteredTopPanelContainer, CheckBoxToolbarItem, ClipboardMenuGroup, CloudToolbarItem, CollaboratorBrushOverlayUtil, CollaboratorCursorOverlayUtil, CollaboratorHintOverlayUtil, CollaboratorScribbleOverlayUtil, CollaboratorShapeIndicatorOverlayUtil, ColorSchemeMenu, CommentToolbarItem, ConversionsMenuGroup, ConvertToBookmarkMenuItem, ConvertToEmbedMenuItem, CopyAsMenuGroup, CopyMenuItem, CursorChatItem, CutMenuItem, DEFAULT_ARROW_BINDING_HINT_OVERLAY_OPTIONS, DEFAULT_ARROW_HINT_OVERLAY_OPTIONS, DEFAULT_BRUSH_OVERLAY_OPTIONS, DEFAULT_COLLABORATOR_OVERLAY_OPTIONS, DEFAULT_ELBOW_ARROW_OPTIONS, DEFAULT_MAX_ASSET_SIZE, DEFAULT_SCRIBBLE_OVERLAY_OPTIONS, DEFAULT_SELECTION_FOREGROUND_OVERLAY_OPTIONS, DEFAULT_SHAPE_HANDLE_OVERLAY_OPTIONS, DEFAULT_SNAP_INDICATOR_OVERLAY_OPTIONS, DEFAULT_SUPPORTED_IMAGE_TYPES, DEFAULT_SUPPORTED_VIDEO_TYPES, DEFAULT_TOOLBAR_ITEMS, DebugFlagDefaults, DebugFlags, DebugStats, DefaultA11yAnnouncer, DefaultActionsMenu, DefaultActionsMenuContent, DefaultContextMenu, DefaultContextMenuContent, DefaultDebugMenu, DefaultDebugMenuContent, DefaultDebugPanel, DefaultFollowingIndicator, DefaultHelpMenu, DefaultHelpMenuContent, DefaultHelperButtons, DefaultHelperButtonsContent, DefaultImageToolbar, DefaultImageToolbarContent, DefaultMainMenu, DefaultMainMenuContent, DefaultMenuPanel, DefaultMinimap, DefaultNavigationPanel, DefaultPageMenu, DefaultPeopleMenu, DefaultPeopleMenuAvatar, DefaultPeopleMenuContent, DefaultPeopleMenuFacePile, DefaultPeopleMenuItem, DefaultQuickActions, DefaultQuickActionsContent, DefaultRichTextToolbar, DefaultRichTextToolbarContent, DefaultSharePanel, DefaultStylePanel, DefaultStylePanelContent, DefaultToasts, DefaultToolbar, DefaultToolbarContent, DefaultToolbarWithOverflow, DefaultUi, DefaultUserPresenceEditor, DefaultVideoToolbar, DefaultVideoToolbarContent, DefaultZoomMenu, DefaultZoomMenuContent, DeleteMenuItem, DiamondToolbarItem, DistributeMenuItems, DrawTool as DrawShapeTool, DrawShapeUtil, DrawTool, DrawToolbarItem, DuplicateMenuItem, ELBOW_ARROW_SIDES, EditLinkMenuItem, EditMenuSubmenu, EditSubmenu, EllipseToolbarItem, EraserTool, EraserToolbarItem, ExportAsMenuGroup, ExportFileContentSubMenu, ExtrasGroup, FeatureFlags, FitFrameToContentMenuItem, FrameTool as FrameShapeTool, FrameTool, FrameToolbarItem, GeoTool as GeoShapeTool, GeoTool, GeoToolbarItem, GroupMenuItem, GroupOrUngroupMenuItem, GroupShapeUtil, HIGHLIGHT_OPACITY, HIGHLIGHT_STROKE_SIZES, HandTool, HandToolbarItem, HeartToolbarItem, HexagonToolbarItem, HighlightShapeTool, HighlightShapeUtil, HighlightToolbarItem, IMAGE_PLACEHOLDER_FILL, IMAGE_PLACEHOLDER_STROKE, ImageAssetUtil, ImageShapeUtil, InputModeMenu, KeyboardShiftEnterTweakExtension, KeyboardShortcutsMenuItem, LanguageMenu, LaserTool, LaserToolbarItem, LineTool as LineShapeTool, LineShapeUtil, LineTool, LineToolbarItem, LockGroup, MOCANVAS_CLIPBOARD_TYPE, MOD_KEY, MORE_GEO_KINDS, MiscMenuGroup, MobileStylePanel, Mocanvas, MocanvasUiMenuItem, MoveToPageMenu, NoteTool as NoteShapeTool, NoteTool, NoteToolbarItem, OfflineIndicator, OvalToolbarItem, OverflowingToolbar, PORTRAIT_BREAKPOINT, PRIMARY_GEO_KINDS, PageItemInput, PageItemSubmenu, PasteMenuItem, PathBuilder, PathBuilderGeometry2d, PlainTextArea, PlainTextLabel, PreferencesGroup, PrintItem, RectangleToolbarItem, ReduceMotionAttribute, RemoveFrameMenuItem, ReorderMenuItems, ReorderMenuSubmenu, ResponsiveStylePanel, RhombusToolbarItem, RichTextArea, RichTextLabel, RichTextSVG, RotateCWMenuItem, ScribbleOverlayUtil, SelectAllMenuItem, SelectTool, SelectToolbarItem, SelectionAnnouncer, SelectionForegroundOverlayUtil, ShapeHandleOverlayUtil, ShapeIndicatorOverlayUtil, SnapIndicatorOverlayUtil, StackMenuItems, StarToolbarItem, StylePanel, StylePanelArrowKindPicker, StylePanelArrowheadPicker, StylePanelButtonPicker, StylePanelButtonPickerInline, StylePanelColorPicker, StylePanelContextProvider, StylePanelDashPicker, StylePanelDoubleDropdownPicker, StylePanelDoubleDropdownPickerInline, StylePanelDropdownPicker, StylePanelDropdownPickerInline, StylePanelFillPicker, StylePanelFontPicker, StylePanelGeoShapePicker, StylePanelLabelAlignPicker, StylePanelOpacityPicker, StylePanelSection, StylePanelSizePicker, StylePanelSplinePicker, StylePanelSubheading, StylePanelTextAlignPicker, TOOLBAR_GROUPS, TextTool as TextShapeTool, TextTool, TextToolbarItem, TldrawImage, TldrawUi, TldrawUiA11yProvider, TldrawUiActionsProvider, TldrawUiColumn, TldrawUiComponentsProvider, TldrawUiContextProvider, TldrawUiContextualToolbar, TldrawUiGrid, TldrawUiInFrontOfTheCanvas, TldrawUiInput, TldrawUiOrientationProvider, TldrawUiPopover, TldrawUiPopoverContent, TldrawUiPopoverTrigger, TldrawUiRow, TldrawUiSelect, TldrawUiSelectContent, TldrawUiSelectItem, TldrawUiSelectTrigger, TldrawUiSelectValue, TldrawUiSlider, TldrawUiToastsProvider, TldrawUiToolbar, TldrawUiToolbarButton, TldrawUiToolbarItem, TldrawUiToolbarToggleGroup, TldrawUiToolbarToggleItem, TldrawUiToolsProvider, TldrawUiTooltip, TldrawUiTooltipProvider, ToggleAutoSizeMenuItem, ToggleDebugModeItem, ToggleDynamicSizeModeItem, ToggleEdgeScrollingItem, ToggleEnhancedA11yModeItem, ToggleFocusModeItem, ToggleGridItem, ToggleInvertZoomItem, ToggleKeyboardShortcutsItem, ToggleLockMenuItem, TogglePasteAtCursorItem, ToggleReduceMotionItem, ToggleSnapModeItem, ToggleToolLockItem, ToggleToolLockedButton, ToggleTransparentBgMenuItem, ToggleWrapModeItem, Toolbar, TrapezoidToolbarItem, TriangleToolbarItem, UndoRedoGroup, UngroupMenuItem, UnlockAllMenuItem, VideoAssetUtil, ViewSubmenu, XBoxToolbarItem, ZoomBar, ZoomBrushOverlayUtil, ZoomOrRotateMenuItem, ZoomTo100MenuItem, ZoomToFitMenuItem, ZoomToSelectionMenuItem, ZoomTool, allDefaultFontFaces, buildDefaultActionItems, buildDefaultToolItems, canPrint, canUploadImageTextures, centerSelectionAroundPoint, clearArrowTargetState, containBoxSize, copyAs, copySelectionToClipboard, createBookmarkFromUrl, createDebugFlag, createDebugValue, createFeatureFlag, createShapesForAssets, cutSelectionToClipboard, debugFlags, defaultAddFontsFromNode, defaultAssetUtils, defaultBindingUtils, defaultComponents, defaultEditorAssetUrls, defaultFonts, defaultGeoTypeDefinitions, defaultHandleExternalEmbedContent, defaultHandleExternalExcalidrawContent, defaultHandleExternalFileAsset, defaultHandleExternalFileContent, defaultHandleExternalFileReplaceContent, defaultHandleExternalSvgTextContent, defaultHandleExternalTextContent, defaultHandleExternalTldrawContent, defaultHandleExternalUrlAsset, defaultOverlayUtils, defaultShapeTools, defaultShapeUtils, defaultTools, downsizeDimensions, downsizeImage, drawLabelChip, embedPermissionsToAllowAttribute, embedShapePermissionDefaults, exportAs, featureFlags, fitFrameToContent, getArrowInfo, getArrowTargetState, getAssetInfo, getBreakpointForWidth, getClipboardTextForShapes, getColorStyleItems, getCropBox, getDebugFlags, getDrawDisplayValues, getDrawOutlinePoints, getElbowArrowBoxEdges, getElbowArrowBoxes, getElbowArrowInfo, getElbowArrowSideAxis, getElbowArrowSideTowards, getElbowArrowTargetBox, getFontStyleItems, getHighlightDisplayValues, getHighlightOutlinePoints, getHitShapeOnCanvasPointerDown, getImageCropStyle, getImageDisplayValues, getImageTextureKey, getImageTextureSource, getLineDisplayValues, getLinePoints, getPointsFromDrawSegment, getPointsFromDrawSegments, getStroke, getStrokeOutlinePoints, getStrokePoints, getStyleItemsForProp, getStylePanelSections, getSvgPathFromStrokePoints, getTipTapDefaultExtensions, hairline, handleNativeOrMenuCopy, hasAnyStyleSection, hideAllTooltips, iconTypes, isExcalidrawClipboardContent, isInElbowArrowRange, isolate, loadImageTextureSource, loadTipTapDefaultExtensions, notifyIfFileNotAllowed, onDragFromToolbarToCreateShape, pasteFromClipboard, preloadFont, printSelection, putExcalidrawContent, readDrawSegments, readImageSize, registerDefaultSideEffects, registeredToolIds, removeFrame, renderHtmlFromRichText, renderPlaintextFromRichText, renderRichTextFromHTML, resolveScribbleColor, sanitizeSvg, smoothPoints, startEditingShapeWithRichText, toElbowArrowRoute, traceCross, tracePolyline, traceRoundedRect, traceTaperedStroke, truncateStringWithEllipsis, unwrapLabel, updateArrowTargetState, useA11y, useActionsOverride, useAnyMenuIsOpen, useBreakpoint, useCollaborationStatus, useCopyAs, useDefaultHelpers, useEditablePlainText, useEditableRichText, useExportAs, useExternalContent, useImageOrVideoAsset, useLocalStorageState, useMenuClipboardEvents, useMenuIsOpen, useNativeClipboardEvents, usePeerIds, usePeers, usePrefersReducedMotion, usePresence, useReduceMotion, useSelectedShapesAnnouncer, useShowCollaborationUi, useStylePanelContext, useTldrawUiComponents, useTldrawUiOrientation, useToasts, useToolsOverride, useTooltipSuppression, useUiListsAreLive, withCamera };
|
|
9312
9331
|
//# sourceMappingURL=index.js.map
|
|
9313
9332
|
//# sourceMappingURL=index.js.map
|