tldraw 3.16.0-canary.6f3aedaa1c01 → 3.16.0-canary.7f4043b128a3

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 (60) hide show
  1. package/dist-cjs/index.d.ts +42 -3
  2. package/dist-cjs/index.js +4 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/ui/TldrawUi.js +14 -0
  5. package/dist-cjs/lib/ui/TldrawUi.js.map +3 -3
  6. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js +10 -2
  7. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js.map +2 -2
  8. package/dist-cjs/lib/ui/components/MobileStylePanel.js +3 -1
  9. package/dist-cjs/lib/ui/components/MobileStylePanel.js.map +2 -2
  10. package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js +66 -22
  11. package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js.map +3 -3
  12. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +188 -78
  13. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +3 -3
  14. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +15 -3
  15. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
  16. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +84 -77
  17. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
  18. package/dist-cjs/lib/ui/components/primitives/layout.js +30 -5
  19. package/dist-cjs/lib/ui/components/primitives/layout.js.map +2 -2
  20. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js +30 -7
  21. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js.map +2 -2
  22. package/dist-cjs/lib/ui/version.js +3 -3
  23. package/dist-cjs/lib/ui/version.js.map +1 -1
  24. package/dist-esm/index.d.mts +42 -3
  25. package/dist-esm/index.mjs +8 -2
  26. package/dist-esm/index.mjs.map +2 -2
  27. package/dist-esm/lib/ui/TldrawUi.mjs +16 -2
  28. package/dist-esm/lib/ui/TldrawUi.mjs.map +3 -3
  29. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +10 -2
  30. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
  31. package/dist-esm/lib/ui/components/MobileStylePanel.mjs +3 -1
  32. package/dist-esm/lib/ui/components/MobileStylePanel.mjs.map +2 -2
  33. package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs +56 -22
  34. package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs.map +2 -2
  35. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +192 -80
  36. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +3 -3
  37. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +16 -4
  38. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
  39. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +85 -78
  40. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
  41. package/dist-esm/lib/ui/components/primitives/layout.mjs +31 -6
  42. package/dist-esm/lib/ui/components/primitives/layout.mjs.map +2 -2
  43. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs +30 -7
  44. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs.map +2 -2
  45. package/dist-esm/lib/ui/version.mjs +3 -3
  46. package/dist-esm/lib/ui/version.mjs.map +1 -1
  47. package/package.json +3 -3
  48. package/src/index.ts +5 -0
  49. package/src/lib/ui/TldrawUi.tsx +17 -2
  50. package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +13 -2
  51. package/src/lib/ui/components/MobileStylePanel.tsx +3 -2
  52. package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +55 -24
  53. package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +208 -56
  54. package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +22 -5
  55. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +86 -75
  56. package/src/lib/ui/components/primitives/layout.tsx +79 -5
  57. package/src/lib/ui/components/primitives/menus/TldrawUiMenuGroup.tsx +30 -7
  58. package/src/lib/ui/version.ts +3 -3
  59. package/src/lib/ui.css +127 -23
  60. package/tldraw.css +127 -23
package/tldraw.css CHANGED
@@ -1983,15 +1983,23 @@ it from receiving any pointer events or affecting the cursor. */
1983
1983
 
1984
1984
  .tlui-main-toolbar__lock-button {
1985
1985
  position: absolute;
1986
- top: 4px;
1987
- right: 0px;
1988
1986
  pointer-events: all;
1989
1987
  height: 40px;
1990
1988
  width: 40px;
1991
- min-width: 0px;
1992
1989
  border-radius: var(--radius-2);
1993
1990
  }
1994
1991
 
1992
+ .tlui-main-toolbar--horizontal .tlui-main-toolbar__lock-button {
1993
+ top: 4px;
1994
+ right: 0px;
1995
+ min-width: 0px;
1996
+ }
1997
+
1998
+ .tlui-main-toolbar--vertical .tlui-main-toolbar__lock-button {
1999
+ bottom: 0px;
2000
+ min-height: 0px;
2001
+ }
2002
+
1995
2003
  .tlui-main-toolbar__lock-button::after {
1996
2004
  top: 4px;
1997
2005
  left: 8px;
@@ -2024,12 +2032,12 @@ it from receiving any pointer events or affecting the cursor. */
2024
2032
  opacity: 1;
2025
2033
  }
2026
2034
 
2027
- .tlui-layout__mobile .tlui-button__tool {
2035
+ .tlui-layout__mobile .tlui-main-toolbar--horizontal .tlui-button__tool {
2028
2036
  height: 48px;
2029
2037
  width: 43px;
2030
2038
  }
2031
2039
 
2032
- .tlui-layout__mobile .tlui-button__tool > .tlui-icon {
2040
+ .tlui-layout__mobile .tlui-main-toolbar--horizontal .tlui-button__tool > .tlui-icon {
2033
2041
  height: 16px;
2034
2042
  width: 16px;
2035
2043
  }
@@ -2046,6 +2054,18 @@ it from receiving any pointer events or affecting the cursor. */
2046
2054
  margin-right: -2px;
2047
2055
  }
2048
2056
 
2057
+ /* Column layout */
2058
+
2059
+ .tlui-column {
2060
+ display: flex;
2061
+ flex-direction: column;
2062
+ padding: 2px 0;
2063
+ }
2064
+ .tlui-column > * {
2065
+ margin-top: -2px;
2066
+ margin-bottom: -2px;
2067
+ }
2068
+
2049
2069
  /* Grid layout */
2050
2070
 
2051
2071
  .tlui-grid {
@@ -2837,11 +2857,12 @@ it from receiving any pointer events or affecting the cursor. */
2837
2857
 
2838
2858
  .tlui-layout__bottom {
2839
2859
  grid-row: 2;
2860
+ width: 100%;
2861
+ overflow: hidden;
2840
2862
  }
2841
2863
 
2842
2864
  .tlui-layout__bottom__main {
2843
2865
  width: 100%;
2844
- position: relative;
2845
2866
  display: flex;
2846
2867
  align-items: flex-end;
2847
2868
  justify-content: center;
@@ -2857,7 +2878,6 @@ it from receiving any pointer events or affecting the cursor. */
2857
2878
  pointer-events: all;
2858
2879
  position: absolute;
2859
2880
  left: 0px;
2860
- bottom: 0px;
2861
2881
  }
2862
2882
 
2863
2883
  .tlui-navigation-panel::before {
@@ -2904,7 +2924,23 @@ it from receiving any pointer events or affecting the cursor. */
2904
2924
  align-items: center;
2905
2925
  justify-content: center;
2906
2926
  flex-grow: 2;
2927
+ }
2928
+
2929
+ .tlui-main-toolbar--horizontal {
2907
2930
  padding-bottom: calc(var(--space-3) + var(--sab));
2931
+ max-width: 100%;
2932
+ }
2933
+
2934
+ .tlui-main-toolbar--vertical {
2935
+ position: absolute;
2936
+ left: 0;
2937
+ top: 90px; /* height of page menu + 'back to content' button */
2938
+ bottom: 140px; /* height of expanded mini-map */
2939
+ padding-left: calc(var(--space-3) + var(--sab));
2940
+ }
2941
+
2942
+ [data-breakpoints-below*='6'] .tlui-main-toolbar--vertical {
2943
+ bottom: 90px; /* collapsed mini-map, but same as top to keep things looking even */
2908
2944
  }
2909
2945
 
2910
2946
  /* Centered Content */
@@ -2913,46 +2949,69 @@ it from receiving any pointer events or affecting the cursor. */
2913
2949
  width: fit-content;
2914
2950
  display: flex;
2915
2951
  gap: var(--space-3);
2916
- align-items: flex-end;
2952
+ align-items: flex-start;
2953
+ }
2954
+
2955
+ .tlui-main-toolbar--vertical .tlui-main-toolbar__inner {
2956
+ flex-direction: column;
2917
2957
  }
2918
2958
 
2919
- .tlui-main-toolbar__left {
2959
+ .tlui-main-toolbar--horizontal .tlui-main-toolbar__left {
2920
2960
  width: fit-content;
2921
2961
  }
2962
+ .tlui-main-toolbar--vertical .tlui-main-toolbar__left {
2963
+ display: flex;
2964
+ height: fit-content;
2965
+ }
2922
2966
 
2923
2967
  /* Row of controls + lock button */
2924
2968
  .tlui-main-toolbar__extras {
2925
2969
  position: relative;
2926
2970
  z-index: var(--layer-above);
2927
- width: 100%;
2928
2971
  pointer-events: none;
2929
- top: 6px;
2930
- height: 48px;
2972
+ align-self: stretch;
2931
2973
  }
2932
2974
 
2933
2975
  .tlui-main-toolbar__extras:empty {
2934
2976
  display: none;
2935
2977
  }
2936
2978
 
2979
+ .tlui-main-toolbar--horizontal .tlui-main-toolbar__extras {
2980
+ height: 48px;
2981
+ top: 6px;
2982
+ }
2983
+
2984
+ .tlui-main-toolbar--vertical .tlui-main-toolbar__extras {
2985
+ width: 48px;
2986
+ order: 1;
2987
+ }
2988
+
2937
2989
  .tlui-main-toolbar__extras__controls {
2938
- display: flex;
2939
2990
  position: relative;
2940
- flex-direction: row;
2941
2991
  z-index: var(--layer-above);
2942
2992
  background-color: var(--color-low);
2993
+ border: 2px solid var(--color-background);
2994
+ pointer-events: all;
2995
+ }
2996
+
2997
+ .tlui-main-toolbar--horizontal .tlui-main-toolbar__extras__controls {
2943
2998
  border-top-left-radius: var(--radius-4);
2944
2999
  border-top-right-radius: var(--radius-4);
2945
- border: 2px solid var(--color-background);
2946
3000
  margin-left: 8px;
2947
3001
  margin-right: 0px;
2948
- pointer-events: all;
3002
+ width: fit-content;
3003
+ }
3004
+
3005
+ .tlui-main-toolbar--vertical .tlui-main-toolbar__extras__controls {
3006
+ border-top-right-radius: var(--radius-4);
3007
+ border-bottom-right-radius: var(--radius-4);
3008
+ margin-top: 8px;
3009
+ margin-left: -2px;
3010
+ margin-bottom: 0px;
2949
3011
  width: fit-content;
2950
3012
  }
2951
3013
 
2952
3014
  .tlui-main-toolbar__tools {
2953
- display: flex;
2954
- flex-direction: row;
2955
- align-items: center;
2956
3015
  border-radius: var(--radius-4);
2957
3016
  z-index: var(--layer-panels);
2958
3017
  pointer-events: all;
@@ -2961,26 +3020,71 @@ it from receiving any pointer events or affecting the cursor. */
2961
3020
  box-shadow: var(--shadow-2);
2962
3021
  }
2963
3022
 
2964
- .tlui-main-toolbar__overflow {
3023
+ .tlui-main-toolbar--horizontal .tlui-main-toolbar__mobile-style-panel {
3024
+ align-self: flex-end;
3025
+ }
3026
+ .tlui-main-toolbar--vertical .tlui-main-toolbar__mobile-style-panel {
3027
+ align-self: flex-start;
3028
+ }
3029
+
3030
+ .tlui-main-toolbar--horizontal .tlui-main-toolbar__overflow {
2965
3031
  width: 40px;
2966
3032
  margin-left: 2px;
2967
3033
  }
3034
+ .tlui-main-toolbar--vertical .tlui-main-toolbar__overflow {
3035
+ height: 40px;
3036
+ margin-top: 2px;
3037
+ }
2968
3038
 
2969
- .tlui-layout__mobile .tlui-main-toolbar__overflow {
3039
+ .tlui-layout__mobile .tlui-main-toolbar--horizontal .tlui-main-toolbar__overflow {
2970
3040
  width: 32px;
2971
3041
  padding: 0px;
2972
3042
  }
2973
3043
 
2974
- .tlui-main-toolbar *[data-state='open']::after {
3044
+ .tlui-main-toolbar--horizontal *[data-state='open']::after {
2975
3045
  background: linear-gradient(0deg, rgba(144, 144, 144, 0) 0%, var(--color-muted-2) 100%);
2976
3046
  opacity: 1;
2977
3047
  }
3048
+ .tlui-main-toolbar--vertical *[data-state='open']::after {
3049
+ background: linear-gradient(90deg, rgba(144, 144, 144, 0) 0%, var(--color-muted-2) 100%);
3050
+ opacity: 1;
3051
+ }
3052
+
3053
+ .tlui-main-toolbar__tools [data-toolbar-visible='false'],
3054
+ .tlui-main-toolbar__overflow-content [data-toolbar-visible='false'] {
3055
+ display: none;
3056
+ }
3057
+
3058
+ .tlui-main-toolbar__group:empty {
3059
+ display: none;
3060
+ }
3061
+ .tlui-row.tlui-main-toolbar__group:not(:nth-last-child(-n + 1 of [data-toolbar-visible='true'])) {
3062
+ border-right: 1px solid var(--color-divider);
3063
+ margin-right: 2px;
3064
+ }
3065
+ .tlui-column.tlui-main-toolbar__group:not(
3066
+ :nth-last-child(-n + 1 of [data-toolbar-visible='true'])
3067
+ ) {
3068
+ border-bottom: 1px solid var(--color-divider);
3069
+ margin-bottom: 2px;
3070
+ }
3071
+ .tlui-grid.tlui-main-toolbar__group {
3072
+ grid-column: 1 / span 4;
3073
+ }
3074
+ .tlui-grid.tlui-main-toolbar__group:not(:nth-last-child(-n + 1 of [data-toolbar-visible='true'])) {
3075
+ border-bottom: 1px solid var(--color-divider);
3076
+ margin-bottom: 2px;
3077
+ }
2978
3078
 
2979
3079
  @media (hover: hover) {
2980
- .tlui-main-toolbar *[data-state='open']:not(:hover)::after {
3080
+ .tlui-main-toolbar--horizontal *[data-state='open']:not(:hover)::after {
2981
3081
  background: linear-gradient(0deg, rgba(144, 144, 144, 0) 0%, var(--color-muted-2) 100%);
2982
3082
  opacity: 1;
2983
3083
  }
3084
+ .tlui-main-toolbar--vertical *[data-state='open']:not(:hover)::after {
3085
+ background: linear-gradient(90deg, rgba(144, 144, 144, 0) 0%, var(--color-muted-2) 100%);
3086
+ opacity: 1;
3087
+ }
2984
3088
  }
2985
3089
 
2986
3090
  /* ------------------- Tooltip -------------------- */