tldraw 3.16.0-canary.dfdf6b7de8c2 → 3.16.0-canary.e1b1e53d3c16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/dist-cjs/index.d.ts +181 -5
  2. package/dist-cjs/index.js +18 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/canvas/TldrawScribble.js +1 -1
  5. package/dist-cjs/lib/canvas/TldrawScribble.js.map +2 -2
  6. package/dist-cjs/lib/defaultExternalContentHandlers.js +5 -4
  7. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  8. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +3 -3
  9. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
  10. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +1 -1
  11. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
  12. package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js +3 -3
  13. package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js.map +1 -1
  14. package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +3 -3
  15. package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
  16. package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js +1 -1
  17. package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +1 -1
  18. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +12 -12
  19. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
  20. package/dist-cjs/lib/shapes/frame/components/FrameHeading.js +1 -1
  21. package/dist-cjs/lib/shapes/frame/components/FrameHeading.js.map +2 -2
  22. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +2 -2
  23. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
  24. package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js +2 -1
  25. package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js.map +2 -2
  26. package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +5 -1
  27. package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
  28. package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +3 -3
  29. package/dist-cjs/lib/shapes/image/ImageShapeUtil.js.map +1 -1
  30. package/dist-cjs/lib/shapes/line/LineShapeUtil.js +5 -1
  31. package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
  32. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +4 -4
  33. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
  34. package/dist-cjs/lib/shapes/shared/ShapeFill.js +4 -4
  35. package/dist-cjs/lib/shapes/shared/ShapeFill.js.map +2 -2
  36. package/dist-cjs/lib/shapes/shared/freehand/svg.js.map +2 -2
  37. package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +10 -1
  38. package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
  39. package/dist-cjs/lib/shapes/text/TextShapeUtil.js +2 -2
  40. package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
  41. package/dist-cjs/lib/shapes/video/VideoShapeUtil.js +3 -3
  42. package/dist-cjs/lib/shapes/video/VideoShapeUtil.js.map +1 -1
  43. package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js +25 -1
  44. package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
  45. package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js +12 -0
  46. package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js.map +2 -2
  47. package/dist-cjs/lib/ui/TldrawUi.js +14 -0
  48. package/dist-cjs/lib/ui/TldrawUi.js.map +3 -3
  49. package/dist-cjs/lib/ui/assetUrls.js +13 -10
  50. package/dist-cjs/lib/ui/assetUrls.js.map +2 -2
  51. package/dist-cjs/lib/ui/components/AccessibilityMenu.js +35 -0
  52. package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +7 -0
  53. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js +12 -3
  54. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js.map +2 -2
  55. package/dist-cjs/lib/ui/components/DefaultMenuPanel.js +3 -2
  56. package/dist-cjs/lib/ui/components/DefaultMenuPanel.js.map +2 -2
  57. package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -1
  58. package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +1 -1
  59. package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +3 -3
  60. package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
  61. package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js +4 -4
  62. package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js.map +2 -2
  63. package/dist-cjs/lib/ui/components/MobileStylePanel.js +5 -3
  64. package/dist-cjs/lib/ui/components/MobileStylePanel.js.map +2 -2
  65. package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +1 -1
  66. package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
  67. package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +2 -1
  68. package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
  69. package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js +3 -2
  70. package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js.map +2 -2
  71. package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js +2 -2
  72. package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js.map +2 -2
  73. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +2 -0
  74. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
  75. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +171 -140
  76. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
  77. package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js +3 -3
  78. package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js.map +2 -2
  79. package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js +26 -25
  80. package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js.map +3 -3
  81. package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js +1 -1
  82. package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js.map +2 -2
  83. package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js +66 -21
  84. package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js.map +3 -3
  85. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +189 -80
  86. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +3 -3
  87. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +5 -4
  88. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
  89. package/dist-cjs/lib/ui/components/menu-items.js +6 -0
  90. package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
  91. package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +5 -16
  92. package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +3 -3
  93. package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +1 -1
  94. package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
  95. package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js +3 -2
  96. package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js.map +3 -3
  97. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +30 -7
  98. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
  99. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +262 -0
  100. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +7 -0
  101. package/dist-cjs/lib/ui/components/primitives/layout.js +76 -0
  102. package/dist-cjs/lib/ui/components/primitives/layout.js.map +7 -0
  103. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuContext.js.map +2 -2
  104. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js +25 -12
  105. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js.map +2 -2
  106. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +12 -26
  107. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
  108. package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +3 -2
  109. package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
  110. package/dist-cjs/lib/ui/context/actions.js +31 -2
  111. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  112. package/dist-cjs/lib/ui/context/events.js.map +2 -2
  113. package/dist-cjs/lib/ui/hooks/useTools.js +21 -3
  114. package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
  115. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  116. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +3 -0
  117. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
  118. package/dist-cjs/lib/ui/version.js +3 -3
  119. package/dist-cjs/lib/ui/version.js.map +1 -1
  120. package/dist-esm/index.d.mts +181 -5
  121. package/dist-esm/index.mjs +29 -1
  122. package/dist-esm/index.mjs.map +2 -2
  123. package/dist-esm/lib/canvas/TldrawScribble.mjs +1 -1
  124. package/dist-esm/lib/canvas/TldrawScribble.mjs.map +2 -2
  125. package/dist-esm/lib/defaultExternalContentHandlers.mjs +5 -4
  126. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  127. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +4 -3
  128. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
  129. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +1 -1
  130. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
  131. package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs +3 -3
  132. package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs.map +1 -1
  133. package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +4 -3
  134. package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
  135. package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs +1 -1
  136. package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +1 -1
  137. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +13 -12
  138. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
  139. package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs +1 -1
  140. package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs.map +2 -2
  141. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +3 -2
  142. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
  143. package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs +2 -1
  144. package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs.map +2 -2
  145. package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +6 -1
  146. package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
  147. package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +3 -3
  148. package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs.map +1 -1
  149. package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +6 -1
  150. package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
  151. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +5 -4
  152. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
  153. package/dist-esm/lib/shapes/shared/ShapeFill.mjs +5 -4
  154. package/dist-esm/lib/shapes/shared/ShapeFill.mjs.map +2 -2
  155. package/dist-esm/lib/shapes/shared/freehand/svg.mjs.map +2 -2
  156. package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +10 -1
  157. package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
  158. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +3 -2
  159. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
  160. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +3 -3
  161. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +1 -1
  162. package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs +26 -1
  163. package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
  164. package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +13 -0
  165. package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs.map +2 -2
  166. package/dist-esm/lib/ui/TldrawUi.mjs +16 -2
  167. package/dist-esm/lib/ui/TldrawUi.mjs.map +3 -3
  168. package/dist-esm/lib/ui/assetUrls.mjs +13 -10
  169. package/dist-esm/lib/ui/assetUrls.mjs.map +2 -2
  170. package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +19 -0
  171. package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +7 -0
  172. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +12 -3
  173. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
  174. package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs +3 -2
  175. package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs.map +2 -2
  176. package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -1
  177. package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +1 -1
  178. package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +3 -5
  179. package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
  180. package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs +4 -4
  181. package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs.map +2 -2
  182. package/dist-esm/lib/ui/components/MobileStylePanel.mjs +6 -3
  183. package/dist-esm/lib/ui/components/MobileStylePanel.mjs.map +2 -2
  184. package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +1 -1
  185. package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
  186. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +2 -1
  187. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
  188. package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs +3 -2
  189. package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs.map +2 -2
  190. package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs +2 -2
  191. package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs.map +2 -2
  192. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +3 -1
  193. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
  194. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +171 -140
  195. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
  196. package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs +3 -3
  197. package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs.map +2 -2
  198. package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs +26 -25
  199. package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs.map +2 -2
  200. package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs +1 -1
  201. package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs.map +2 -2
  202. package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs +56 -21
  203. package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs.map +2 -2
  204. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +192 -81
  205. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +3 -3
  206. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +5 -4
  207. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
  208. package/dist-esm/lib/ui/components/menu-items.mjs +6 -0
  209. package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
  210. package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +6 -6
  211. package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
  212. package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -1
  213. package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
  214. package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs +3 -2
  215. package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs.map +2 -2
  216. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +30 -7
  217. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
  218. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +239 -0
  219. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +7 -0
  220. package/dist-esm/lib/ui/components/primitives/layout.mjs +46 -0
  221. package/dist-esm/lib/ui/components/primitives/layout.mjs.map +7 -0
  222. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuContext.mjs.map +2 -2
  223. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs +25 -12
  224. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs.map +2 -2
  225. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +12 -26
  226. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
  227. package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +3 -2
  228. package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
  229. package/dist-esm/lib/ui/context/actions.mjs +31 -2
  230. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  231. package/dist-esm/lib/ui/context/events.mjs.map +2 -2
  232. package/dist-esm/lib/ui/hooks/useTools.mjs +22 -3
  233. package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
  234. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +3 -0
  235. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
  236. package/dist-esm/lib/ui/version.mjs +3 -3
  237. package/dist-esm/lib/ui/version.mjs.map +1 -1
  238. package/package.json +11 -34
  239. package/src/index.ts +22 -0
  240. package/src/lib/canvas/TldrawScribble.tsx +1 -1
  241. package/src/lib/defaultExternalContentHandlers.ts +12 -4
  242. package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +2 -1
  243. package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +4 -3
  244. package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +7 -6
  245. package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +4 -3
  246. package/src/lib/shapes/arrow/arrowTargetState.ts +2 -1
  247. package/src/lib/shapes/arrow/elbow/ElbowArrowDebug.tsx +3 -3
  248. package/src/lib/shapes/draw/DrawShapeTool.test.ts +0 -5
  249. package/src/lib/shapes/draw/DrawShapeUtil.tsx +4 -3
  250. package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
  251. package/src/lib/shapes/frame/FrameShapeUtil.tsx +21 -14
  252. package/src/lib/shapes/frame/components/FrameHeading.tsx +1 -1
  253. package/src/lib/shapes/geo/GeoShapeUtil.tsx +3 -2
  254. package/src/lib/shapes/geo/components/GeoShapeBody.tsx +2 -2
  255. package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +7 -1
  256. package/src/lib/shapes/image/ImageShapeUtil.tsx +3 -3
  257. package/src/lib/shapes/line/LineShapeUtil.test.tsx +4 -3
  258. package/src/lib/shapes/line/LineShapeUtil.tsx +6 -1
  259. package/src/lib/shapes/line/__snapshots__/LineShapeUtil.test.tsx.snap +2 -2
  260. package/src/lib/shapes/note/NoteShapeUtil.tsx +9 -4
  261. package/src/lib/shapes/shared/ShapeFill.tsx +5 -4
  262. package/src/lib/shapes/shared/freehand/svg.ts +2 -0
  263. package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +11 -1
  264. package/src/lib/shapes/text/TextShapeTool.test.ts +6 -5
  265. package/src/lib/shapes/text/TextShapeUtil.tsx +3 -2
  266. package/src/lib/shapes/video/VideoShapeUtil.tsx +3 -3
  267. package/src/lib/tools/EraserTool/childStates/Erasing.ts +34 -1
  268. package/src/lib/tools/EraserTool/childStates/Pointing.ts +20 -0
  269. package/src/lib/ui/TldrawUi.tsx +17 -2
  270. package/src/lib/ui/assetUrls.ts +13 -10
  271. package/src/lib/ui/components/AccessibilityMenu.tsx +20 -0
  272. package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +15 -3
  273. package/src/lib/ui/components/DefaultMenuPanel.tsx +4 -3
  274. package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +1 -1
  275. package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +4 -4
  276. package/src/lib/ui/components/Minimap/MinimapManager.ts +4 -4
  277. package/src/lib/ui/components/MobileStylePanel.tsx +9 -6
  278. package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +1 -1
  279. package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +3 -2
  280. package/src/lib/ui/components/SharePanel/PeopleMenuItem.tsx +4 -3
  281. package/src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx +3 -3
  282. package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +3 -1
  283. package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +146 -107
  284. package/src/lib/ui/components/StylePanel/DoubleDropdownPicker.tsx +3 -3
  285. package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +7 -6
  286. package/src/lib/ui/components/Toolbar/DefaultImageToolbarContent.tsx +1 -1
  287. package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +55 -23
  288. package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +212 -61
  289. package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +14 -11
  290. package/src/lib/ui/components/menu-items.tsx +8 -0
  291. package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +40 -37
  292. package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -1
  293. package/src/lib/ui/components/primitives/TldrawUiPopover.tsx +4 -2
  294. package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +51 -12
  295. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +325 -0
  296. package/src/lib/ui/components/primitives/layout.tsx +107 -0
  297. package/src/lib/ui/components/primitives/menus/TldrawUiMenuContext.tsx +0 -1
  298. package/src/lib/ui/components/primitives/menus/TldrawUiMenuGroup.tsx +29 -16
  299. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +18 -27
  300. package/src/lib/ui/context/TldrawUiContextProvider.tsx +23 -20
  301. package/src/lib/ui/context/actions.tsx +31 -2
  302. package/src/lib/ui/context/events.tsx +1 -0
  303. package/src/lib/ui/hooks/useTools.tsx +25 -3
  304. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +3 -0
  305. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +3 -0
  306. package/src/lib/ui/version.ts +3 -3
  307. package/src/lib/ui.css +409 -292
  308. package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +5 -5
  309. package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +4 -4
  310. package/src/test/A11y.test.tsx +3 -2
  311. package/src/test/ClickManager.test.ts +7 -6
  312. package/src/test/Editor.test.tsx +20 -19
  313. package/src/test/EraserTool.test.ts +184 -13
  314. package/src/test/HandTool.test.ts +10 -9
  315. package/src/test/HighlightShape.test.ts +2 -1
  316. package/src/test/SelectTool.test.ts +3 -2
  317. package/src/test/TLUserPreferences.test.ts +4 -3
  318. package/src/test/TestEditor.ts +13 -15
  319. package/src/test/TldrawEditor.test.tsx +11 -10
  320. package/src/test/ZoomTool.test.ts +7 -6
  321. package/src/test/__snapshots__/drawing.test.ts.snap +2 -2
  322. package/src/test/__snapshots__/groups.test.tsx.snap +6 -6
  323. package/src/test/__snapshots__/resizing.test.ts.snap +2 -2
  324. package/src/test/arrows-megabus.test.tsx +17 -10
  325. package/src/test/bindings.test.tsx +24 -37
  326. package/src/test/bookmark-shapes.test.ts +1 -8
  327. package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +23 -7
  328. package/src/test/commands/__snapshots__/packShapes.test.ts.snap +8 -8
  329. package/src/test/commands/__snapshots__/zoomToFit.test.ts.snap +2 -2
  330. package/src/test/commands/alignShapes.test.tsx +25 -24
  331. package/src/test/commands/animationSpeed.test.ts +2 -1
  332. package/src/test/commands/centerOnPoint.test.ts +3 -2
  333. package/src/test/commands/clipboard.test.ts +3 -2
  334. package/src/test/commands/createShapes.test.ts +2 -1
  335. package/src/test/commands/deleteShapes.test.ts +2 -1
  336. package/src/test/commands/distributeShapes.test.tsx +11 -10
  337. package/src/test/commands/getSvgString.test.ts +2 -1
  338. package/src/test/commands/packShapes.test.ts +5 -4
  339. package/src/test/commands/resizeShape.test.ts +2 -1
  340. package/src/test/commands/rotateShapes.test.ts +7 -6
  341. package/src/test/commands/setCamera.test.ts +4 -3
  342. package/src/test/commands/setCurrentPage.test.ts +3 -2
  343. package/src/test/commands/stackShapes.test.ts +11 -10
  344. package/src/test/commands/stretch.test.tsx +13 -12
  345. package/src/test/createDeepLink.test.tsx +2 -1
  346. package/src/test/cropping.test.ts +3 -2
  347. package/src/test/drawing.test.ts +2 -1
  348. package/src/test/flipShapes.test.ts +4 -3
  349. package/src/test/frames.test.ts +25 -24
  350. package/src/test/getCulledShapes.test.tsx +3 -2
  351. package/src/test/groups.test.tsx +1 -1
  352. package/src/test/handleDeepLink.test.tsx +2 -1
  353. package/src/test/inner-outer-margin.test.ts +315 -0
  354. package/src/test/maxShapes.test.ts +3 -2
  355. package/src/test/modifiers.test.ts +5 -4
  356. package/src/test/navigation.test.ts +12 -11
  357. package/src/test/panning.test.ts +2 -1
  358. package/src/test/perf/perf.test.ts +2 -1
  359. package/src/test/registerDeepLinkListener.test.tsx +10 -9
  360. package/src/test/resizing.test.ts +39 -38
  361. package/src/test/select.test.tsx +4 -3
  362. package/src/test/selection-omnibus.test.ts +11 -10
  363. package/src/test/shapeutils.test.ts +4 -3
  364. package/src/test/translating.test.ts +9 -8
  365. package/tldraw.css +702 -580
@@ -29,6 +29,7 @@ var import_useTranslation = require("../../hooks/useTranslation/useTranslation")
29
29
  var import_TldrawUiButton = require("../primitives/Button/TldrawUiButton");
30
30
  var import_TldrawUiButtonIcon = require("../primitives/Button/TldrawUiButtonIcon");
31
31
  var import_TldrawUiIcon = require("../primitives/TldrawUiIcon");
32
+ var import_layout = require("../primitives/layout");
32
33
  const PeopleMenuItem = (0, import_editor.track)(function PeopleMenuItem2({ userId }) {
33
34
  const editor = (0, import_editor.useEditor)();
34
35
  const msg = (0, import_useTranslation.useTranslation)();
@@ -47,9 +48,9 @@ const PeopleMenuItem = (0, import_editor.track)(function PeopleMenuItem2({ userI
47
48
  const youAreFollowingThem = editor.getInstanceState().followingUserId === userId;
48
49
  if (!presence) return null;
49
50
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
50
- "div",
51
+ import_layout.TldrawUiRow,
51
52
  {
52
- className: "tlui-people-menu__item tlui-buttons__horizontal",
53
+ className: "tlui-people-menu__item",
53
54
  "data-follow": youAreFollowingThem || theyAreFollowingYou,
54
55
  children: [
55
56
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/ui/components/SharePanel/PeopleMenuItem.tsx"],
4
- "sourcesContent": ["import { track, useEditor, usePresence } from '@tldraw/editor'\nimport { useCallback } from 'react'\nimport { useUiEvents } from '../../context/events'\nimport { useTranslation } from '../../hooks/useTranslation/useTranslation'\nimport { TldrawUiButton } from '../primitives/Button/TldrawUiButton'\nimport { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'\nimport { TldrawUiIcon } from '../primitives/TldrawUiIcon'\n\nexport const PeopleMenuItem = track(function PeopleMenuItem({ userId }: { userId: string }) {\n\tconst editor = useEditor()\n\tconst msg = useTranslation()\n\tconst trackEvent = useUiEvents()\n\n\tconst presence = usePresence(userId)\n\n\tconst handleFollowClick = useCallback(() => {\n\t\tif (editor.getInstanceState().followingUserId === userId) {\n\t\t\teditor.stopFollowingUser()\n\t\t\ttrackEvent('stop-following', { source: 'people-menu' })\n\t\t} else {\n\t\t\teditor.startFollowingUser(userId)\n\t\t\ttrackEvent('start-following', { source: 'people-menu' })\n\t\t}\n\t}, [editor, userId, trackEvent])\n\n\tconst theyAreFollowingYou = presence?.followingUserId === editor.user.getId()\n\tconst youAreFollowingThem = editor.getInstanceState().followingUserId === userId\n\n\tif (!presence) return null\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"tlui-people-menu__item tlui-buttons__horizontal\"\n\t\t\tdata-follow={youAreFollowingThem || theyAreFollowingYou}\n\t\t>\n\t\t\t<TldrawUiButton\n\t\t\t\ttype=\"menu\"\n\t\t\t\tclassName=\"tlui-people-menu__item__button\"\n\t\t\t\tonClick={() => editor.zoomToUser(userId)}\n\t\t\t\tonDoubleClick={handleFollowClick}\n\t\t\t>\n\t\t\t\t<TldrawUiIcon label={msg('people-menu.avatar-color')} icon=\"color\" color={presence.color} />\n\t\t\t\t<div className=\"tlui-people-menu__name\">\n\t\t\t\t\t{presence.userName?.trim() || msg('people-menu.anonymous-user')}\n\t\t\t\t</div>\n\t\t\t</TldrawUiButton>\n\t\t\t<TldrawUiButton\n\t\t\t\ttype=\"icon\"\n\t\t\t\tclassName=\"tlui-people-menu__item__follow\"\n\t\t\t\ttitle={\n\t\t\t\t\ttheyAreFollowingYou\n\t\t\t\t\t\t? msg('people-menu.leading')\n\t\t\t\t\t\t: youAreFollowingThem\n\t\t\t\t\t\t\t? msg('people-menu.following')\n\t\t\t\t\t\t\t: msg('people-menu.follow')\n\t\t\t\t}\n\t\t\t\tonClick={handleFollowClick}\n\t\t\t\tdisabled={theyAreFollowingYou}\n\t\t\t>\n\t\t\t\t<TldrawUiButtonIcon\n\t\t\t\t\ticon={theyAreFollowingYou ? 'leading' : youAreFollowingThem ? 'following' : 'follow'}\n\t\t\t\t/>\n\t\t\t</TldrawUiButton>\n\t\t</div>\n\t)\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCG;AAnCH,oBAA8C;AAC9C,mBAA4B;AAC5B,oBAA4B;AAC5B,4BAA+B;AAC/B,4BAA+B;AAC/B,gCAAmC;AACnC,0BAA6B;AAEtB,MAAM,qBAAiB,qBAAM,SAASA,gBAAe,EAAE,OAAO,GAAuB;AAC3F,QAAM,aAAS,yBAAU;AACzB,QAAM,UAAM,sCAAe;AAC3B,QAAM,iBAAa,2BAAY;AAE/B,QAAM,eAAW,2BAAY,MAAM;AAEnC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\nimport { useUiEvents } from '../../context/events'\nimport { useTranslation } from '../../hooks/useTranslation/useTranslation'\nimport { TldrawUiButton } from '../primitives/Button/TldrawUiButton'\nimport { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'\nimport { TldrawUiIcon } from '../primitives/TldrawUiIcon'\nimport { TldrawUiRow } from '../primitives/layout'\n\nexport const PeopleMenuItem = track(function PeopleMenuItem({ userId }: { userId: string }) {\n\tconst editor = useEditor()\n\tconst msg = useTranslation()\n\tconst trackEvent = useUiEvents()\n\n\tconst presence = usePresence(userId)\n\n\tconst handleFollowClick = useCallback(() => {\n\t\tif (editor.getInstanceState().followingUserId === userId) {\n\t\t\teditor.stopFollowingUser()\n\t\t\ttrackEvent('stop-following', { source: 'people-menu' })\n\t\t} else {\n\t\t\teditor.startFollowingUser(userId)\n\t\t\ttrackEvent('start-following', { source: 'people-menu' })\n\t\t}\n\t}, [editor, userId, trackEvent])\n\n\tconst theyAreFollowingYou = presence?.followingUserId === editor.user.getId()\n\tconst youAreFollowingThem = editor.getInstanceState().followingUserId === userId\n\n\tif (!presence) return null\n\n\treturn (\n\t\t<TldrawUiRow\n\t\t\tclassName=\"tlui-people-menu__item\"\n\t\t\tdata-follow={youAreFollowingThem || theyAreFollowingYou}\n\t\t>\n\t\t\t<TldrawUiButton\n\t\t\t\ttype=\"menu\"\n\t\t\t\tclassName=\"tlui-people-menu__item__button\"\n\t\t\t\tonClick={() => editor.zoomToUser(userId)}\n\t\t\t\tonDoubleClick={handleFollowClick}\n\t\t\t>\n\t\t\t\t<TldrawUiIcon label={msg('people-menu.avatar-color')} icon=\"color\" color={presence.color} />\n\t\t\t\t<div className=\"tlui-people-menu__name\">\n\t\t\t\t\t{presence.userName?.trim() || msg('people-menu.anonymous-user')}\n\t\t\t\t</div>\n\t\t\t</TldrawUiButton>\n\t\t\t<TldrawUiButton\n\t\t\t\ttype=\"icon\"\n\t\t\t\tclassName=\"tlui-people-menu__item__follow\"\n\t\t\t\ttitle={\n\t\t\t\t\ttheyAreFollowingYou\n\t\t\t\t\t\t? msg('people-menu.leading')\n\t\t\t\t\t\t: youAreFollowingThem\n\t\t\t\t\t\t\t? msg('people-menu.following')\n\t\t\t\t\t\t\t: msg('people-menu.follow')\n\t\t\t\t}\n\t\t\t\tonClick={handleFollowClick}\n\t\t\t\tdisabled={theyAreFollowingYou}\n\t\t\t>\n\t\t\t\t<TldrawUiButtonIcon\n\t\t\t\t\ticon={theyAreFollowingYou ? 'leading' : youAreFollowingThem ? 'following' : 'follow'}\n\t\t\t\t/>\n\t\t\t</TldrawUiButton>\n\t\t</TldrawUiRow>\n\t)\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCG;AApCH,oBAA8C;AAC9C,mBAA4B;AAC5B,oBAA4B;AAC5B,4BAA+B;AAC/B,4BAA+B;AAC/B,gCAAmC;AACnC,0BAA6B;AAC7B,oBAA4B;AAErB,MAAM,qBAAiB,qBAAM,SAASA,gBAAe,EAAE,OAAO,GAAuB;AAC3F,QAAM,aAAS,yBAAU;AACzB,QAAM,UAAM,sCAAe;AAC3B,QAAM,iBAAa,2BAAY;AAE/B,QAAM,eAAW,2BAAY,MAAM;AAEnC,QAAM,wBAAoB,0BAAY,MAAM;AAC3C,QAAI,OAAO,iBAAiB,EAAE,oBAAoB,QAAQ;AACzD,aAAO,kBAAkB;AACzB,iBAAW,kBAAkB,EAAE,QAAQ,cAAc,CAAC;AAAA,IACvD,OAAO;AACN,aAAO,mBAAmB,MAAM;AAChC,iBAAW,mBAAmB,EAAE,QAAQ,cAAc,CAAC;AAAA,IACxD;AAAA,EACD,GAAG,CAAC,QAAQ,QAAQ,UAAU,CAAC;AAE/B,QAAM,sBAAsB,UAAU,oBAAoB,OAAO,KAAK,MAAM;AAC5E,QAAM,sBAAsB,OAAO,iBAAiB,EAAE,oBAAoB;AAE1E,MAAI,CAAC,SAAU,QAAO;AAEtB,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,eAAa,uBAAuB;AAAA,MAEpC;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS,MAAM,OAAO,WAAW,MAAM;AAAA,YACvC,eAAe;AAAA,YAEf;AAAA,0DAAC,oCAAa,OAAO,IAAI,0BAA0B,GAAG,MAAK,SAAQ,OAAO,SAAS,OAAO;AAAA,cAC1F,4CAAC,SAAI,WAAU,0BACb,mBAAS,UAAU,KAAK,KAAK,IAAI,4BAA4B,GAC/D;AAAA;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,MAAK;AAAA,YACL,WAAU;AAAA,YACV,OACC,sBACG,IAAI,qBAAqB,IACzB,sBACC,IAAI,uBAAuB,IAC3B,IAAI,oBAAoB;AAAA,YAE7B,SAAS;AAAA,YACT,UAAU;AAAA,YAEV;AAAA,cAAC;AAAA;AAAA,gBACA,MAAM,sBAAsB,YAAY,sBAAsB,cAAc;AAAA;AAAA,YAC7E;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD;AAEF,CAAC;",
6
6
  "names": ["PeopleMenuItem"]
7
7
  }
@@ -39,6 +39,7 @@ var import_events = require("../../context/events");
39
39
  var import_useTranslation = require("../../hooks/useTranslation/useTranslation");
40
40
  var import_TldrawUiButton = require("../primitives/Button/TldrawUiButton");
41
41
  var import_TldrawUiButtonIcon = require("../primitives/Button/TldrawUiButtonIcon");
42
+ var import_layout = require("../primitives/layout");
42
43
  const UserPresenceColorPicker = (0, import_editor.track)(function UserPresenceColorPicker2() {
43
44
  const editor = (0, import_editor.useEditor)();
44
45
  const container = (0, import_editor.useContainer)();
@@ -117,7 +118,7 @@ const UserPresenceColorPicker = (0, import_editor.track)(function UserPresenceCo
117
118
  align: "start",
118
119
  side: "left",
119
120
  sideOffset: 8,
120
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tlui-buttons__grid", children: import_editor.USER_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
121
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.TldrawUiGrid, { children: import_editor.USER_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
121
122
  import_TldrawUiButton.TldrawUiButton,
122
123
  {
123
124
  type: "icon",
@@ -126,7 +127,6 @@ const UserPresenceColorPicker = (0, import_editor.track)(function UserPresenceCo
126
127
  "aria-label": item,
127
128
  isActive: value === item,
128
129
  title: item,
129
- className: "tlui-button-grid__button",
130
130
  style: { color: item },
131
131
  onPointerEnter: handleButtonPointerEnter,
132
132
  onPointerDown: handleButtonPointerDown,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx"],
4
- "sourcesContent": ["import { USER_COLORS, track, useContainer, useEditor } from '@tldraw/editor'\nimport { Popover as _Popover } from 'radix-ui'\nimport React, { useCallback, useRef, useState } from 'react'\nimport { useUiEvents } from '../../context/events'\nimport { useTranslation } from '../../hooks/useTranslation/useTranslation'\nimport { TldrawUiButton } from '../primitives/Button/TldrawUiButton'\nimport { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'\n\nexport const UserPresenceColorPicker = track(function UserPresenceColorPicker() {\n\tconst editor = useEditor()\n\tconst container = useContainer()\n\tconst msg = useTranslation()\n\tconst trackEvent = useUiEvents()\n\n\tconst rPointing = useRef(false)\n\n\tconst [isOpen, setIsOpen] = useState(false)\n\tconst handleOpenChange = useCallback((isOpen: boolean) => {\n\t\tsetIsOpen(isOpen)\n\t}, [])\n\n\tconst value = editor.user.getColor()\n\n\tconst onValueChange = useCallback(\n\t\t(item: string) => {\n\t\t\teditor.user.updateUserPreferences({ color: item })\n\t\t\ttrackEvent('set-color', { source: 'people-menu' })\n\t\t},\n\t\t[editor, trackEvent]\n\t)\n\n\tconst {\n\t\thandleButtonClick,\n\t\thandleButtonPointerDown,\n\t\thandleButtonPointerEnter,\n\t\thandleButtonPointerUp,\n\t} = React.useMemo(() => {\n\t\tconst handlePointerUp = () => {\n\t\t\trPointing.current = false\n\t\t\twindow.removeEventListener('pointerup', handlePointerUp)\n\t\t}\n\n\t\tconst handleButtonClick = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tif (value === id) return\n\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\tconst handleButtonPointerDown = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\n\t\t\tonValueChange(id)\n\n\t\t\trPointing.current = true\n\t\t\twindow.addEventListener('pointerup', handlePointerUp) // see TLD-658\n\t\t}\n\n\t\tconst handleButtonPointerEnter = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tif (!rPointing.current) return\n\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\tconst handleButtonPointerUp = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\treturn {\n\t\t\thandleButtonClick,\n\t\t\thandleButtonPointerDown,\n\t\t\thandleButtonPointerEnter,\n\t\t\thandleButtonPointerUp,\n\t\t}\n\t}, [value, onValueChange])\n\n\treturn (\n\t\t<_Popover.Root onOpenChange={handleOpenChange} open={isOpen}>\n\t\t\t<_Popover.Trigger dir=\"ltr\" asChild>\n\t\t\t\t<TldrawUiButton\n\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\tclassName=\"tlui-people-menu__user__color\"\n\t\t\t\t\tstyle={{ color: editor.user.getColor() }}\n\t\t\t\t\ttitle={msg('people-menu.change-color')}\n\t\t\t\t>\n\t\t\t\t\t<TldrawUiButtonIcon icon=\"color\" />\n\t\t\t\t</TldrawUiButton>\n\t\t\t</_Popover.Trigger>\n\t\t\t<_Popover.Portal container={container}>\n\t\t\t\t<_Popover.Content\n\t\t\t\t\tdir=\"ltr\"\n\t\t\t\t\tclassName=\"tlui-menu tlui-people-menu__user__color-picker\"\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tside=\"left\"\n\t\t\t\t\tsideOffset={8}\n\t\t\t\t>\n\t\t\t\t\t<div className={'tlui-buttons__grid'}>\n\t\t\t\t\t\t{USER_COLORS.map((item: string) => (\n\t\t\t\t\t\t\t<TldrawUiButton\n\t\t\t\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\t\t\t\tkey={item}\n\t\t\t\t\t\t\t\tdata-id={item}\n\t\t\t\t\t\t\t\tdata-testid={item}\n\t\t\t\t\t\t\t\taria-label={item}\n\t\t\t\t\t\t\t\tisActive={value === item}\n\t\t\t\t\t\t\t\ttitle={item}\n\t\t\t\t\t\t\t\tclassName={'tlui-button-grid__button'}\n\t\t\t\t\t\t\t\tstyle={{ color: item }}\n\t\t\t\t\t\t\t\tonPointerEnter={handleButtonPointerEnter}\n\t\t\t\t\t\t\t\tonPointerDown={handleButtonPointerDown}\n\t\t\t\t\t\t\t\tonPointerUp={handleButtonPointerUp}\n\t\t\t\t\t\t\t\tonClick={handleButtonClick}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TldrawUiButtonIcon icon=\"color\" />\n\t\t\t\t\t\t\t</TldrawUiButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</_Popover.Content>\n\t\t\t</_Popover.Portal>\n\t\t</_Popover.Root>\n\t)\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmFE;AAnFF,oBAA4D;AAC5D,sBAAoC;AACpC,mBAAqD;AACrD,oBAA4B;AAC5B,4BAA+B;AAC/B,4BAA+B;AAC/B,gCAAmC;AAE5B,MAAM,8BAA0B,q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",
4
+ "sourcesContent": ["import { USER_COLORS, track, useContainer, useEditor } from '@tldraw/editor'\nimport { Popover as _Popover } from 'radix-ui'\nimport React, { useCallback, useRef, useState } from 'react'\nimport { useUiEvents } from '../../context/events'\nimport { useTranslation } from '../../hooks/useTranslation/useTranslation'\nimport { TldrawUiButton } from '../primitives/Button/TldrawUiButton'\nimport { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'\nimport { TldrawUiGrid } from '../primitives/layout'\n\nexport const UserPresenceColorPicker = track(function UserPresenceColorPicker() {\n\tconst editor = useEditor()\n\tconst container = useContainer()\n\tconst msg = useTranslation()\n\tconst trackEvent = useUiEvents()\n\n\tconst rPointing = useRef(false)\n\n\tconst [isOpen, setIsOpen] = useState(false)\n\tconst handleOpenChange = useCallback((isOpen: boolean) => {\n\t\tsetIsOpen(isOpen)\n\t}, [])\n\n\tconst value = editor.user.getColor()\n\n\tconst onValueChange = useCallback(\n\t\t(item: string) => {\n\t\t\teditor.user.updateUserPreferences({ color: item })\n\t\t\ttrackEvent('set-color', { source: 'people-menu' })\n\t\t},\n\t\t[editor, trackEvent]\n\t)\n\n\tconst {\n\t\thandleButtonClick,\n\t\thandleButtonPointerDown,\n\t\thandleButtonPointerEnter,\n\t\thandleButtonPointerUp,\n\t} = React.useMemo(() => {\n\t\tconst handlePointerUp = () => {\n\t\t\trPointing.current = false\n\t\t\twindow.removeEventListener('pointerup', handlePointerUp)\n\t\t}\n\n\t\tconst handleButtonClick = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tif (value === id) return\n\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\tconst handleButtonPointerDown = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\n\t\t\tonValueChange(id)\n\n\t\t\trPointing.current = true\n\t\t\twindow.addEventListener('pointerup', handlePointerUp) // see TLD-658\n\t\t}\n\n\t\tconst handleButtonPointerEnter = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tif (!rPointing.current) return\n\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\tconst handleButtonPointerUp = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\treturn {\n\t\t\thandleButtonClick,\n\t\t\thandleButtonPointerDown,\n\t\t\thandleButtonPointerEnter,\n\t\t\thandleButtonPointerUp,\n\t\t}\n\t}, [value, onValueChange])\n\n\treturn (\n\t\t<_Popover.Root onOpenChange={handleOpenChange} open={isOpen}>\n\t\t\t<_Popover.Trigger dir=\"ltr\" asChild>\n\t\t\t\t<TldrawUiButton\n\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\tclassName=\"tlui-people-menu__user__color\"\n\t\t\t\t\tstyle={{ color: editor.user.getColor() }}\n\t\t\t\t\ttitle={msg('people-menu.change-color')}\n\t\t\t\t>\n\t\t\t\t\t<TldrawUiButtonIcon icon=\"color\" />\n\t\t\t\t</TldrawUiButton>\n\t\t\t</_Popover.Trigger>\n\t\t\t<_Popover.Portal container={container}>\n\t\t\t\t<_Popover.Content\n\t\t\t\t\tdir=\"ltr\"\n\t\t\t\t\tclassName=\"tlui-menu tlui-people-menu__user__color-picker\"\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tside=\"left\"\n\t\t\t\t\tsideOffset={8}\n\t\t\t\t>\n\t\t\t\t\t<TldrawUiGrid>\n\t\t\t\t\t\t{USER_COLORS.map((item: string) => (\n\t\t\t\t\t\t\t<TldrawUiButton\n\t\t\t\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\t\t\t\tkey={item}\n\t\t\t\t\t\t\t\tdata-id={item}\n\t\t\t\t\t\t\t\tdata-testid={item}\n\t\t\t\t\t\t\t\taria-label={item}\n\t\t\t\t\t\t\t\tisActive={value === item}\n\t\t\t\t\t\t\t\ttitle={item}\n\t\t\t\t\t\t\t\tstyle={{ color: item }}\n\t\t\t\t\t\t\t\tonPointerEnter={handleButtonPointerEnter}\n\t\t\t\t\t\t\t\tonPointerDown={handleButtonPointerDown}\n\t\t\t\t\t\t\t\tonPointerUp={handleButtonPointerUp}\n\t\t\t\t\t\t\t\tonClick={handleButtonClick}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TldrawUiButtonIcon icon=\"color\" />\n\t\t\t\t\t\t\t</TldrawUiButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</TldrawUiGrid>\n\t\t\t\t</_Popover.Content>\n\t\t\t</_Popover.Portal>\n\t\t</_Popover.Root>\n\t)\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoFE;AApFF,oBAA4D;AAC5D,sBAAoC;AACpC,mBAAqD;AACrD,oBAA4B;AAC5B,4BAA+B;AAC/B,4BAA+B;AAC/B,gCAAmC;AACnC,oBAA6B;AAEtB,MAAM,8BAA0B,qBAAM,SAASA,2BAA0B;AAC/E,QAAM,aAAS,yBAAU;AACzB,QAAM,gBAAY,4BAAa;AAC/B,QAAM,UAAM,sCAAe;AAC3B,QAAM,iBAAa,2BAAY;AAE/B,QAAM,gBAAY,qBAAO,KAAK;AAE9B,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAC1C,QAAM,uBAAmB,0BAAY,CAACC,YAAoB;AACzD,cAAUA,OAAM;AAAA,EACjB,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ,OAAO,KAAK,SAAS;AAEnC,QAAM,oBAAgB;AAAA,IACrB,CAAC,SAAiB;AACjB,aAAO,KAAK,sBAAsB,EAAE,OAAO,KAAK,CAAC;AACjD,iBAAW,aAAa,EAAE,QAAQ,cAAc,CAAC;AAAA,IAClD;AAAA,IACA,CAAC,QAAQ,U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AA,QACvC,OAAO,IAAI,0BAA0B;AAAA,QAErC,sDAAC,gDAAmB,MAAK,SAAQ;AAAA;AAAA,IAClC,GACD;AAAA,IACA,4CAAC,gBAAAA,QAAS,QAAT,EAAgB,WAChB;AAAA,MAAC,gBAAAA,QAAS;AAAA,MAAT;AAAA,QACA,KAAI;AAAA,QACJ,WAAU;AAAA,QACV,OAAM;AAAA,QACN,MAAK;AAAA,QACL,YAAY;AAAA,QAEZ,sDAAC,8BACC,oCAAY,IAAI,CAAC,SACjB;AAAA,UAAC;AAAA;AAAA,YACA,MAAK;AAAA,YAEL,WAAS;AAAA,YACT,eAAa;AAAA,YACb,cAAY;AAAA,YACZ,UAAU,UAAU;AAAA,YACpB,OAAO;AAAA,YACP,OAAO,EAAE,OAAO,KAAK;AAAA,YACrB,gBAAgB;AAAA,YAChB,eAAe;AAAA,YACf,aAAa;AAAA,YACb,SAAS;AAAA,YAET,sDAAC,gDAAmB,MAAK,SAAQ;AAAA;AAAA,UAZ5B;AAAA,QAaN,CACA,GACF;AAAA;AAAA,IACD,GACD;AAAA,KACD;AAEF,CAAC;",
6
6
  "names": ["UserPresenceColorPicker", "isOpen", "React", "handleButtonClick", "handleButtonPointerDown", "handleButtonPointerEnter", "handleButtonPointerUp", "_Popover"]
7
7
  }
@@ -42,6 +42,7 @@ const DefaultStylePanel = (0, import_react.memo)(function DefaultStylePanel2({
42
42
  children
43
43
  }) {
44
44
  const editor = (0, import_editor.useEditor)();
45
+ const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
45
46
  const ref = (0, import_react.useRef)(null);
46
47
  (0, import_editor.usePassThroughWheelEvents)(ref);
47
48
  const styles = (0, import_useRelevantStyles.useRelevantStyles)();
@@ -70,6 +71,7 @@ const DefaultStylePanel = (0, import_react.memo)(function DefaultStylePanel2({
70
71
  ref,
71
72
  className: (0, import_classnames.default)("tlui-style-panel", { "tlui-style-panel__wrapper": !isMobile }),
72
73
  "data-ismobile": isMobile,
74
+ "data-show-ui-labels": showUiLabels,
73
75
  onPointerLeave: handlePointerOut,
74
76
  children: content
75
77
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/ui/components/StylePanel/DefaultStylePanel.tsx"],
4
- "sourcesContent": ["import { useEditor, usePassThroughWheelEvents } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { ReactNode, memo, useCallback, useEffect, useRef } from 'react'\nimport { useRelevantStyles } from '../../hooks/useRelevantStyles'\nimport { DefaultStylePanelContent } from './DefaultStylePanelContent'\n\n/** @public */\nexport interface TLUiStylePanelProps {\n\tisMobile?: boolean\n\tchildren?: ReactNode\n}\n\n/** @public @react */\nexport const DefaultStylePanel = memo(function DefaultStylePanel({\n\tisMobile,\n\tchildren,\n}: TLUiStylePanelProps) {\n\tconst editor = useEditor()\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst styles = useRelevantStyles()\n\n\tconst handlePointerOut = useCallback(() => {\n\t\tif (!isMobile) {\n\t\t\teditor.updateInstanceState({ isChangingStyle: false })\n\t\t}\n\t}, [editor, isMobile])\n\n\tconst content = children ?? <DefaultStylePanelContent styles={styles} />\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.key === 'Escape' && ref.current?.contains(document.activeElement)) {\n\t\t\t\tevent.stopPropagation()\n\t\t\t\teditor.getContainer().focus()\n\t\t\t}\n\t\t}\n\n\t\tconst stylePanelContainerEl = ref.current\n\t\tstylePanelContainerEl?.addEventListener('keydown', handleKeyDown, { capture: true })\n\t\treturn () => {\n\t\t\tstylePanelContainerEl?.removeEventListener('keydown', handleKeyDown, { capture: true })\n\t\t}\n\t}, [editor])\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={classNames('tlui-style-panel', { 'tlui-style-panel__wrapper': !isMobile })}\n\t\t\tdata-ismobile={isMobile}\n\t\t\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ditor, usePassThroughWheelEvents, useValue } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { ReactNode, memo, useCallback, useEffect, useRef } from 'react'\nimport { useRelevantStyles } from '../../hooks/useRelevantStyles'\nimport { DefaultStylePanelContent } from './DefaultStylePanelContent'\n\n/** @public */\nexport interface TLUiStylePanelProps {\n\tisMobile?: boolean\n\tchildren?: ReactNode\n}\n\n/** @public @react */\nexport const DefaultStylePanel = memo(function DefaultStylePanel({\n\tisMobile,\n\tchildren,\n}: TLUiStylePanelProps) {\n\tconst editor = useEditor()\n\tconst showUiLabels = useValue('showUiLabels', () => editor.user.getShowUiLabels(), [editor])\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst styles = useRelevantStyles()\n\n\tconst handlePointerOut = useCallback(() => {\n\t\tif (!isMobile) {\n\t\t\teditor.updateInstanceState({ isChangingStyle: false })\n\t\t}\n\t}, [editor, isMobile])\n\n\tconst content = children ?? <DefaultStylePanelContent styles={styles} />\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.key === 'Escape' && ref.current?.contains(document.activeElement)) {\n\t\t\t\tevent.stopPropagation()\n\t\t\t\teditor.getContainer().focus()\n\t\t\t}\n\t\t}\n\n\t\tconst stylePanelContainerEl = ref.current\n\t\tstylePanelContainerEl?.addEventListener('keydown', handleKeyDown, { capture: true })\n\t\treturn () => {\n\t\t\tstylePanelContainerEl?.removeEventListener('keydown', handleKeyDown, { capture: true })\n\t\t}\n\t}, [editor])\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={classNames('tlui-style-panel', { 'tlui-style-panel__wrapper': !isMobile })}\n\t\t\tdata-ismobile={isMobile}\n\t\t\tdata-show-ui-labels={showUiLabels}\n\t\t\tonPointerLeave={handlePointerOut}\n\t\t>\n\t\t\t{content}\n\t\t</div>\n\t)\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;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el", "classNames"]
7
7
  }
@@ -50,6 +50,9 @@ var import_TldrawUiSlider = require("../primitives/TldrawUiSlider");
50
50
  var import_TldrawUiToolbar = require("../primitives/TldrawUiToolbar");
51
51
  var import_DoubleDropdownPicker = require("./DoubleDropdownPicker");
52
52
  var import_DropdownPicker = require("./DropdownPicker");
53
+ function StylePanelSubheading({ children }) {
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "tlui-style-panel__subheading", children });
55
+ }
53
56
  function DefaultStylePanelContent({ styles }) {
54
57
  const isDarkMode = (0, import_editor.useIsDarkMode)();
55
58
  if (!styles) return null;
@@ -97,6 +100,7 @@ function CommonStylePickerSet({ styles, theme }) {
97
100
  const msg = (0, import_useTranslation.useTranslation)();
98
101
  const editor = (0, import_editor.useEditor)();
99
102
  const onHistoryMark = (0, import_react.useCallback)((id) => editor.markHistoryStoppingPoint(id), [editor]);
103
+ const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
100
104
  const handleValueChange = useStyleChangeCallback();
101
105
  const color = styles.get(import_editor.DefaultColorStyle);
102
106
  const fill = styles.get(import_editor.DefaultFillStyle);
@@ -105,67 +109,79 @@ function CommonStylePickerSet({ styles, theme }) {
105
109
  const showPickers = fill !== void 0 || dash !== void 0 || size !== void 0;
106
110
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
107
111
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-style-panel__section__common", "data-testid": "style.panel", children: [
108
- color === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.color"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
109
- import_TldrawUiButtonPicker.TldrawUiButtonPicker,
110
- {
111
- title: msg("style-panel.color"),
112
- uiType: "color",
113
- style: import_editor.DefaultColorStyle,
114
- items: import_styles.STYLES.color,
115
- value: color,
116
- onValueChange: handleValueChange,
117
- theme,
118
- onHistoryMark
119
- }
120
- ) }),
112
+ color === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
113
+ showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.color") }),
114
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.color"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
115
+ import_TldrawUiButtonPicker.TldrawUiButtonPicker,
116
+ {
117
+ title: msg("style-panel.color"),
118
+ uiType: "color",
119
+ style: import_editor.DefaultColorStyle,
120
+ items: import_styles.STYLES.color,
121
+ value: color,
122
+ onValueChange: handleValueChange,
123
+ theme,
124
+ onHistoryMark
125
+ }
126
+ ) })
127
+ ] }),
121
128
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OpacitySlider, {})
122
129
  ] }),
123
130
  showPickers && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-style-panel__section", children: [
124
- fill === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.fill"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
- import_TldrawUiButtonPicker.TldrawUiButtonPicker,
126
- {
127
- title: msg("style-panel.fill"),
128
- uiType: "fill",
129
- style: import_editor.DefaultFillStyle,
130
- items: import_styles.STYLES.fill,
131
- value: fill,
132
- onValueChange: handleValueChange,
133
- theme,
134
- onHistoryMark
135
- }
136
- ) }),
137
- dash === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.dash"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
- import_TldrawUiButtonPicker.TldrawUiButtonPicker,
139
- {
140
- title: msg("style-panel.dash"),
141
- uiType: "dash",
142
- style: import_editor.DefaultDashStyle,
143
- items: import_styles.STYLES.dash,
144
- value: dash,
145
- onValueChange: handleValueChange,
146
- theme,
147
- onHistoryMark
148
- }
149
- ) }),
150
- size === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.size"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
151
- import_TldrawUiButtonPicker.TldrawUiButtonPicker,
152
- {
153
- title: msg("style-panel.size"),
154
- uiType: "size",
155
- style: import_editor.DefaultSizeStyle,
156
- items: import_styles.STYLES.size,
157
- value: size,
158
- onValueChange: (style, value) => {
159
- handleValueChange(style, value);
160
- const selectedShapeIds = editor.getSelectedShapeIds();
161
- if (selectedShapeIds.length > 0) {
162
- (0, import_editor.kickoutOccludedShapes)(editor, selectedShapeIds);
163
- }
164
- },
165
- theme,
166
- onHistoryMark
167
- }
168
- ) })
131
+ fill === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
132
+ showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.fill") }),
133
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.fill"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
134
+ import_TldrawUiButtonPicker.TldrawUiButtonPicker,
135
+ {
136
+ title: msg("style-panel.fill"),
137
+ uiType: "fill",
138
+ style: import_editor.DefaultFillStyle,
139
+ items: import_styles.STYLES.fill,
140
+ value: fill,
141
+ onValueChange: handleValueChange,
142
+ theme,
143
+ onHistoryMark
144
+ }
145
+ ) })
146
+ ] }),
147
+ dash === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
148
+ showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.dash") }),
149
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.dash"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
150
+ import_TldrawUiButtonPicker.TldrawUiButtonPicker,
151
+ {
152
+ title: msg("style-panel.dash"),
153
+ uiType: "dash",
154
+ style: import_editor.DefaultDashStyle,
155
+ items: import_styles.STYLES.dash,
156
+ value: dash,
157
+ onValueChange: handleValueChange,
158
+ theme,
159
+ onHistoryMark
160
+ }
161
+ ) })
162
+ ] }),
163
+ size === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
164
+ showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.size") }),
165
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.size"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
166
+ import_TldrawUiButtonPicker.TldrawUiButtonPicker,
167
+ {
168
+ title: msg("style-panel.size"),
169
+ uiType: "size",
170
+ style: import_editor.DefaultSizeStyle,
171
+ items: import_styles.STYLES.size,
172
+ value: size,
173
+ onValueChange: (style, value) => {
174
+ handleValueChange(style, value);
175
+ const selectedShapeIds = editor.getSelectedShapeIds();
176
+ if (selectedShapeIds.length > 0) {
177
+ (0, import_editor.kickoutOccludedShapes)(editor, selectedShapeIds);
178
+ }
179
+ },
180
+ theme,
181
+ onHistoryMark
182
+ }
183
+ ) })
184
+ ] })
169
185
  ] })
170
186
  ] });
171
187
  }
@@ -174,6 +190,8 @@ function TextStylePickerSet({ theme, styles }) {
174
190
  const handleValueChange = useStyleChangeCallback();
175
191
  const editor = (0, import_editor.useEditor)();
176
192
  const onHistoryMark = (0, import_react.useCallback)((id) => editor.markHistoryStoppingPoint(id), [editor]);
193
+ const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
194
+ const labelStr = showUiLabels && msg("style-panel.font");
177
195
  const font = styles.get(import_editor.DefaultFontStyle);
178
196
  const textAlign = styles.get(import_editor.DefaultTextAlignStyle);
179
197
  const labelAlign = styles.get(import_editor.DefaultHorizontalAlignStyle);
@@ -182,80 +200,89 @@ function TextStylePickerSet({ theme, styles }) {
182
200
  return null;
183
201
  }
184
202
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-style-panel__section", children: [
185
- font === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.font"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
186
- import_TldrawUiButtonPicker.TldrawUiButtonPicker,
187
- {
188
- title: msg("style-panel.font"),
189
- uiType: "font",
190
- style: import_editor.DefaultFontStyle,
191
- items: import_styles.STYLES.font,
192
- value: font,
193
- onValueChange: handleValueChange,
194
- theme,
195
- onHistoryMark
196
- }
197
- ) }),
198
- textAlign === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.align"), className: "tlui-style-panel__row", children: [
199
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
203
+ font === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
204
+ labelStr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: labelStr }),
205
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.font"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
200
206
  import_TldrawUiButtonPicker.TldrawUiButtonPicker,
201
207
  {
202
- title: msg("style-panel.align"),
203
- uiType: "align",
204
- style: import_editor.DefaultTextAlignStyle,
205
- items: import_styles.STYLES.textAlign,
206
- value: textAlign,
208
+ title: msg("style-panel.font"),
209
+ uiType: "font",
210
+ style: import_editor.DefaultFontStyle,
211
+ items: import_styles.STYLES.font,
212
+ value: font,
207
213
  onValueChange: handleValueChange,
208
214
  theme,
209
215
  onHistoryMark
210
216
  }
211
- ),
212
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tlui-style-panel__row__extra-button", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
213
- import_TldrawUiToolbar.TldrawUiToolbarButton,
214
- {
215
- type: "icon",
216
- title: msg("style-panel.vertical-align"),
217
- "data-testid": "vertical-align",
218
- disabled: true,
219
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
220
- }
221
217
  ) })
222
218
  ] }),
223
- labelAlign === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.label-align"), className: "tlui-style-panel__row", children: [
224
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
225
- import_TldrawUiButtonPicker.TldrawUiButtonPicker,
226
- {
227
- title: msg("style-panel.label-align"),
228
- uiType: "align",
229
- style: import_editor.DefaultHorizontalAlignStyle,
230
- items: import_styles.STYLES.horizontalAlign,
231
- value: labelAlign,
232
- onValueChange: handleValueChange,
233
- theme,
234
- onHistoryMark
235
- }
236
- ),
237
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tlui-style-panel__row__extra-button", children: verticalLabelAlign === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
238
- import_TldrawUiToolbar.TldrawUiToolbarButton,
239
- {
240
- type: "icon",
241
- title: msg("style-panel.vertical-align"),
242
- "data-testid": "vertical-align",
243
- disabled: true,
244
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
245
- }
246
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
247
- import_DropdownPicker.DropdownPicker,
248
- {
249
- type: "icon",
250
- id: "geo-vertical-alignment",
251
- uiType: "verticalAlign",
252
- stylePanelType: "vertical-align",
253
- style: import_editor.DefaultVerticalAlignStyle,
254
- items: import_styles.STYLES.verticalAlign,
255
- value: verticalLabelAlign,
256
- onValueChange: handleValueChange
257
- }
258
- ) })
219
+ textAlign === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
220
+ showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.align") }),
221
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.align"), children: [
222
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
223
+ import_TldrawUiButtonPicker.TldrawUiButtonPicker,
224
+ {
225
+ title: msg("style-panel.align"),
226
+ uiType: "align",
227
+ style: import_editor.DefaultTextAlignStyle,
228
+ items: import_styles.STYLES.textAlign,
229
+ value: textAlign,
230
+ onValueChange: handleValueChange,
231
+ theme,
232
+ onHistoryMark
233
+ }
234
+ ),
235
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
236
+ import_TldrawUiToolbar.TldrawUiToolbarButton,
237
+ {
238
+ type: "icon",
239
+ title: msg("style-panel.vertical-align"),
240
+ "data-testid": "vertical-align",
241
+ disabled: true,
242
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
243
+ }
244
+ )
245
+ ] })
246
+ ] }),
247
+ labelAlign === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
248
+ showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.label-align") }),
249
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.label-align"), children: [
250
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
251
+ import_TldrawUiButtonPicker.TldrawUiButtonPicker,
252
+ {
253
+ title: msg("style-panel.label-align"),
254
+ uiType: "align",
255
+ style: import_editor.DefaultHorizontalAlignStyle,
256
+ items: import_styles.STYLES.horizontalAlign,
257
+ value: labelAlign,
258
+ onValueChange: handleValueChange,
259
+ theme,
260
+ onHistoryMark
261
+ }
262
+ ),
263
+ verticalLabelAlign === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
264
+ import_TldrawUiToolbar.TldrawUiToolbarButton,
265
+ {
266
+ type: "icon",
267
+ title: msg("style-panel.vertical-align"),
268
+ "data-testid": "vertical-align",
269
+ disabled: true,
270
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
271
+ }
272
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
273
+ import_DropdownPicker.DropdownPicker,
274
+ {
275
+ type: "icon",
276
+ id: "geo-vertical-alignment",
277
+ uiType: "verticalAlign",
278
+ stylePanelType: "vertical-align",
279
+ style: import_editor.DefaultVerticalAlignStyle,
280
+ items: import_styles.STYLES.verticalAlign,
281
+ value: verticalLabelAlign,
282
+ onValueChange: handleValueChange
283
+ }
284
+ )
285
+ ] })
259
286
  ] })
260
287
  ] });
261
288
  }
@@ -266,7 +293,7 @@ function GeoStylePickerSet({ styles }) {
266
293
  if (geo === void 0) {
267
294
  return null;
268
295
  }
269
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.geo"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
296
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.geo"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
270
297
  import_DropdownPicker.DropdownPicker,
271
298
  {
272
299
  id: "geo",
@@ -288,7 +315,7 @@ function SplineStylePickerSet({ styles }) {
288
315
  if (spline === void 0) {
289
316
  return null;
290
317
  }
291
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.spline"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
318
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.spline"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
292
319
  import_DropdownPicker.DropdownPicker,
293
320
  {
294
321
  id: "spline",
@@ -310,7 +337,7 @@ function ArrowStylePickerSet({ styles }) {
310
337
  if (arrowKind === void 0) {
311
338
  return null;
312
339
  }
313
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.arrow-kind"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
340
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.arrow-kind"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
314
341
  import_DropdownPicker.DropdownPicker,
315
342
  {
316
343
  id: "arrow-kind",
@@ -354,6 +381,7 @@ const tldrawSupportedOpacities = [0.1, 0.25, 0.5, 0.75, 1];
354
381
  function OpacitySlider() {
355
382
  const editor = (0, import_editor.useEditor)();
356
383
  const onHistoryMark = (0, import_react.useCallback)((id) => editor.markHistoryStoppingPoint(id), [editor]);
384
+ const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
357
385
  const opacity = (0, import_editor.useValue)("opacity", () => editor.getSharedOpacity(), [editor]);
358
386
  const trackEvent = (0, import_events.useUiEvents)();
359
387
  const msg = (0, import_useTranslation.useTranslation)();
@@ -378,18 +406,21 @@ function OpacitySlider() {
378
406
  (supportedOpacity) => Math.abs(supportedOpacity - opacity.value)
379
407
  )
380
408
  );
381
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
382
- import_TldrawUiSlider.TldrawUiSlider,
383
- {
384
- "data-testid": "style.opacity",
385
- value: opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1,
386
- label: opacity.type === "mixed" ? "style-panel.mixed" : `opacity-style.${opacity.value}`,
387
- onValueChange: handleOpacityValueChange,
388
- steps: tldrawSupportedOpacities.length - 1,
389
- title: msg("style-panel.opacity"),
390
- onHistoryMark,
391
- ariaValueModifier: 25
392
- }
393
- );
409
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
410
+ showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.opacity") }),
411
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
412
+ import_TldrawUiSlider.TldrawUiSlider,
413
+ {
414
+ "data-testid": "style.opacity",
415
+ value: opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1,
416
+ label: opacity.type === "mixed" ? "style-panel.mixed" : `opacity-style.${opacity.value}`,
417
+ onValueChange: handleOpacityValueChange,
418
+ steps: tldrawSupportedOpacities.length - 1,
419
+ title: msg("style-panel.opacity"),
420
+ onHistoryMark,
421
+ ariaValueModifier: 25
422
+ }
423
+ )
424
+ ] });
394
425
  }
395
426
  //# sourceMappingURL=DefaultStylePanelContent.js.map