tldraw 3.16.0-canary.b802b60e813f → 3.16.0-canary.bf9fb05eb8ef
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +9 -0
- package/dist-cjs/index.js +4 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/Tldraw.js +12 -2
- package/dist-cjs/lib/Tldraw.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js.map +2 -2
- package/dist-cjs/lib/ui/TldrawUi.js +13 -12
- package/dist-cjs/lib/ui/TldrawUi.js.map +2 -2
- package/dist-cjs/lib/ui/components/{FollowingIndicator.js → DefaultFollowingIndicator.js} +6 -6
- package/dist-cjs/lib/ui/components/DefaultFollowingIndicator.js.map +7 -0
- package/dist-cjs/lib/ui/context/components.js +2 -0
- package/dist-cjs/lib/ui/context/components.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-esm/index.d.mts +9 -0
- package/dist-esm/index.mjs +5 -2
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/Tldraw.mjs +14 -4
- package/dist-esm/lib/Tldraw.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/ui/TldrawUi.mjs +13 -12
- package/dist-esm/lib/ui/TldrawUi.mjs.map +2 -2
- package/dist-esm/lib/ui/components/{FollowingIndicator.mjs → DefaultFollowingIndicator.mjs} +3 -3
- package/dist-esm/lib/ui/components/DefaultFollowingIndicator.mjs.map +7 -0
- package/dist-esm/lib/ui/context/components.mjs +2 -0
- package/dist-esm/lib/ui/context/components.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +2 -1
- package/src/lib/Tldraw.tsx +15 -2
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +4 -0
- package/src/lib/shapes/image/ImageShapeUtil.tsx +3 -0
- package/src/lib/ui/TldrawUi.tsx +16 -10
- package/src/lib/ui/components/{FollowingIndicator.tsx → DefaultFollowingIndicator.tsx} +2 -1
- package/src/lib/ui/context/components.tsx +3 -0
- package/src/lib/ui/version.ts +3 -3
- package/tldraw.css +8 -0
- package/dist-cjs/lib/ui/components/FollowingIndicator.js.map +0 -7
- package/dist-esm/lib/ui/components/FollowingIndicator.mjs.map +0 -7
|
@@ -3,7 +3,6 @@ import { tlenv, useEditor, useReactor, useValue } from "@tldraw/editor";
|
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import React, { useMemo, useRef, useState } from "react";
|
|
5
5
|
import { SkipToMainContent } from "./components/A11y.mjs";
|
|
6
|
-
import { FollowingIndicator } from "./components/FollowingIndicator.mjs";
|
|
7
6
|
import { TldrawUiButton } from "./components/primitives/Button/TldrawUiButton.mjs";
|
|
8
7
|
import { TldrawUiButtonIcon } from "./components/primitives/Button/TldrawUiButtonIcon.mjs";
|
|
9
8
|
import { PORTRAIT_BREAKPOINT, PORTRAIT_BREAKPOINTS } from "./constants.mjs";
|
|
@@ -54,10 +53,6 @@ const TldrawUiContent = React.memo(function TldrawUI() {
|
|
|
54
53
|
NavigationPanel,
|
|
55
54
|
HelperButtons,
|
|
56
55
|
DebugPanel,
|
|
57
|
-
CursorChatBubble,
|
|
58
|
-
RichTextToolbar,
|
|
59
|
-
ImageToolbar,
|
|
60
|
-
VideoToolbar,
|
|
61
56
|
Toasts,
|
|
62
57
|
Dialogs,
|
|
63
58
|
A11y
|
|
@@ -152,18 +147,24 @@ const TldrawUiContent = React.memo(function TldrawUI() {
|
|
|
152
147
|
A11y && /* @__PURE__ */ jsx(A11y, {})
|
|
153
148
|
] })
|
|
154
149
|
] }),
|
|
155
|
-
RichTextToolbar && /* @__PURE__ */ jsx(RichTextToolbar, {}),
|
|
156
|
-
ImageToolbar && /* @__PURE__ */ jsx(ImageToolbar, {}),
|
|
157
|
-
VideoToolbar && /* @__PURE__ */ jsx(VideoToolbar, {}),
|
|
158
150
|
Toasts && /* @__PURE__ */ jsx(Toasts, {}),
|
|
159
|
-
Dialogs && /* @__PURE__ */ jsx(Dialogs, {})
|
|
160
|
-
/* @__PURE__ */ jsx(FollowingIndicator, {}),
|
|
161
|
-
CursorChatBubble && /* @__PURE__ */ jsx(CursorChatBubble, {})
|
|
151
|
+
Dialogs && /* @__PURE__ */ jsx(Dialogs, {})
|
|
162
152
|
]
|
|
163
153
|
}
|
|
164
154
|
);
|
|
165
155
|
});
|
|
156
|
+
function TldrawUiInFrontOfTheCanvas() {
|
|
157
|
+
const { RichTextToolbar, ImageToolbar, VideoToolbar, CursorChatBubble, FollowingIndicator } = useTldrawUiComponents();
|
|
158
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
159
|
+
RichTextToolbar && /* @__PURE__ */ jsx(RichTextToolbar, {}),
|
|
160
|
+
ImageToolbar && /* @__PURE__ */ jsx(ImageToolbar, {}),
|
|
161
|
+
VideoToolbar && /* @__PURE__ */ jsx(VideoToolbar, {}),
|
|
162
|
+
FollowingIndicator && /* @__PURE__ */ jsx(FollowingIndicator, {}),
|
|
163
|
+
CursorChatBubble && /* @__PURE__ */ jsx(CursorChatBubble, {})
|
|
164
|
+
] });
|
|
165
|
+
}
|
|
166
166
|
export {
|
|
167
|
-
TldrawUi
|
|
167
|
+
TldrawUi,
|
|
168
|
+
TldrawUiInFrontOfTheCanvas
|
|
168
169
|
};
|
|
169
170
|
//# sourceMappingURL=TldrawUi.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/ui/TldrawUi.tsx"],
|
|
4
|
-
"sourcesContent": ["import { tlenv, useEditor, useReactor, useValue } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport React, { ReactNode, useMemo, useRef, useState } from 'react'\nimport { TLUiAssetUrlOverrides } from './assetUrls'\nimport { SkipToMainContent } from './components/A11y'\nimport {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { tlenv, useEditor, useReactor, useValue } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport React, { ReactNode, useMemo, useRef, useState } from 'react'\nimport { TLUiAssetUrlOverrides } from './assetUrls'\nimport { SkipToMainContent } from './components/A11y'\nimport { TldrawUiButton } from './components/primitives/Button/TldrawUiButton'\nimport { TldrawUiButtonIcon } from './components/primitives/Button/TldrawUiButtonIcon'\nimport { PORTRAIT_BREAKPOINT, PORTRAIT_BREAKPOINTS } from './constants'\nimport {\n\tTLUiContextProviderProps,\n\tTldrawUiContextProvider,\n} from './context/TldrawUiContextProvider'\nimport { useActions } from './context/actions'\nimport { useBreakpoint } from './context/breakpoints'\nimport { TLUiComponents, useTldrawUiComponents } from './context/components'\nimport { useNativeClipboardEvents } from './hooks/useClipboardEvents'\nimport { useEditorEvents } from './hooks/useEditorEvents'\nimport { useKeyboardShortcuts } from './hooks/useKeyboardShortcuts'\nimport { useReadonly } from './hooks/useReadonly'\nimport { useTranslation } from './hooks/useTranslation/useTranslation'\n\n/** @public */\nexport interface TldrawUiProps extends TLUiContextProviderProps {\n\t/**\n\t * The component's children.\n\t */\n\tchildren?: ReactNode\n\n\t/**\n\t * Whether to hide the user interface and only display the canvas.\n\t */\n\thideUi?: boolean\n\n\t/**\n\t * Overrides for the UI components.\n\t */\n\tcomponents?: TLUiComponents\n\n\t/**\n\t * Additional items to add to the debug menu (will be deprecated)\n\t */\n\trenderDebugMenuItems?(): React.ReactNode\n\n\t/** Asset URL override. */\n\tassetUrls?: TLUiAssetUrlOverrides\n}\n\n/**\n * @public\n * @react\n */\nexport const TldrawUi = React.memo(function TldrawUi({\n\trenderDebugMenuItems,\n\tchildren,\n\thideUi,\n\tcomponents,\n\t...rest\n}: TldrawUiProps) {\n\treturn (\n\t\t<TldrawUiContextProvider {...rest} components={components}>\n\t\t\t<TldrawUiInner hideUi={hideUi} renderDebugMenuItems={renderDebugMenuItems}>\n\t\t\t\t{children}\n\t\t\t</TldrawUiInner>\n\t\t</TldrawUiContextProvider>\n\t)\n})\n\ninterface TldrawUiContentProps {\n\thideUi?: boolean\n\tshareZone?: ReactNode\n\ttopZone?: ReactNode\n\trenderDebugMenuItems?(): React.ReactNode\n}\n\nconst TldrawUiInner = React.memo(function TldrawUiInner({\n\tchildren,\n\thideUi,\n\t...rest\n}: TldrawUiContentProps & { children: ReactNode }) {\n\t// The hideUi prop should prevent the UI from mounting.\n\t// If we ever need want the UI to mount and preserve state, then\n\t// we should change this behavior and hide the UI via CSS instead.\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t{hideUi ? null : <TldrawUiContent {...rest} />}\n\t\t</>\n\t)\n})\n\nconst TldrawUiContent = React.memo(function TldrawUI() {\n\tconst editor = useEditor()\n\tconst msg = useTranslation()\n\tconst breakpoint = useBreakpoint()\n\tconst isReadonlyMode = useReadonly()\n\tconst isFocusMode = useValue('focus', () => editor.getInstanceState().isFocusMode, [editor])\n\tconst isDebugMode = useValue('debug', () => editor.getInstanceState().isDebugMode, [editor])\n\n\tconst {\n\t\tSharePanel,\n\t\tTopPanel,\n\t\tMenuPanel,\n\t\tStylePanel,\n\t\tToolbar,\n\t\tHelpMenu,\n\t\tNavigationPanel,\n\t\tHelperButtons,\n\t\tDebugPanel,\n\t\tToasts,\n\t\tDialogs,\n\t\tA11y,\n\t} = useTldrawUiComponents()\n\n\tuseKeyboardShortcuts()\n\tuseNativeClipboardEvents()\n\tuseEditorEvents()\n\n\tconst rIsEditingAnything = useRef(false)\n\tconst rHidingTimeout = useRef(-1 as any)\n\tconst [hideToolbarWhileEditing, setHideToolbarWhileEditing] = useState(false)\n\n\tuseReactor(\n\t\t'update hide toolbar while delayed',\n\t\t() => {\n\t\t\tconst isMobileEnvironment = tlenv.isIos || tlenv.isAndroid\n\t\t\tif (!isMobileEnvironment) return\n\n\t\t\tconst editingShape = editor.getEditingShapeId()\n\t\t\tif (editingShape === null) {\n\t\t\t\tif (rIsEditingAnything.current) {\n\t\t\t\t\trIsEditingAnything.current = false\n\t\t\t\t\tclearTimeout(rHidingTimeout.current)\n\t\t\t\t\tif (tlenv.isAndroid) {\n\t\t\t\t\t\t// On Android, hide it after 150ms\n\t\t\t\t\t\trHidingTimeout.current = editor.timers.setTimeout(() => {\n\t\t\t\t\t\t\tsetHideToolbarWhileEditing(false)\n\t\t\t\t\t\t}, 150)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// On iOS, just hide it immediately\n\t\t\t\t\t\tsetHideToolbarWhileEditing(false)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!rIsEditingAnything.current) {\n\t\t\t\trIsEditingAnything.current = true\n\t\t\t\tclearTimeout(rHidingTimeout.current)\n\t\t\t\tsetHideToolbarWhileEditing(true)\n\t\t\t}\n\t\t},\n\t\t[]\n\t)\n\n\tconst { 'toggle-focus-mode': toggleFocus } = useActions()\n\n\tconst { breakpointsAbove, breakpointsBelow } = useMemo(() => {\n\t\tconst breakpointsAbove = []\n\t\tconst breakpointsBelow = []\n\t\tfor (let bp = 0; bp < PORTRAIT_BREAKPOINTS.length; bp++) {\n\t\t\tif (bp <= breakpoint) {\n\t\t\t\tbreakpointsAbove.push(bp)\n\t\t\t} else {\n\t\t\t\tbreakpointsBelow.push(bp)\n\t\t\t}\n\t\t}\n\t\treturn { breakpointsAbove, breakpointsBelow }\n\t}, [breakpoint])\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('tlui-layout', {\n\t\t\t\t'tlui-layout__mobile': breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM,\n\t\t\t})}\n\t\t\t// When the virtual keyboard is opening we want it to hide immediately.\n\t\t\t// But when the virtual keyboard is closing we want to wait a bit before showing it again.\n\t\t\tdata-iseditinganything={hideToolbarWhileEditing}\n\t\t\tdata-breakpoint={breakpoint}\n\t\t\tdata-breakpoints-above={breakpointsAbove.join(' ')}\n\t\t\tdata-breakpoints-below={breakpointsBelow.join(' ')}\n\t\t>\n\t\t\t<SkipToMainContent />\n\t\t\t{isFocusMode ? (\n\t\t\t\t<div className=\"tlui-layout__top\">\n\t\t\t\t\t<TldrawUiButton\n\t\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\t\tclassName=\"tlui-focus-button\"\n\t\t\t\t\t\ttitle={msg('focus-mode.toggle-focus-mode')}\n\t\t\t\t\t\tonClick={() => toggleFocus.onSelect('menu')}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TldrawUiButtonIcon icon=\"dot\" />\n\t\t\t\t\t</TldrawUiButton>\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<div className=\"tlui-layout__top\">\n\t\t\t\t\t\t<div className=\"tlui-layout__top__left\">\n\t\t\t\t\t\t\t{MenuPanel && <MenuPanel />}\n\t\t\t\t\t\t\t{HelperButtons && <HelperButtons />}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"tlui-layout__top__center\">{TopPanel && <TopPanel />}</div>\n\t\t\t\t\t\t<div className=\"tlui-layout__top__right\">\n\t\t\t\t\t\t\t{SharePanel && <SharePanel />}\n\t\t\t\t\t\t\t{StylePanel && breakpoint >= PORTRAIT_BREAKPOINT.TABLET_SM && !isReadonlyMode && (\n\t\t\t\t\t\t\t\t<StylePanel />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"tlui-layout__bottom\">\n\t\t\t\t\t\t<div className=\"tlui-layout__bottom__main\">\n\t\t\t\t\t\t\t{NavigationPanel && <NavigationPanel />}\n\t\t\t\t\t\t\t{Toolbar && <Toolbar />}\n\t\t\t\t\t\t\t{HelpMenu && <HelpMenu />}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{isDebugMode && DebugPanel && <DebugPanel />}\n\t\t\t\t\t\t{A11y && <A11y />}\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{Toasts && <Toasts />}\n\t\t\t{Dialogs && <Dialogs />}\n\t\t</div>\n\t)\n})\n\n/** @public @react */\nexport function TldrawUiInFrontOfTheCanvas() {\n\tconst { RichTextToolbar, ImageToolbar, VideoToolbar, CursorChatBubble, FollowingIndicator } =\n\t\tuseTldrawUiComponents()\n\n\treturn (\n\t\t<>\n\t\t\t{RichTextToolbar && <RichTextToolbar />}\n\t\t\t{ImageToolbar && <ImageToolbar />}\n\t\t\t{VideoToolbar && <VideoToolbar />}\n\t\t\t{FollowingIndicator && <FollowingIndicator />}\n\t\t\t{CursorChatBubble && <CursorChatBubble />}\n\t\t</>\n\t)\n}\n"],
|
|
5
|
+
"mappings": "AA4DG,SAwBD,UAxBC,KAwBD,YAxBC;AA5DH,SAAS,OAAO,WAAW,YAAY,gBAAgB;AACvD,OAAO,gBAAgB;AACvB,OAAO,SAAoB,SAAS,QAAQ,gBAAgB;AAE5D,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AACnC,SAAS,qBAAqB,4BAA4B;AAC1D;AAAA,EAEC;AAAA,OACM;AACP,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAyB,6BAA6B;AACtD,SAAS,gCAAgC;AACzC,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAgCxB,MAAM,WAAW,MAAM,KAAK,SAASA,UAAS;AAAA,EACpD;AAAA,EACA;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AA;AAAA,QAChC,GACD,IAEA,iCACC;AAAA,+BAAC,SAAI,WAAU,oBACd;AAAA,iCAAC,SAAI,WAAU,0BACb;AAAA,2BAAa,oBAAC,aAAU;AAAA,cACxB,iBAAiB,oBAAC,iBAAc;AAAA,eAClC;AAAA,YACA,oBAAC,SAAI,WAAU,4BAA4B,sBAAY,oBAAC,YAAS,GAAG;AAAA,YACpE,qBAAC,SAAI,WAAU,2BACb;AAAA,4BAAc,oBAAC,cAAW;AAAA,cAC1B,cAAc,cAAc,oBAAoB,aAAa,CAAC,kBAC9D,oBAAC,cAAW;AAAA,eAEd;AAAA,aACD;AAAA,UACA,qBAAC,SAAI,WAAU,uBACd;AAAA,iCAAC,SAAI,WAAU,6BACb;AAAA,iCAAmB,oBAAC,mBAAgB;AAAA,cACpC,WAAW,oBAAC,WAAQ;AAAA,cACpB,YAAY,oBAAC,YAAS;AAAA,eACxB;AAAA,YACC,eAAe,cAAc,oBAAC,cAAW;AAAA,YACzC,QAAQ,oBAAC,QAAK;AAAA,aAChB;AAAA,WACD;AAAA,QAEA,UAAU,oBAAC,UAAO;AAAA,QAClB,WAAW,oBAAC,WAAQ;AAAA;AAAA;AAAA,EACtB;AAEF,CAAC;AAGM,SAAS,6BAA6B;AAC5C,QAAM,EAAE,iBAAiB,cAAc,cAAc,kBAAkB,mBAAmB,IACzF,sBAAsB;AAEvB,SACC,iCACE;AAAA,uBAAmB,oBAAC,mBAAgB;AAAA,IACpC,gBAAgB,oBAAC,gBAAa;AAAA,IAC9B,gBAAgB,oBAAC,gBAAa;AAAA,IAC9B,sBAAsB,oBAAC,sBAAmB;AAAA,IAC1C,oBAAoB,oBAAC,oBAAiB;AAAA,KACxC;AAEF;",
|
|
6
6
|
"names": ["TldrawUi", "TldrawUiInner", "breakpointsAbove", "breakpointsBelow"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEditor, usePresence, useValue } from "@tldraw/editor";
|
|
3
|
-
function
|
|
3
|
+
function DefaultFollowingIndicator() {
|
|
4
4
|
const editor = useEditor();
|
|
5
5
|
const followingUserId = useValue("follow", () => editor.getInstanceState().followingUserId, [
|
|
6
6
|
editor
|
|
@@ -14,6 +14,6 @@ function FollowingIndicatorInner({ userId }) {
|
|
|
14
14
|
return /* @__PURE__ */ jsx("div", { className: "tlui-following-indicator", style: { borderColor: presence.color } });
|
|
15
15
|
}
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
DefaultFollowingIndicator
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=DefaultFollowingIndicator.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/lib/ui/components/DefaultFollowingIndicator.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useEditor, usePresence, useValue } from '@tldraw/editor'\n\n/** @public @react */\nexport function DefaultFollowingIndicator() {\n\tconst editor = useEditor()\n\tconst followingUserId = useValue('follow', () => editor.getInstanceState().followingUserId, [\n\t\teditor,\n\t])\n\tif (!followingUserId) return null\n\treturn <FollowingIndicatorInner userId={followingUserId} />\n}\n\nfunction FollowingIndicatorInner({ userId }: { userId: string }) {\n\tconst presence = usePresence(userId)\n\tif (!presence) return null\n\treturn <div className=\"tlui-following-indicator\" style={{ borderColor: presence.color }} />\n}\n"],
|
|
5
|
+
"mappings": "AASQ;AATR,SAAS,WAAW,aAAa,gBAAgB;AAG1C,SAAS,4BAA4B;AAC3C,QAAM,SAAS,UAAU;AACzB,QAAM,kBAAkB,SAAS,UAAU,MAAM,OAAO,iBAAiB,EAAE,iBAAiB;AAAA,IAC3F;AAAA,EACD,CAAC;AACD,MAAI,CAAC,gBAAiB,QAAO;AAC7B,SAAO,oBAAC,2BAAwB,QAAQ,iBAAiB;AAC1D;AAEA,SAAS,wBAAwB,EAAE,OAAO,GAAuB;AAChE,QAAM,WAAW,YAAY,MAAM;AACnC,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO,oBAAC,SAAI,WAAU,4BAA2B,OAAO,EAAE,aAAa,SAAS,MAAM,GAAG;AAC1F;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { CursorChatBubble } from "../components/CursorChatBubble.mjs";
|
|
12
12
|
import { DefaultDebugMenu } from "../components/DebugMenu/DefaultDebugMenu.mjs";
|
|
13
13
|
import { DefaultDebugPanel } from "../components/DefaultDebugPanel.mjs";
|
|
14
|
+
import { DefaultFollowingIndicator } from "../components/DefaultFollowingIndicator.mjs";
|
|
14
15
|
import { DefaultMenuPanel } from "../components/DefaultMenuPanel.mjs";
|
|
15
16
|
import { DefaultDialogs } from "../components/Dialogs.mjs";
|
|
16
17
|
import {
|
|
@@ -75,6 +76,7 @@ function TldrawUiComponentsProvider({
|
|
|
75
76
|
Dialogs: DefaultDialogs,
|
|
76
77
|
Toasts: DefaultToasts,
|
|
77
78
|
A11y: DefaultA11yAnnouncer,
|
|
79
|
+
FollowingIndicator: DefaultFollowingIndicator,
|
|
78
80
|
..._overrides
|
|
79
81
|
}),
|
|
80
82
|
[_overrides, showCollaborationUi]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/ui/context/components.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useShallowObjectIdentity } from '@tldraw/editor'\nimport { ComponentType, ReactNode, createContext, useContext, useMemo } from 'react'\nimport { DefaultA11yAnnouncer } from '../components/A11y'\nimport {\n\tDefaultActionsMenu,\n\tTLUiActionsMenuProps,\n} from '../components/ActionsMenu/DefaultActionsMenu'\nimport {\n\tDefaultContextMenu,\n\tTLUiContextMenuProps,\n} from '../components/ContextMenu/DefaultContextMenu'\nimport { CursorChatBubble } from '../components/CursorChatBubble'\nimport { DefaultDebugMenu } from '../components/DebugMenu/DefaultDebugMenu'\nimport { DefaultDebugPanel } from '../components/DefaultDebugPanel'\nimport { DefaultMenuPanel } from '../components/DefaultMenuPanel'\nimport { DefaultDialogs } from '../components/Dialogs'\nimport { TLUiHelpMenuProps } from '../components/HelpMenu/DefaultHelpMenu'\nimport {\n\tDefaultHelperButtons,\n\tTLUiHelperButtonsProps,\n} from '../components/HelperButtons/DefaultHelperButtons'\nimport {\n\tDefaultKeyboardShortcutsDialog,\n\tTLUiKeyboardShortcutsDialogProps,\n} from '../components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog'\nimport { DefaultMainMenu, TLUiMainMenuProps } from '../components/MainMenu/DefaultMainMenu'\nimport { DefaultMinimap } from '../components/Minimap/DefaultMinimap'\nimport { DefaultNavigationPanel } from '../components/NavigationPanel/DefaultNavigationPanel'\nimport { DefaultPageMenu } from '../components/PageMenu/DefaultPageMenu'\nimport {\n\tDefaultQuickActions,\n\tTLUiQuickActionsProps,\n} from '../components/QuickActions/DefaultQuickActions'\nimport { DefaultSharePanel } from '../components/SharePanel/DefaultSharePanel'\nimport { DefaultStylePanel, TLUiStylePanelProps } from '../components/StylePanel/DefaultStylePanel'\nimport { DefaultToasts } from '../components/Toasts'\nimport { DefaultImageToolbar } from '../components/Toolbar/DefaultImageToolbar'\nimport {\n\tDefaultRichTextToolbar,\n\tTLUiRichTextToolbarProps,\n} from '../components/Toolbar/DefaultRichTextToolbar'\nimport { DefaultToolbar } from '../components/Toolbar/DefaultToolbar'\nimport { DefaultVideoToolbar } from '../components/Toolbar/DefaultVideoToolbar'\nimport { DefaultTopPanel } from '../components/TopPanel/DefaultTopPanel'\nimport { DefaultZoomMenu, TLUiZoomMenuProps } from '../components/ZoomMenu/DefaultZoomMenu'\nimport { useShowCollaborationUi } from '../hooks/useCollaborationStatus'\n\n/** @public */\nexport interface TLUiComponents {\n\tContextMenu?: ComponentType<TLUiContextMenuProps> | null\n\tActionsMenu?: ComponentType<TLUiActionsMenuProps> | null\n\tHelpMenu?: ComponentType<TLUiHelpMenuProps> | null\n\tZoomMenu?: ComponentType<TLUiZoomMenuProps> | null\n\tMainMenu?: ComponentType<TLUiMainMenuProps> | null\n\tMinimap?: ComponentType | null\n\tStylePanel?: ComponentType<TLUiStylePanelProps> | null\n\tPageMenu?: ComponentType | null\n\tNavigationPanel?: ComponentType | null\n\tToolbar?: ComponentType | null\n\tRichTextToolbar?: ComponentType<TLUiRichTextToolbarProps> | null\n\tImageToolbar?: ComponentType | null\n\tVideoToolbar?: ComponentType | null\n\tKeyboardShortcutsDialog?: ComponentType<TLUiKeyboardShortcutsDialogProps> | null\n\tQuickActions?: ComponentType<TLUiQuickActionsProps> | null\n\tHelperButtons?: ComponentType<TLUiHelperButtonsProps> | null\n\tDebugPanel?: ComponentType | null\n\tDebugMenu?: ComponentType | null\n\tMenuPanel?: ComponentType | null\n\tTopPanel?: ComponentType | null\n\tSharePanel?: ComponentType | null\n\tCursorChatBubble?: ComponentType | null\n\tDialogs?: ComponentType | null\n\tToasts?: ComponentType | null\n\tA11y?: ComponentType | null\n}\n\nconst TldrawUiComponentsContext = createContext<TLUiComponents | null>(null)\n\n/** @public */\nexport interface TLUiComponentsProviderProps {\n\toverrides?: TLUiComponents\n\tchildren: ReactNode\n}\n\n/** @public @react */\nexport function TldrawUiComponentsProvider({\n\toverrides = {},\n\tchildren,\n}: TLUiComponentsProviderProps) {\n\tconst _overrides = useShallowObjectIdentity(overrides)\n\tconst showCollaborationUi = useShowCollaborationUi()\n\n\treturn (\n\t\t<TldrawUiComponentsContext.Provider\n\t\t\tvalue={useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\tContextMenu: DefaultContextMenu,\n\t\t\t\t\tActionsMenu: DefaultActionsMenu,\n\t\t\t\t\tHelpMenu: null,\n\t\t\t\t\tZoomMenu: DefaultZoomMenu,\n\t\t\t\t\tMainMenu: DefaultMainMenu,\n\t\t\t\t\tMinimap: DefaultMinimap,\n\t\t\t\t\tStylePanel: DefaultStylePanel,\n\t\t\t\t\tPageMenu: DefaultPageMenu,\n\t\t\t\t\tNavigationPanel: DefaultNavigationPanel,\n\t\t\t\t\tToolbar: DefaultToolbar,\n\t\t\t\t\tRichTextToolbar: DefaultRichTextToolbar,\n\t\t\t\t\tImageToolbar: DefaultImageToolbar,\n\t\t\t\t\tVideoToolbar: DefaultVideoToolbar,\n\t\t\t\t\tKeyboardShortcutsDialog: DefaultKeyboardShortcutsDialog,\n\t\t\t\t\tQuickActions: DefaultQuickActions,\n\t\t\t\t\tHelperButtons: DefaultHelperButtons,\n\t\t\t\t\tDebugPanel: DefaultDebugPanel,\n\t\t\t\t\tDebugMenu: DefaultDebugMenu,\n\t\t\t\t\tMenuPanel: DefaultMenuPanel,\n\t\t\t\t\tSharePanel: showCollaborationUi ? DefaultSharePanel : null,\n\t\t\t\t\tCursorChatBubble: showCollaborationUi ? CursorChatBubble : null,\n\t\t\t\t\tTopPanel: showCollaborationUi ? DefaultTopPanel : null,\n\t\t\t\t\tDialogs: DefaultDialogs,\n\t\t\t\t\tToasts: DefaultToasts,\n\t\t\t\t\tA11y: DefaultA11yAnnouncer,\n\t\t\t\t\t..._overrides,\n\t\t\t\t}),\n\t\t\t\t[_overrides, showCollaborationUi]\n\t\t\t)}\n\t\t>\n\t\t\t{children}\n\t\t</TldrawUiComponentsContext.Provider>\n\t)\n}\n\n/** @public */\nexport function useTldrawUiComponents() {\n\tconst components = useContext(TldrawUiComponentsContext)\n\tif (!components) {\n\t\tthrow new Error('useTldrawUiComponents must be used within a TldrawUiComponentsProvider')\n\t}\n\treturn components\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { useShallowObjectIdentity } from '@tldraw/editor'\nimport { ComponentType, ReactNode, createContext, useContext, useMemo } from 'react'\nimport { DefaultA11yAnnouncer } from '../components/A11y'\nimport {\n\tDefaultActionsMenu,\n\tTLUiActionsMenuProps,\n} from '../components/ActionsMenu/DefaultActionsMenu'\nimport {\n\tDefaultContextMenu,\n\tTLUiContextMenuProps,\n} from '../components/ContextMenu/DefaultContextMenu'\nimport { CursorChatBubble } from '../components/CursorChatBubble'\nimport { DefaultDebugMenu } from '../components/DebugMenu/DefaultDebugMenu'\nimport { DefaultDebugPanel } from '../components/DefaultDebugPanel'\nimport { DefaultFollowingIndicator } from '../components/DefaultFollowingIndicator'\nimport { DefaultMenuPanel } from '../components/DefaultMenuPanel'\nimport { DefaultDialogs } from '../components/Dialogs'\nimport { TLUiHelpMenuProps } from '../components/HelpMenu/DefaultHelpMenu'\nimport {\n\tDefaultHelperButtons,\n\tTLUiHelperButtonsProps,\n} from '../components/HelperButtons/DefaultHelperButtons'\nimport {\n\tDefaultKeyboardShortcutsDialog,\n\tTLUiKeyboardShortcutsDialogProps,\n} from '../components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog'\nimport { DefaultMainMenu, TLUiMainMenuProps } from '../components/MainMenu/DefaultMainMenu'\nimport { DefaultMinimap } from '../components/Minimap/DefaultMinimap'\nimport { DefaultNavigationPanel } from '../components/NavigationPanel/DefaultNavigationPanel'\nimport { DefaultPageMenu } from '../components/PageMenu/DefaultPageMenu'\nimport {\n\tDefaultQuickActions,\n\tTLUiQuickActionsProps,\n} from '../components/QuickActions/DefaultQuickActions'\nimport { DefaultSharePanel } from '../components/SharePanel/DefaultSharePanel'\nimport { DefaultStylePanel, TLUiStylePanelProps } from '../components/StylePanel/DefaultStylePanel'\nimport { DefaultToasts } from '../components/Toasts'\nimport { DefaultImageToolbar } from '../components/Toolbar/DefaultImageToolbar'\nimport {\n\tDefaultRichTextToolbar,\n\tTLUiRichTextToolbarProps,\n} from '../components/Toolbar/DefaultRichTextToolbar'\nimport { DefaultToolbar } from '../components/Toolbar/DefaultToolbar'\nimport { DefaultVideoToolbar } from '../components/Toolbar/DefaultVideoToolbar'\nimport { DefaultTopPanel } from '../components/TopPanel/DefaultTopPanel'\nimport { DefaultZoomMenu, TLUiZoomMenuProps } from '../components/ZoomMenu/DefaultZoomMenu'\nimport { useShowCollaborationUi } from '../hooks/useCollaborationStatus'\n\n/** @public */\nexport interface TLUiComponents {\n\tContextMenu?: ComponentType<TLUiContextMenuProps> | null\n\tActionsMenu?: ComponentType<TLUiActionsMenuProps> | null\n\tHelpMenu?: ComponentType<TLUiHelpMenuProps> | null\n\tZoomMenu?: ComponentType<TLUiZoomMenuProps> | null\n\tMainMenu?: ComponentType<TLUiMainMenuProps> | null\n\tMinimap?: ComponentType | null\n\tStylePanel?: ComponentType<TLUiStylePanelProps> | null\n\tPageMenu?: ComponentType | null\n\tNavigationPanel?: ComponentType | null\n\tToolbar?: ComponentType | null\n\tRichTextToolbar?: ComponentType<TLUiRichTextToolbarProps> | null\n\tImageToolbar?: ComponentType | null\n\tVideoToolbar?: ComponentType | null\n\tKeyboardShortcutsDialog?: ComponentType<TLUiKeyboardShortcutsDialogProps> | null\n\tQuickActions?: ComponentType<TLUiQuickActionsProps> | null\n\tHelperButtons?: ComponentType<TLUiHelperButtonsProps> | null\n\tDebugPanel?: ComponentType | null\n\tDebugMenu?: ComponentType | null\n\tMenuPanel?: ComponentType | null\n\tTopPanel?: ComponentType | null\n\tSharePanel?: ComponentType | null\n\tCursorChatBubble?: ComponentType | null\n\tDialogs?: ComponentType | null\n\tToasts?: ComponentType | null\n\tA11y?: ComponentType | null\n\tFollowingIndicator?: ComponentType | null\n}\n\nconst TldrawUiComponentsContext = createContext<TLUiComponents | null>(null)\n\n/** @public */\nexport interface TLUiComponentsProviderProps {\n\toverrides?: TLUiComponents\n\tchildren: ReactNode\n}\n\n/** @public @react */\nexport function TldrawUiComponentsProvider({\n\toverrides = {},\n\tchildren,\n}: TLUiComponentsProviderProps) {\n\tconst _overrides = useShallowObjectIdentity(overrides)\n\tconst showCollaborationUi = useShowCollaborationUi()\n\n\treturn (\n\t\t<TldrawUiComponentsContext.Provider\n\t\t\tvalue={useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\tContextMenu: DefaultContextMenu,\n\t\t\t\t\tActionsMenu: DefaultActionsMenu,\n\t\t\t\t\tHelpMenu: null,\n\t\t\t\t\tZoomMenu: DefaultZoomMenu,\n\t\t\t\t\tMainMenu: DefaultMainMenu,\n\t\t\t\t\tMinimap: DefaultMinimap,\n\t\t\t\t\tStylePanel: DefaultStylePanel,\n\t\t\t\t\tPageMenu: DefaultPageMenu,\n\t\t\t\t\tNavigationPanel: DefaultNavigationPanel,\n\t\t\t\t\tToolbar: DefaultToolbar,\n\t\t\t\t\tRichTextToolbar: DefaultRichTextToolbar,\n\t\t\t\t\tImageToolbar: DefaultImageToolbar,\n\t\t\t\t\tVideoToolbar: DefaultVideoToolbar,\n\t\t\t\t\tKeyboardShortcutsDialog: DefaultKeyboardShortcutsDialog,\n\t\t\t\t\tQuickActions: DefaultQuickActions,\n\t\t\t\t\tHelperButtons: DefaultHelperButtons,\n\t\t\t\t\tDebugPanel: DefaultDebugPanel,\n\t\t\t\t\tDebugMenu: DefaultDebugMenu,\n\t\t\t\t\tMenuPanel: DefaultMenuPanel,\n\t\t\t\t\tSharePanel: showCollaborationUi ? DefaultSharePanel : null,\n\t\t\t\t\tCursorChatBubble: showCollaborationUi ? CursorChatBubble : null,\n\t\t\t\t\tTopPanel: showCollaborationUi ? DefaultTopPanel : null,\n\t\t\t\t\tDialogs: DefaultDialogs,\n\t\t\t\t\tToasts: DefaultToasts,\n\t\t\t\t\tA11y: DefaultA11yAnnouncer,\n\t\t\t\t\tFollowingIndicator: DefaultFollowingIndicator,\n\t\t\t\t\t..._overrides,\n\t\t\t\t}),\n\t\t\t\t[_overrides, showCollaborationUi]\n\t\t\t)}\n\t\t>\n\t\t\t{children}\n\t\t</TldrawUiComponentsContext.Provider>\n\t)\n}\n\n/** @public */\nexport function useTldrawUiComponents() {\n\tconst components = useContext(TldrawUiComponentsContext)\n\tif (!components) {\n\t\tthrow new Error('useTldrawUiComponents must be used within a TldrawUiComponentsProvider')\n\t}\n\treturn components\n}\n"],
|
|
5
|
+
"mappings": "AA+FE;AA/FF,SAAS,gCAAgC;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,UACtD,kBAAkB,sBAAsB,mBAAmB;AAAA,UAC3D,UAAU,sBAAsB,kBAAkB;AAAA,UAClD,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,MAAM;AAAA,UACN,oBAAoB;AAAA,UACpB,GAAG;AAAA,QACJ;AAAA,QACA,CAAC,YAAY,mBAAmB;AAAA,MACjC;AAAA,MAEC;AAAA;AAAA,EACF;AAEF;AAGO,SAAS,wBAAwB;AACvC,QAAM,aAAa,WAAW,yBAAyB;AACvD,MAAI,CAAC,YAAY;AAChB,UAAM,IAAI,MAAM,wEAAwE;AAAA,EACzF;AACA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const version = "3.16.0-canary.
|
|
1
|
+
const version = "3.16.0-canary.bf9fb05eb8ef";
|
|
2
2
|
const publishDates = {
|
|
3
3
|
major: "2024-09-13T14:36:29.063Z",
|
|
4
|
-
minor: "2025-08-
|
|
5
|
-
patch: "2025-08-
|
|
4
|
+
minor: "2025-08-26T14:23:01.958Z",
|
|
5
|
+
patch: "2025-08-26T14:23:01.958Z"
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
8
|
publishDates,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/ui/version.ts"],
|
|
4
|
-
"sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.16.0-canary.
|
|
4
|
+
"sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.16.0-canary.bf9fb05eb8ef'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-08-26T14:23:01.958Z',\n\tpatch: '2025-08-26T14:23:01.958Z',\n}\n"],
|
|
5
5
|
"mappings": "AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tldraw",
|
|
3
3
|
"description": "A tiny little drawing editor.",
|
|
4
|
-
"version": "3.16.0-canary.
|
|
4
|
+
"version": "3.16.0-canary.bf9fb05eb8ef",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"@tiptap/pm": "^2.9.1",
|
|
56
56
|
"@tiptap/react": "^2.9.1",
|
|
57
57
|
"@tiptap/starter-kit": "^2.9.1",
|
|
58
|
-
"@tldraw/editor": "3.16.0-canary.
|
|
59
|
-
"@tldraw/store": "3.16.0-canary.
|
|
58
|
+
"@tldraw/editor": "3.16.0-canary.bf9fb05eb8ef",
|
|
59
|
+
"@tldraw/store": "3.16.0-canary.bf9fb05eb8ef",
|
|
60
60
|
"classnames": "^2.5.1",
|
|
61
61
|
"hotkeys-js": "^3.13.9",
|
|
62
62
|
"idb": "^7.1.1",
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ export { usePrefersReducedMotion } from './lib/shapes/shared/usePrefersReducedMo
|
|
|
24
24
|
export { DefaultA11yAnnouncer, useSelectedShapesAnnouncer } from './lib/ui/components/A11y'
|
|
25
25
|
export { AccessibilityMenu } from './lib/ui/components/AccessibilityMenu'
|
|
26
26
|
export { ColorSchemeMenu } from './lib/ui/components/ColorSchemeMenu'
|
|
27
|
+
export { DefaultFollowingIndicator } from './lib/ui/components/DefaultFollowingIndicator'
|
|
27
28
|
export { DefaultDialogs } from './lib/ui/components/Dialogs'
|
|
28
29
|
export {
|
|
29
30
|
TldrawUiColumn,
|
|
@@ -629,7 +630,7 @@ export {
|
|
|
629
630
|
} from './lib/ui/hooks/useTranslation/useTranslation'
|
|
630
631
|
export { type TLUiIconType } from './lib/ui/icon-types'
|
|
631
632
|
export { useDefaultHelpers, type TLUiOverrideHelpers, type TLUiOverrides } from './lib/ui/overrides'
|
|
632
|
-
export { TldrawUi, type TldrawUiProps } from './lib/ui/TldrawUi'
|
|
633
|
+
export { TldrawUi, TldrawUiInFrontOfTheCanvas, type TldrawUiProps } from './lib/ui/TldrawUi'
|
|
633
634
|
export { containBoxSize, downsizeImage, type BoxWidthHeight } from './lib/utils/assets/assets'
|
|
634
635
|
export { preloadFont, type TLTypeFace } from './lib/utils/assets/preload-font'
|
|
635
636
|
export { getEmbedInfo, type TLEmbedResult } from './lib/utils/embeds/embeds'
|
package/src/lib/Tldraw.tsx
CHANGED
|
@@ -33,7 +33,7 @@ import { registerDefaultSideEffects } from './defaultSideEffects'
|
|
|
33
33
|
import { defaultTools } from './defaultTools'
|
|
34
34
|
import { EmbedShapeUtil } from './shapes/embed/EmbedShapeUtil'
|
|
35
35
|
import { allDefaultFontFaces } from './shapes/shared/defaultFonts'
|
|
36
|
-
import { TldrawUi, TldrawUiProps } from './ui/TldrawUi'
|
|
36
|
+
import { TldrawUi, TldrawUiInFrontOfTheCanvas, TldrawUiProps } from './ui/TldrawUi'
|
|
37
37
|
import { TLUiAssetUrlOverrides, useDefaultUiAssetUrlsWithOverrides } from './ui/assetUrls'
|
|
38
38
|
import { LoadingScreen } from './ui/components/LoadingScreen'
|
|
39
39
|
import { Spinner } from './ui/components/Spinner'
|
|
@@ -118,6 +118,18 @@ export function Tldraw(props: TldrawProps) {
|
|
|
118
118
|
|
|
119
119
|
const _components = useShallowObjectIdentity(components)
|
|
120
120
|
|
|
121
|
+
const CustomInFrontOfTheCanvas = components?.InFrontOfTheCanvas
|
|
122
|
+
const InFrontOfTheCanvas = useMemo(() => {
|
|
123
|
+
if (rest.hideUi) return CustomInFrontOfTheCanvas ?? null
|
|
124
|
+
if (!CustomInFrontOfTheCanvas) return TldrawUiInFrontOfTheCanvas
|
|
125
|
+
|
|
126
|
+
return () => (
|
|
127
|
+
<>
|
|
128
|
+
<TldrawUiInFrontOfTheCanvas />
|
|
129
|
+
<CustomInFrontOfTheCanvas />
|
|
130
|
+
</>
|
|
131
|
+
)
|
|
132
|
+
}, [rest.hideUi, CustomInFrontOfTheCanvas])
|
|
121
133
|
const componentsWithDefault = useMemo(
|
|
122
134
|
() => ({
|
|
123
135
|
Scribble: TldrawScribble,
|
|
@@ -129,8 +141,9 @@ export function Tldraw(props: TldrawProps) {
|
|
|
129
141
|
Spinner,
|
|
130
142
|
LoadingScreen,
|
|
131
143
|
..._components,
|
|
144
|
+
InFrontOfTheCanvas,
|
|
132
145
|
}),
|
|
133
|
-
[_components]
|
|
146
|
+
[_components, InFrontOfTheCanvas]
|
|
134
147
|
)
|
|
135
148
|
|
|
136
149
|
const _shapeUtils = useShallowArrayIdentity(shapeUtils)
|
|
@@ -100,6 +100,10 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
|
|
|
100
100
|
return false
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
override isExportBoundsContainer(): boolean {
|
|
104
|
+
return true
|
|
105
|
+
}
|
|
106
|
+
|
|
103
107
|
override getDefaultProps(): TLFrameShape['props'] {
|
|
104
108
|
return { w: 160 * 2, h: 90 * 2, name: '', color: 'black' }
|
|
105
109
|
}
|
package/src/lib/ui/TldrawUi.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import classNames from 'classnames'
|
|
|
3
3
|
import React, { ReactNode, useMemo, useRef, useState } from 'react'
|
|
4
4
|
import { TLUiAssetUrlOverrides } from './assetUrls'
|
|
5
5
|
import { SkipToMainContent } from './components/A11y'
|
|
6
|
-
import { FollowingIndicator } from './components/FollowingIndicator'
|
|
7
6
|
import { TldrawUiButton } from './components/primitives/Button/TldrawUiButton'
|
|
8
7
|
import { TldrawUiButtonIcon } from './components/primitives/Button/TldrawUiButtonIcon'
|
|
9
8
|
import { PORTRAIT_BREAKPOINT, PORTRAIT_BREAKPOINTS } from './constants'
|
|
@@ -108,10 +107,6 @@ const TldrawUiContent = React.memo(function TldrawUI() {
|
|
|
108
107
|
NavigationPanel,
|
|
109
108
|
HelperButtons,
|
|
110
109
|
DebugPanel,
|
|
111
|
-
CursorChatBubble,
|
|
112
|
-
RichTextToolbar,
|
|
113
|
-
ImageToolbar,
|
|
114
|
-
VideoToolbar,
|
|
115
110
|
Toasts,
|
|
116
111
|
Dialogs,
|
|
117
112
|
A11y,
|
|
@@ -223,13 +218,24 @@ const TldrawUiContent = React.memo(function TldrawUI() {
|
|
|
223
218
|
</div>
|
|
224
219
|
</>
|
|
225
220
|
)}
|
|
226
|
-
{RichTextToolbar && <RichTextToolbar />}
|
|
227
|
-
{ImageToolbar && <ImageToolbar />}
|
|
228
|
-
{VideoToolbar && <VideoToolbar />}
|
|
229
221
|
{Toasts && <Toasts />}
|
|
230
222
|
{Dialogs && <Dialogs />}
|
|
231
|
-
<FollowingIndicator />
|
|
232
|
-
{CursorChatBubble && <CursorChatBubble />}
|
|
233
223
|
</div>
|
|
234
224
|
)
|
|
235
225
|
})
|
|
226
|
+
|
|
227
|
+
/** @public @react */
|
|
228
|
+
export function TldrawUiInFrontOfTheCanvas() {
|
|
229
|
+
const { RichTextToolbar, ImageToolbar, VideoToolbar, CursorChatBubble, FollowingIndicator } =
|
|
230
|
+
useTldrawUiComponents()
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<>
|
|
234
|
+
{RichTextToolbar && <RichTextToolbar />}
|
|
235
|
+
{ImageToolbar && <ImageToolbar />}
|
|
236
|
+
{VideoToolbar && <VideoToolbar />}
|
|
237
|
+
{FollowingIndicator && <FollowingIndicator />}
|
|
238
|
+
{CursorChatBubble && <CursorChatBubble />}
|
|
239
|
+
</>
|
|
240
|
+
)
|
|
241
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEditor, usePresence, useValue } from '@tldraw/editor'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/** @public @react */
|
|
4
|
+
export function DefaultFollowingIndicator() {
|
|
4
5
|
const editor = useEditor()
|
|
5
6
|
const followingUserId = useValue('follow', () => editor.getInstanceState().followingUserId, [
|
|
6
7
|
editor,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { CursorChatBubble } from '../components/CursorChatBubble'
|
|
13
13
|
import { DefaultDebugMenu } from '../components/DebugMenu/DefaultDebugMenu'
|
|
14
14
|
import { DefaultDebugPanel } from '../components/DefaultDebugPanel'
|
|
15
|
+
import { DefaultFollowingIndicator } from '../components/DefaultFollowingIndicator'
|
|
15
16
|
import { DefaultMenuPanel } from '../components/DefaultMenuPanel'
|
|
16
17
|
import { DefaultDialogs } from '../components/Dialogs'
|
|
17
18
|
import { TLUiHelpMenuProps } from '../components/HelpMenu/DefaultHelpMenu'
|
|
@@ -72,6 +73,7 @@ export interface TLUiComponents {
|
|
|
72
73
|
Dialogs?: ComponentType | null
|
|
73
74
|
Toasts?: ComponentType | null
|
|
74
75
|
A11y?: ComponentType | null
|
|
76
|
+
FollowingIndicator?: ComponentType | null
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
const TldrawUiComponentsContext = createContext<TLUiComponents | null>(null)
|
|
@@ -119,6 +121,7 @@ export function TldrawUiComponentsProvider({
|
|
|
119
121
|
Dialogs: DefaultDialogs,
|
|
120
122
|
Toasts: DefaultToasts,
|
|
121
123
|
A11y: DefaultA11yAnnouncer,
|
|
124
|
+
FollowingIndicator: DefaultFollowingIndicator,
|
|
122
125
|
..._overrides,
|
|
123
126
|
}),
|
|
124
127
|
[_overrides, showCollaborationUi]
|
package/src/lib/ui/version.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is automatically generated by internal/scripts/refresh-assets.ts.
|
|
2
2
|
// Do not edit manually. Or do, I'm a comment, not a cop.
|
|
3
3
|
|
|
4
|
-
export const version = '3.16.0-canary.
|
|
4
|
+
export const version = '3.16.0-canary.bf9fb05eb8ef'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2024-09-13T14:36:29.063Z',
|
|
7
|
-
minor: '2025-08-
|
|
8
|
-
patch: '2025-08-
|
|
7
|
+
minor: '2025-08-26T14:23:01.958Z',
|
|
8
|
+
patch: '2025-08-26T14:23:01.958Z',
|
|
9
9
|
}
|
package/tldraw.css
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
--tl-layer-watermark: 200;
|
|
34
34
|
--tl-layer-canvas-shapes: 300;
|
|
35
35
|
--tl-layer-canvas-overlays: 500;
|
|
36
|
+
--tl-layer-canvas-in-front: 600;
|
|
36
37
|
--tl-layer-canvas-blocker: 10000;
|
|
37
38
|
|
|
38
39
|
/* Canvas overlays z-index */
|
|
@@ -301,6 +302,13 @@ input,
|
|
|
301
302
|
contain: strict;
|
|
302
303
|
}
|
|
303
304
|
|
|
305
|
+
.tl-canvas__in-front {
|
|
306
|
+
position: absolute;
|
|
307
|
+
inset: 0;
|
|
308
|
+
pointer-events: none;
|
|
309
|
+
z-index: var(--tl-layer-canvas-in-front);
|
|
310
|
+
}
|
|
311
|
+
|
|
304
312
|
.tl-shapes {
|
|
305
313
|
position: relative;
|
|
306
314
|
z-index: var(--tl-layer-canvas-shapes);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/lib/ui/components/FollowingIndicator.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useEditor, usePresence, useValue } from '@tldraw/editor'\n\nexport function FollowingIndicator() {\n\tconst editor = useEditor()\n\tconst followingUserId = useValue('follow', () => editor.getInstanceState().followingUserId, [\n\t\teditor,\n\t])\n\tif (!followingUserId) return null\n\treturn <FollowingIndicatorInner userId={followingUserId} />\n}\n\nfunction FollowingIndicatorInner({ userId }: { userId: string }) {\n\tconst presence = usePresence(userId)\n\tif (!presence) return null\n\treturn <div className=\"tlui-following-indicator\" style={{ borderColor: presence.color }} />\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQQ;AARR,oBAAiD;AAE1C,SAAS,qBAAqB;AACpC,QAAM,aAAS,yBAAU;AACzB,QAAM,sBAAkB,wBAAS,UAAU,MAAM,OAAO,iBAAiB,EAAE,iBAAiB;AAAA,IAC3F;AAAA,EACD,CAAC;AACD,MAAI,CAAC,gBAAiB,QAAO;AAC7B,SAAO,4CAAC,2BAAwB,QAAQ,iBAAiB;AAC1D;AAEA,SAAS,wBAAwB,EAAE,OAAO,GAAuB;AAChE,QAAM,eAAW,2BAAY,MAAM;AACnC,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO,4CAAC,SAAI,WAAU,4BAA2B,OAAO,EAAE,aAAa,SAAS,MAAM,GAAG;AAC1F;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/lib/ui/components/FollowingIndicator.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useEditor, usePresence, useValue } from '@tldraw/editor'\n\nexport function FollowingIndicator() {\n\tconst editor = useEditor()\n\tconst followingUserId = useValue('follow', () => editor.getInstanceState().followingUserId, [\n\t\teditor,\n\t])\n\tif (!followingUserId) return null\n\treturn <FollowingIndicatorInner userId={followingUserId} />\n}\n\nfunction FollowingIndicatorInner({ userId }: { userId: string }) {\n\tconst presence = usePresence(userId)\n\tif (!presence) return null\n\treturn <div className=\"tlui-following-indicator\" style={{ borderColor: presence.color }} />\n}\n"],
|
|
5
|
-
"mappings": "AAQQ;AARR,SAAS,WAAW,aAAa,gBAAgB;AAE1C,SAAS,qBAAqB;AACpC,QAAM,SAAS,UAAU;AACzB,QAAM,kBAAkB,SAAS,UAAU,MAAM,OAAO,iBAAiB,EAAE,iBAAiB;AAAA,IAC3F;AAAA,EACD,CAAC;AACD,MAAI,CAAC,gBAAiB,QAAO;AAC7B,SAAO,oBAAC,2BAAwB,QAAQ,iBAAiB;AAC1D;AAEA,SAAS,wBAAwB,EAAE,OAAO,GAAuB;AAChE,QAAM,WAAW,YAAY,MAAM;AACnC,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO,oBAAC,SAAI,WAAU,4BAA2B,OAAO,EAAE,aAAa,SAAS,MAAM,GAAG;AAC1F;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|