@tldraw/editor 5.7.0-canary.986cfb91c3b4 → 5.7.0-canary.98770694aa48

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.js CHANGED
@@ -398,7 +398,7 @@ var import_uniq = require("./lib/utils/uniq");
398
398
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
399
399
  (0, import_utils.registerTldrawLibraryVersion)(
400
400
  "@tldraw/editor",
401
- "5.7.0-canary.986cfb91c3b4",
401
+ "5.7.0-canary.98770694aa48",
402
402
  "cjs"
403
403
  );
404
404
  //# sourceMappingURL=index.js.map
@@ -63,6 +63,7 @@ const messages = (0, import_TLI18n.defineMessages)({
63
63
  id: "error.reset-note",
64
64
  defaultMessage: "Resetting will erase your current project and any unsaved work."
65
65
  },
66
+ // No longer rendered, but still published translation keys that apps may override.
66
67
  messageLabel: { id: "error.message-label", defaultMessage: "Message:" },
67
68
  stackTraceLabel: { id: "error.stack-trace-label", defaultMessage: "Stack trace:" },
68
69
  copy: { id: "error.copy", defaultMessage: "Copy" },
@@ -97,6 +98,8 @@ function DefaultErrorFallback({ error, editor }) {
97
98
  }
98
99
  const errorMessage = error instanceof Error ? error.message : String(error);
99
100
  const errorStack = error instanceof Error ? error.stack : null;
101
+ const errorDetails = errorStack && !errorStack.includes(errorMessage) ? `${errorMessage}
102
+ ${errorStack}` : errorStack ?? errorMessage;
100
103
  const isDarkModeFromApp = (0, import_state_react.useValue)(
101
104
  "isDarkMode",
102
105
  () => {
@@ -143,7 +146,7 @@ function DefaultErrorFallback({ error, editor }) {
143
146
  const copyError = () => {
144
147
  const doc = (0, import_domUtils.getOwnerDocument)(containerRef.current);
145
148
  const textarea = doc.createElement("textarea");
146
- textarea.value = errorStack ?? errorMessage;
149
+ textarea.value = errorDetails;
147
150
  doc.body.appendChild(textarea);
148
151
  textarea.select();
149
152
  doc.execCommand("copy");
@@ -196,48 +199,87 @@ My browser: ${navigator.userAgent}`
196
199
  "tl-error-boundary__content__expanded": shouldShowError && !shouldShowResetConfirmation
197
200
  }),
198
201
  children: shouldShowResetConfirmation ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
199
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: msg(messages.confirmResetTitle) }),
200
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: msg(messages.confirmResetDescription) }),
202
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "tl-error-boundary__title", children: msg(messages.confirmResetTitle) }),
203
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tl-error-boundary__body", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: msg(messages.confirmResetDescription) }) }),
201
204
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-error-boundary__content__actions", children: [
202
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "tlui-button", onClick: () => setShouldShowResetConfirmation(false), children: msg(messages.cancel) }),
203
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "tlui-button tl-error-boundary__reset", onClick: resetLocalState, children: msg(messages.resetData) })
205
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}),
206
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-error-boundary__content__actions__group", children: [
207
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
208
+ "button",
209
+ {
210
+ className: "tlui-button tl-error-boundary__button",
211
+ onClick: () => setShouldShowResetConfirmation(false),
212
+ children: msg(messages.cancel)
213
+ }
214
+ ),
215
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
216
+ "button",
217
+ {
218
+ className: "tlui-button tl-error-boundary__button tl-error-boundary__reset",
219
+ onClick: resetLocalState,
220
+ children: msg(messages.resetData)
221
+ }
222
+ )
223
+ ] })
204
224
  ] })
205
225
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
206
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: msg(messages.title) }),
207
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: msg(messages.refreshHint) }),
208
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: msg(messages.resetHint) }),
209
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
210
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: msg(messages.noteLabel) }),
211
- " ",
212
- msg(messages.resetNote)
213
- ] }),
214
- process.env.NODE_ENV !== "production" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
215
- "If you're developing with the SDK and need help, join us on",
216
- " ",
217
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen", children: "Discord" }),
218
- "."
219
- ] }),
220
- shouldShowError && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
221
- msg(messages.messageLabel),
222
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: errorMessage }) }),
223
- msg(messages.stackTraceLabel),
224
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-error-boundary__content__error", children: [
225
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: errorStack ?? errorMessage }) }),
226
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "tlui-button", onClick: copyError, children: didCopy ? msg(messages.copied) : msg(messages.copy) })
226
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "tl-error-boundary__title", children: msg(messages.title) }),
227
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-error-boundary__body", children: [
228
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
229
+ msg(messages.refreshHint),
230
+ " ",
231
+ msg(messages.resetHint),
232
+ " ",
233
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: msg(messages.noteLabel) }),
234
+ " ",
235
+ msg(messages.resetNote)
236
+ ] }),
237
+ process.env.NODE_ENV !== "production" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
238
+ "If you're developing with the SDK and need help, join us on",
239
+ " ",
240
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen", children: "Discord" }),
241
+ "."
242
+ ] }),
243
+ shouldShowError && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-error-boundary__stack", "data-copied": didCopy, children: [
244
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: errorDetails }) }),
245
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
246
+ "button",
247
+ {
248
+ className: "tlui-button tl-error-boundary__button tl-error-boundary__copy",
249
+ onClick: copyError,
250
+ title: didCopy ? msg(messages.copied) : msg(messages.copy),
251
+ "aria-label": didCopy ? msg(messages.copied) : msg(messages.copy),
252
+ children: didCopy ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyIcon, {})
253
+ }
254
+ )
227
255
  ] })
228
256
  ] }),
229
257
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-error-boundary__content__actions", children: [
230
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "tlui-button", onClick: () => setShouldShowError(!shouldShowError), children: shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails) }),
258
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
259
+ "button",
260
+ {
261
+ className: "tlui-button tl-error-boundary__button",
262
+ onClick: () => setShouldShowError(!shouldShowError),
263
+ children: shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails)
264
+ }
265
+ ),
231
266
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-error-boundary__content__actions__group", children: [
232
267
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
233
268
  "button",
234
269
  {
235
- className: "tlui-button tl-error-boundary__reset",
270
+ className: "tlui-button tl-error-boundary__button tl-error-boundary__reset",
236
271
  onClick: () => setShouldShowResetConfirmation(true),
237
272
  children: msg(messages.resetData)
238
273
  }
239
274
  ),
240
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "tlui-button tl-error-boundary__refresh", onClick: refresh, children: msg(messages.refreshPage) })
275
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
276
+ "button",
277
+ {
278
+ className: "tlui-button tl-error-boundary__button tl-error-boundary__refresh",
279
+ onClick: refresh,
280
+ children: msg(messages.refreshPage)
281
+ }
282
+ )
241
283
  ] })
242
284
  ] })
243
285
  ] })
@@ -247,4 +289,24 @@ My browser: ${navigator.userAgent}`
247
289
  }
248
290
  );
249
291
  }
292
+ function CopyIcon() {
293
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 30 30", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
294
+ "path",
295
+ {
296
+ fillRule: "evenodd",
297
+ clipRule: "evenodd",
298
+ d: "M2 19.0001C2 20.6569 3.34315 22.0001 5 22.0001H8L8 20.0001H5C4.44772 20.0001 4 19.5524 4 19.0001L4 5.00009C4 4.44781 4.44772 4.00009 5 4.00009L19 4.00009C19.5523 4.00009 20 4.44781 20 5.00009V8.00001H11C9.34315 8.00001 8 9.34316 8 11V25C8 26.6569 9.34315 28 11 28H25C26.6569 28 28 26.6569 28 25V11C28 9.34316 26.6569 8.00001 25 8.00001H22V5.00009C22 3.34324 20.6569 2.00009 19 2.00009H5C3.34315 2.00009 2 3.34324 2 5.00009V19.0001ZM10 11C10 10.4477 10.4477 10 11 10H25C25.5523 10 26 10.4477 26 11V25C26 25.5523 25.5523 26 25 26H11C10.4477 26 10 25.5523 10 25V11Z",
299
+ fill: "currentColor"
300
+ }
301
+ ) });
302
+ }
303
+ function CheckIcon() {
304
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 30 30", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
305
+ "path",
306
+ {
307
+ d: "M22.9339 7.45369C23.5118 7.83148 23.6739 8.60615 23.2961 9.18396L14.7961 22.184C14.5958 22.4903 14.2712 22.6935 13.9082 22.7398C13.5451 22.7862 13.1799 22.6711 12.909 22.4248L7.40905 17.4248C6.89822 16.9604 6.86058 16.1699 7.32496 15.6591C7.78935 15.1482 8.57991 15.1106 9.09073 15.575L13.506 19.5888L21.2037 7.81584C21.5815 7.23803 22.3561 7.07589 22.9339 7.45369Z",
308
+ fill: "currentColor"
309
+ }
310
+ ) });
311
+ }
250
312
  //# sourceMappingURL=DefaultErrorFallback.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/components/default-components/DefaultErrorFallback.tsx"],
4
- "sourcesContent": ["import { useValue } from '@tldraw/state-react'\nimport { noop } from '@tldraw/utils'\nimport classNames from 'classnames'\nimport { ComponentType, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport {\n\tdefineMessages,\n\ttranslateMessage,\n\ttype TLI18nMessage,\n\ttype TLI18nValues,\n} from '../../config/TLI18n'\nimport { Editor } from '../../editor/Editor'\nimport { getOwnerDocument } from '../../exports/domUtils'\nimport { useEditorComponents } from '../../hooks/EditorComponentsContext'\nimport { EditorProvider } from '../../hooks/useEditor'\nimport { getGlobalWindow } from '../../utils/dom'\nimport { hardResetEditor, refreshPage } from '../../utils/runtime'\nimport { ErrorBoundary } from '../ErrorBoundary'\n\nconst BASE_ERROR_URL = 'https://github.com/tldraw/tldraw/issues/new'\n\nconst messages = defineMessages({\n\tconfirmResetTitle: { id: 'error.confirm-reset.title', defaultMessage: 'Are you sure?' },\n\tconfirmResetDescription: {\n\t\tid: 'error.confirm-reset.description',\n\t\tdefaultMessage: 'Resetting your data will delete your drawing and cannot be undone.',\n\t},\n\tcancel: { id: 'error.cancel', defaultMessage: 'Cancel' },\n\tresetData: { id: 'error.reset-data', defaultMessage: 'Reset data' },\n\ttitle: { id: 'error.title', defaultMessage: 'Something went wrong' },\n\trefreshHint: { id: 'error.refresh-hint', defaultMessage: 'Please refresh your browser.' },\n\tresetHint: {\n\t\tid: 'error.reset-hint',\n\t\tdefaultMessage:\n\t\t\t'If the issue continues after refreshing, you may need to reset the tldraw data stored on your device.',\n\t},\n\tnoteLabel: { id: 'error.note-label', defaultMessage: 'Note:' },\n\tresetNote: {\n\t\tid: 'error.reset-note',\n\t\tdefaultMessage: 'Resetting will erase your current project and any unsaved work.',\n\t},\n\tmessageLabel: { id: 'error.message-label', defaultMessage: 'Message:' },\n\tstackTraceLabel: { id: 'error.stack-trace-label', defaultMessage: 'Stack trace:' },\n\tcopy: { id: 'error.copy', defaultMessage: 'Copy' },\n\tcopied: { id: 'error.copied', defaultMessage: 'Copied!' },\n\tshowDetails: { id: 'error.show-details', defaultMessage: 'Show details' },\n\thideDetails: { id: 'error.hide-details', defaultMessage: 'Hide details' },\n\trefreshPage: { id: 'error.refresh-page', defaultMessage: 'Refresh page' },\n})\n\n// This renders because something already threw, so reading the editor is done defensively the way\n// the rest of this component reads it: English beats a second crash on the error screen.\nfunction useErrorMsg(editor: Editor | undefined) {\n\treturn useCallback(\n\t\t(message: TLI18nMessage, values?: TLI18nValues) => {\n\t\t\ttry {\n\t\t\t\treturn translateMessage(editor?.i18n(), message, values)\n\t\t\t} catch {\n\t\t\t\treturn message.defaultMessage\n\t\t\t}\n\t\t},\n\t\t[editor]\n\t)\n}\n\n/** @public */\nexport interface TLErrorFallbackProps {\n\t/** The error that was caught. */\n\terror: unknown\n\t/**\n\t * Only set when the caller renders the fallback with an editor; the editor's own error\n\t * boundaries pass just `error`.\n\t */\n\teditor?: Editor\n}\n\n/** @public */\nexport type TLErrorFallbackComponent = ComponentType<TLErrorFallbackProps>\n\n/** @public @react */\nexport function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps) {\n\tconst msg = useErrorMsg(editor)\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\tconst [shouldShowError, setShouldShowError] = useState(process.env.NODE_ENV === 'development')\n\tconst [didCopy, setDidCopy] = useState(false)\n\tconst [shouldShowResetConfirmation, setShouldShowResetConfirmation] = useState(false)\n\n\tlet Canvas: React.ComponentType | null = null\n\ttry {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst components = useEditorComponents()\n\t\tCanvas = components.Canvas ?? null\n\t} catch {\n\t\t// allow this to fail silently\n\t}\n\n\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\tconst errorStack = error instanceof Error ? error.stack : null\n\n\tconst isDarkModeFromApp = useValue(\n\t\t'isDarkMode',\n\t\t() => {\n\t\t\ttry {\n\t\t\t\tif (editor) {\n\t\t\t\t\treturn editor.user.getIsDarkMode()\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// we're in a funky error state so this might not work for spooky\n\t\t\t\t// reasons. if not, we'll have another attempt later:\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\t[editor]\n\t)\n\tconst [isDarkMode, setIsDarkMode] = useState<null | boolean>(null)\n\tuseLayoutEffect(() => {\n\t\t// if we found a theme class from the app, we can just use that\n\t\tif (isDarkModeFromApp !== null) {\n\t\t\tsetIsDarkMode(isDarkModeFromApp)\n\t\t}\n\n\t\t// do any of our parents have a theme class? if yes then we can just\n\t\t// rely on that and don't need to set our own class\n\t\tlet parent = containerRef.current?.parentElement\n\t\tlet foundParentThemeClass = false\n\t\twhile (parent) {\n\t\t\tif (\n\t\t\t\tparent.classList.contains('tl-theme__dark') ||\n\t\t\t\tparent.classList.contains('tl-theme__light')\n\t\t\t) {\n\t\t\t\tfoundParentThemeClass = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tparent = parent.parentElement\n\t\t}\n\t\tif (foundParentThemeClass) {\n\t\t\tsetIsDarkMode(null)\n\t\t\treturn\n\t\t}\n\n\t\t// if we can't find a theme class from the app or from a parent, we have\n\t\t// to fall back on using a media query:\n\t\tif (typeof window !== 'undefined' && getGlobalWindow().matchMedia) {\n\t\t\tsetIsDarkMode(getGlobalWindow().matchMedia('(prefers-color-scheme: dark)').matches)\n\t\t}\n\t}, [isDarkModeFromApp])\n\n\tuseEffect(() => {\n\t\tif (didCopy) {\n\t\t\tconst timeout = editor?.timers.setTimeout(() => {\n\t\t\t\tsetDidCopy(false)\n\t\t\t}, 2000)\n\t\t\treturn () => clearTimeout(timeout)\n\t\t}\n\t}, [didCopy, editor])\n\n\tconst copyError = () => {\n\t\tconst doc = getOwnerDocument(containerRef.current)\n\t\tconst textarea = doc.createElement('textarea')\n\t\ttextarea.value = errorStack ?? errorMessage\n\t\tdoc.body.appendChild(textarea)\n\t\ttextarea.select()\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\t\tdoc.execCommand('copy')\n\t\ttextarea.remove()\n\t\tsetDidCopy(true)\n\t}\n\n\tconst refresh = () => {\n\t\trefreshPage()\n\t}\n\n\tconst resetLocalState = async () => {\n\t\thardResetEditor()\n\t}\n\n\tconst url = new URL(BASE_ERROR_URL)\n\turl.searchParams.set('title', errorMessage)\n\turl.searchParams.set('labels', `bug`)\n\turl.searchParams.set(\n\t\t'body',\n\t\t`Hey, I ran into an error while using tldraw:\n\n\\`\\`\\`js\n${errorStack ?? errorMessage}\n\\`\\`\\`\n\nMy browser: ${navigator.userAgent}`\n\t)\n\n\treturn (\n\t\t<div\n\t\t\tref={containerRef}\n\t\t\tclassName={classNames(\n\t\t\t\t'tl-container tl-error-boundary',\n\t\t\t\t// error-boundary is sometimes used outside of the theme\n\t\t\t\t// container, so we need to provide it with a theme for our\n\t\t\t\t// styles to work correctly\n\t\t\t\tisDarkMode === null ? '' : isDarkMode ? 'tl-theme__dark' : 'tl-theme__light'\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"tl-error-boundary__overlay\" />\n\t\t\t{editor && (\n\t\t\t\t// opportunistically attempt to render the canvas to reassure\n\t\t\t\t// the user that their document is still there. there's a good\n\t\t\t\t// chance this won't work (ie the error that we're currently\n\t\t\t\t// notifying the user about originates in the canvas) so it's\n\t\t\t\t// not a big deal if it doesn't work - in that case we just have\n\t\t\t\t// a plain grey background.\n\t\t\t\t<ErrorBoundary onError={noop} fallback={() => null}>\n\t\t\t\t\t<EditorProvider editor={editor}>\n\t\t\t\t\t\t<div className=\"tl-overlay tl-error-boundary__canvas\">{Canvas ? <Canvas /> : null}</div>\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</ErrorBoundary>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tclassName={classNames('tl-modal', 'tl-error-boundary__content', {\n\t\t\t\t\t'tl-error-boundary__content__expanded': shouldShowError && !shouldShowResetConfirmation,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{shouldShowResetConfirmation ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2>{msg(messages.confirmResetTitle)}</h2>\n\t\t\t\t\t\t<p>{msg(messages.confirmResetDescription)}</p>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions\">\n\t\t\t\t\t\t\t<button className=\"tlui-button\" onClick={() => setShouldShowResetConfirmation(false)}>\n\t\t\t\t\t\t\t\t{msg(messages.cancel)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<button className=\"tlui-button tl-error-boundary__reset\" onClick={resetLocalState}>\n\t\t\t\t\t\t\t\t{msg(messages.resetData)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2>{msg(messages.title)}</h2>\n\t\t\t\t\t\t<p>{msg(messages.refreshHint)}</p>\n\t\t\t\t\t\t<p>{msg(messages.resetHint)}</p>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<strong>{msg(messages.noteLabel)}</strong> {msg(messages.resetNote)}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t{process.env.NODE_ENV !== 'production' && (\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\tIf you&apos;re developing with the SDK and need help, join us on{' '}\n\t\t\t\t\t\t\t\t<a href=\"https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen\">\n\t\t\t\t\t\t\t\t\tDiscord\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{shouldShowError && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{msg(messages.messageLabel)}\n\t\t\t\t\t\t\t\t<h4>\n\t\t\t\t\t\t\t\t\t<code>{errorMessage}</code>\n\t\t\t\t\t\t\t\t</h4>\n\t\t\t\t\t\t\t\t{msg(messages.stackTraceLabel)}\n\t\t\t\t\t\t\t\t<div className=\"tl-error-boundary__content__error\">\n\t\t\t\t\t\t\t\t\t<pre>\n\t\t\t\t\t\t\t\t\t\t<code>{errorStack ?? errorMessage}</code>\n\t\t\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t\t\t\t<button className=\"tlui-button\" onClick={copyError}>\n\t\t\t\t\t\t\t\t\t\t{didCopy ? msg(messages.copied) : msg(messages.copy)}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions\">\n\t\t\t\t\t\t\t<button className=\"tlui-button\" onClick={() => setShouldShowError(!shouldShowError)}>\n\t\t\t\t\t\t\t\t{shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions__group\">\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__reset\"\n\t\t\t\t\t\t\t\t\tonClick={() => setShouldShowResetConfirmation(true)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.resetData)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button className=\"tlui-button tl-error-boundary__refresh\" onClick={refresh}>\n\t\t\t\t\t\t\t\t\t{msg(messages.refreshPage)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwMG;AAxMH,yBAAyB;AACzB,mBAAqB;AACrB,wBAAuB;AACvB,mBAAyF;AACzF,oBAKO;AAEP,sBAAiC;AACjC,qCAAoC;AACpC,uBAA+B;AAC/B,iBAAgC;AAChC,qBAA6C;AAC7C,2BAA8B;AAE9B,MAAM,iBAAiB;AAEvB,MAAM,eAAW,8BAAe;AAAA,EAC/B,mBAAmB,EAAE,IAAI,6BAA6B,gBAAgB,gBAAgB;AAAA,EACtF,yBAAyB;AAAA,IACxB,IAAI;AAAA,IACJ,gBAAgB;AAAA,EACjB;AAAA,EACA,QAAQ,EAAE,IAAI,gBAAgB,gBAAgB,SAAS;AAAA,EACvD,WAAW,EAAE,IAAI,oBAAoB,gBAAgB,aAAa;AAAA,EAClE,OAAO,EAAE,IAAI,eAAe,gBAAgB,uBAAuB;AAAA,EAC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CAAyC,SAAS,SAClE,cAAI,SAAS,WAAW,GAC1B;AAAA,mBACD;AAAA,iBACD;AAAA,eACD;AAAA;AAAA,QAEF;AAAA;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["import { useValue } from '@tldraw/state-react'\nimport { noop } from '@tldraw/utils'\nimport classNames from 'classnames'\nimport { ComponentType, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport {\n\tdefineMessages,\n\ttranslateMessage,\n\ttype TLI18nMessage,\n\ttype TLI18nValues,\n} from '../../config/TLI18n'\nimport { Editor } from '../../editor/Editor'\nimport { getOwnerDocument } from '../../exports/domUtils'\nimport { useEditorComponents } from '../../hooks/EditorComponentsContext'\nimport { EditorProvider } from '../../hooks/useEditor'\nimport { getGlobalWindow } from '../../utils/dom'\nimport { hardResetEditor, refreshPage } from '../../utils/runtime'\nimport { ErrorBoundary } from '../ErrorBoundary'\n\nconst BASE_ERROR_URL = 'https://github.com/tldraw/tldraw/issues/new'\n\nconst messages = defineMessages({\n\tconfirmResetTitle: { id: 'error.confirm-reset.title', defaultMessage: 'Are you sure?' },\n\tconfirmResetDescription: {\n\t\tid: 'error.confirm-reset.description',\n\t\tdefaultMessage: 'Resetting your data will delete your drawing and cannot be undone.',\n\t},\n\tcancel: { id: 'error.cancel', defaultMessage: 'Cancel' },\n\tresetData: { id: 'error.reset-data', defaultMessage: 'Reset data' },\n\ttitle: { id: 'error.title', defaultMessage: 'Something went wrong' },\n\trefreshHint: { id: 'error.refresh-hint', defaultMessage: 'Please refresh your browser.' },\n\tresetHint: {\n\t\tid: 'error.reset-hint',\n\t\tdefaultMessage:\n\t\t\t'If the issue continues after refreshing, you may need to reset the tldraw data stored on your device.',\n\t},\n\tnoteLabel: { id: 'error.note-label', defaultMessage: 'Note:' },\n\tresetNote: {\n\t\tid: 'error.reset-note',\n\t\tdefaultMessage: 'Resetting will erase your current project and any unsaved work.',\n\t},\n\t// No longer rendered, but still published translation keys that apps may override.\n\tmessageLabel: { id: 'error.message-label', defaultMessage: 'Message:' },\n\tstackTraceLabel: { id: 'error.stack-trace-label', defaultMessage: 'Stack trace:' },\n\tcopy: { id: 'error.copy', defaultMessage: 'Copy' },\n\tcopied: { id: 'error.copied', defaultMessage: 'Copied!' },\n\tshowDetails: { id: 'error.show-details', defaultMessage: 'Show details' },\n\thideDetails: { id: 'error.hide-details', defaultMessage: 'Hide details' },\n\trefreshPage: { id: 'error.refresh-page', defaultMessage: 'Refresh page' },\n})\n\n// This renders because something already threw, so reading the editor is done defensively the way\n// the rest of this component reads it: English beats a second crash on the error screen.\nfunction useErrorMsg(editor: Editor | undefined) {\n\treturn useCallback(\n\t\t(message: TLI18nMessage, values?: TLI18nValues) => {\n\t\t\ttry {\n\t\t\t\treturn translateMessage(editor?.i18n(), message, values)\n\t\t\t} catch {\n\t\t\t\treturn message.defaultMessage\n\t\t\t}\n\t\t},\n\t\t[editor]\n\t)\n}\n\n/** @public */\nexport interface TLErrorFallbackProps {\n\t/** The error that was caught. */\n\terror: unknown\n\t/**\n\t * Only set when the caller renders the fallback with an editor; the editor's own error\n\t * boundaries pass just `error`.\n\t */\n\teditor?: Editor\n}\n\n/** @public */\nexport type TLErrorFallbackComponent = ComponentType<TLErrorFallbackProps>\n\n/** @public @react */\nexport function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps) {\n\tconst msg = useErrorMsg(editor)\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\tconst [shouldShowError, setShouldShowError] = useState(process.env.NODE_ENV === 'development')\n\tconst [didCopy, setDidCopy] = useState(false)\n\tconst [shouldShowResetConfirmation, setShouldShowResetConfirmation] = useState(false)\n\n\tlet Canvas: React.ComponentType | null = null\n\ttry {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst components = useEditorComponents()\n\t\tCanvas = components.Canvas ?? null\n\t} catch {\n\t\t// allow this to fail silently\n\t}\n\n\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\tconst errorStack = error instanceof Error ? error.stack : null\n\t// Chrome's stack starts with the message; Safari and Firefox leave it out.\n\tconst errorDetails =\n\t\terrorStack && !errorStack.includes(errorMessage)\n\t\t\t? `${errorMessage}\\n${errorStack}`\n\t\t\t: (errorStack ?? errorMessage)\n\n\tconst isDarkModeFromApp = useValue(\n\t\t'isDarkMode',\n\t\t() => {\n\t\t\ttry {\n\t\t\t\tif (editor) {\n\t\t\t\t\treturn editor.user.getIsDarkMode()\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// we're in a funky error state so this might not work for spooky\n\t\t\t\t// reasons. if not, we'll have another attempt later:\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\t[editor]\n\t)\n\tconst [isDarkMode, setIsDarkMode] = useState<null | boolean>(null)\n\tuseLayoutEffect(() => {\n\t\t// if we found a theme class from the app, we can just use that\n\t\tif (isDarkModeFromApp !== null) {\n\t\t\tsetIsDarkMode(isDarkModeFromApp)\n\t\t}\n\n\t\t// do any of our parents have a theme class? if yes then we can just\n\t\t// rely on that and don't need to set our own class\n\t\tlet parent = containerRef.current?.parentElement\n\t\tlet foundParentThemeClass = false\n\t\twhile (parent) {\n\t\t\tif (\n\t\t\t\tparent.classList.contains('tl-theme__dark') ||\n\t\t\t\tparent.classList.contains('tl-theme__light')\n\t\t\t) {\n\t\t\t\tfoundParentThemeClass = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tparent = parent.parentElement\n\t\t}\n\t\tif (foundParentThemeClass) {\n\t\t\tsetIsDarkMode(null)\n\t\t\treturn\n\t\t}\n\n\t\t// if we can't find a theme class from the app or from a parent, we have\n\t\t// to fall back on using a media query:\n\t\tif (typeof window !== 'undefined' && getGlobalWindow().matchMedia) {\n\t\t\tsetIsDarkMode(getGlobalWindow().matchMedia('(prefers-color-scheme: dark)').matches)\n\t\t}\n\t}, [isDarkModeFromApp])\n\n\tuseEffect(() => {\n\t\tif (didCopy) {\n\t\t\tconst timeout = editor?.timers.setTimeout(() => {\n\t\t\t\tsetDidCopy(false)\n\t\t\t}, 2000)\n\t\t\treturn () => clearTimeout(timeout)\n\t\t}\n\t}, [didCopy, editor])\n\n\tconst copyError = () => {\n\t\tconst doc = getOwnerDocument(containerRef.current)\n\t\tconst textarea = doc.createElement('textarea')\n\t\ttextarea.value = errorDetails\n\t\tdoc.body.appendChild(textarea)\n\t\ttextarea.select()\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\t\tdoc.execCommand('copy')\n\t\ttextarea.remove()\n\t\tsetDidCopy(true)\n\t}\n\n\tconst refresh = () => {\n\t\trefreshPage()\n\t}\n\n\tconst resetLocalState = async () => {\n\t\thardResetEditor()\n\t}\n\n\tconst url = new URL(BASE_ERROR_URL)\n\turl.searchParams.set('title', errorMessage)\n\turl.searchParams.set('labels', `bug`)\n\turl.searchParams.set(\n\t\t'body',\n\t\t`Hey, I ran into an error while using tldraw:\n\n\\`\\`\\`js\n${errorStack ?? errorMessage}\n\\`\\`\\`\n\nMy browser: ${navigator.userAgent}`\n\t)\n\n\treturn (\n\t\t<div\n\t\t\tref={containerRef}\n\t\t\tclassName={classNames(\n\t\t\t\t'tl-container tl-error-boundary',\n\t\t\t\t// error-boundary is sometimes used outside of the theme\n\t\t\t\t// container, so we need to provide it with a theme for our\n\t\t\t\t// styles to work correctly\n\t\t\t\tisDarkMode === null ? '' : isDarkMode ? 'tl-theme__dark' : 'tl-theme__light'\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"tl-error-boundary__overlay\" />\n\t\t\t{editor && (\n\t\t\t\t// opportunistically attempt to render the canvas to reassure\n\t\t\t\t// the user that their document is still there. there's a good\n\t\t\t\t// chance this won't work (ie the error that we're currently\n\t\t\t\t// notifying the user about originates in the canvas) so it's\n\t\t\t\t// not a big deal if it doesn't work - in that case we just have\n\t\t\t\t// a plain grey background.\n\t\t\t\t<ErrorBoundary onError={noop} fallback={() => null}>\n\t\t\t\t\t<EditorProvider editor={editor}>\n\t\t\t\t\t\t<div className=\"tl-overlay tl-error-boundary__canvas\">{Canvas ? <Canvas /> : null}</div>\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</ErrorBoundary>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tclassName={classNames('tl-modal', 'tl-error-boundary__content', {\n\t\t\t\t\t'tl-error-boundary__content__expanded': shouldShowError && !shouldShowResetConfirmation,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{shouldShowResetConfirmation ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2 className=\"tl-error-boundary__title\">{msg(messages.confirmResetTitle)}</h2>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__body\">\n\t\t\t\t\t\t\t<p>{msg(messages.confirmResetDescription)}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions\">\n\t\t\t\t\t\t\t<div />\n\t\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions__group\">\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button\"\n\t\t\t\t\t\t\t\t\tonClick={() => setShouldShowResetConfirmation(false)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.cancel)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button tl-error-boundary__reset\"\n\t\t\t\t\t\t\t\t\tonClick={resetLocalState}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.resetData)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2 className=\"tl-error-boundary__title\">{msg(messages.title)}</h2>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__body\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{msg(messages.refreshHint)} {msg(messages.resetHint)}{' '}\n\t\t\t\t\t\t\t\t<strong>{msg(messages.noteLabel)}</strong> {msg(messages.resetNote)}\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t{process.env.NODE_ENV !== 'production' && (\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\tIf you&apos;re developing with the SDK and need help, join us on{' '}\n\t\t\t\t\t\t\t\t\t<a href=\"https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen\">\n\t\t\t\t\t\t\t\t\t\tDiscord\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{shouldShowError && (\n\t\t\t\t\t\t\t\t<div className=\"tl-error-boundary__stack\" data-copied={didCopy}>\n\t\t\t\t\t\t\t\t\t<pre>\n\t\t\t\t\t\t\t\t\t\t<code>{errorDetails}</code>\n\t\t\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button tl-error-boundary__copy\"\n\t\t\t\t\t\t\t\t\t\tonClick={copyError}\n\t\t\t\t\t\t\t\t\t\ttitle={didCopy ? msg(messages.copied) : msg(messages.copy)}\n\t\t\t\t\t\t\t\t\t\taria-label={didCopy ? msg(messages.copied) : msg(messages.copy)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{didCopy ? <CheckIcon /> : <CopyIcon />}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions\">\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button\"\n\t\t\t\t\t\t\t\tonClick={() => setShouldShowError(!shouldShowError)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions__group\">\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button tl-error-boundary__reset\"\n\t\t\t\t\t\t\t\t\tonClick={() => setShouldShowResetConfirmation(true)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.resetData)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button tl-error-boundary__refresh\"\n\t\t\t\t\t\t\t\t\tonClick={refresh}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.refreshPage)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nfunction CopyIcon() {\n\treturn (\n\t\t<svg width=\"16\" height=\"16\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M2 19.0001C2 20.6569 3.34315 22.0001 5 22.0001H8L8 20.0001H5C4.44772 20.0001 4 19.5524 4 19.0001L4 5.00009C4 4.44781 4.44772 4.00009 5 4.00009L19 4.00009C19.5523 4.00009 20 4.44781 20 5.00009V8.00001H11C9.34315 8.00001 8 9.34316 8 11V25C8 26.6569 9.34315 28 11 28H25C26.6569 28 28 26.6569 28 25V11C28 9.34316 26.6569 8.00001 25 8.00001H22V5.00009C22 3.34324 20.6569 2.00009 19 2.00009H5C3.34315 2.00009 2 3.34324 2 5.00009V19.0001ZM10 11C10 10.4477 10.4477 10 11 10H25C25.5523 10 26 10.4477 26 11V25C26 25.5523 25.5523 26 25 26H11C10.4477 26 10 25.5523 10 25V11Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction CheckIcon() {\n\treturn (\n\t\t<svg width=\"16\" height=\"16\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M22.9339 7.45369C23.5118 7.83148 23.6739 8.60615 23.2961 9.18396L14.7961 22.184C14.5958 22.4903 14.2712 22.6935 13.9082 22.7398C13.5451 22.7862 13.1799 22.6711 12.909 22.4248L7.40905 17.4248C6.89822 16.9604 6.86058 16.1699 7.32496 15.6591C7.78935 15.1482 8.57991 15.1106 9.09073 15.575L13.506 19.5888L21.2037 7.81584C21.5815 7.23803 22.3561 7.07589 22.9339 7.45369Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8MG;AA9MH,yBAAyB;AACzB,mBAAqB;AACrB,wBAAuB;AACvB,mBAAyF;AACzF,oBAKO;AAEP,sBAAiC;AACjC,qCAAoC;AACpC,uBAA+B;AAC/B,iBAAgC;AAChC,qBAA6C;AAC7C,2BAA8B;AAE9B,MAAM,iBAAiB;AAEvB,MAAM,eAAW,8BAAe;AAAA,EAC/B,mBAAmB,EAAE,IAAI,6BAA6B,gBAAgB,gBAAgB;AAAA,EACtF,yBAAyB;AAAA,IACxB,IAAI;AAAA,IACJ,gBAAgB;AAAA,EACjB;AAAA,EACA,QAAQ,EAAE,IAAI,gBAAgB,gBAAgB,SAAS;AAAA,EACvD,WAAW,EAAE,IAAI,oBAAoB,gBAAgB,aAAa;AAAA,EAClE,OAAO,EAAE,IAAI,eAAe,gBAAgB,uBAAuB;AAAA,EACnE,aAAa,EAAE,IAA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;AAAA,cACA,6CAAC,SAAI,WAAU,uCACd;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,WAAU;AAAA,oBACV,SAAS,MAAM,mBAAmB,CAAC,eAAe;AAAA,oBAEjD,4BAAkB,IAAI,SAAS,WAAW,IAAI,IAAI,SAAS,WAAW;AAAA;AAAA,gBACxE;AAAA,gBACA,6CAAC,SAAI,WAAU,8CACd;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAU;AAAA,sBACV,SAAS,MAAM,+BAA+B,IAAI;AAAA,sBAEjD,cAAI,SAAS,SAAS;AAAA;AAAA,kBACxB;AAAA,kBACA;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAU;AAAA,sBACV,SAAS;AAAA,sBAER,cAAI,SAAS,WAAW;AAAA;AAAA,kBAC1B;AAAA,mBACD;AAAA,iBACD;AAAA,eACD;AAAA;AAAA,QAEF;AAAA;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,WAAW;AACnB,SACC,4CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,UAAS;AAAA,MACT,UAAS;AAAA,MACT,GAAE;AAAA,MACF,MAAK;AAAA;AAAA,EACN,GACD;AAEF;AAEA,SAAS,YAAY;AACpB,SACC,4CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,GAAE;AAAA,MACF,MAAK;AAAA;AAAA,EACN,GACD;AAEF;",
6
6
  "names": ["classNames"]
7
7
  }
@@ -22,10 +22,10 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- const version = "5.7.0-canary.986cfb91c3b4";
25
+ const version = "5.7.0-canary.98770694aa48";
26
26
  const publishDates = {
27
27
  major: "2026-05-06T16:28:18.473Z",
28
- minor: "2026-11-10T16:01:36.695Z",
29
- patch: "2026-11-10T16:01:36.695Z"
28
+ minor: "2026-11-16T15:16:43.648Z",
29
+ patch: "2026-11-16T15:16:43.648Z"
30
30
  };
31
31
  //# sourceMappingURL=version.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/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 = '5.7.0-canary.986cfb91c3b4'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-11-10T16:01:36.695Z',\n\tpatch: '2026-11-10T16:01:36.695Z',\n}\n"],
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 = '5.7.0-canary.98770694aa48'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-11-16T15:16:43.648Z',\n\tpatch: '2026-11-16T15:16:43.648Z',\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -319,7 +319,7 @@ import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
319
319
  import { uniq } from "./lib/utils/uniq.mjs";
320
320
  registerTldrawLibraryVersion(
321
321
  "@tldraw/editor",
322
- "5.7.0-canary.986cfb91c3b4",
322
+ "5.7.0-canary.98770694aa48",
323
323
  "esm"
324
324
  );
325
325
  import { getColorValue } from "./lib/editor/managers/ThemeManager/defaultThemes.mjs";
@@ -33,6 +33,7 @@ const messages = defineMessages({
33
33
  id: "error.reset-note",
34
34
  defaultMessage: "Resetting will erase your current project and any unsaved work."
35
35
  },
36
+ // No longer rendered, but still published translation keys that apps may override.
36
37
  messageLabel: { id: "error.message-label", defaultMessage: "Message:" },
37
38
  stackTraceLabel: { id: "error.stack-trace-label", defaultMessage: "Stack trace:" },
38
39
  copy: { id: "error.copy", defaultMessage: "Copy" },
@@ -67,6 +68,8 @@ function DefaultErrorFallback({ error, editor }) {
67
68
  }
68
69
  const errorMessage = error instanceof Error ? error.message : String(error);
69
70
  const errorStack = error instanceof Error ? error.stack : null;
71
+ const errorDetails = errorStack && !errorStack.includes(errorMessage) ? `${errorMessage}
72
+ ${errorStack}` : errorStack ?? errorMessage;
70
73
  const isDarkModeFromApp = useValue(
71
74
  "isDarkMode",
72
75
  () => {
@@ -113,7 +116,7 @@ function DefaultErrorFallback({ error, editor }) {
113
116
  const copyError = () => {
114
117
  const doc = getOwnerDocument(containerRef.current);
115
118
  const textarea = doc.createElement("textarea");
116
- textarea.value = errorStack ?? errorMessage;
119
+ textarea.value = errorDetails;
117
120
  doc.body.appendChild(textarea);
118
121
  textarea.select();
119
122
  doc.execCommand("copy");
@@ -166,48 +169,87 @@ My browser: ${navigator.userAgent}`
166
169
  "tl-error-boundary__content__expanded": shouldShowError && !shouldShowResetConfirmation
167
170
  }),
168
171
  children: shouldShowResetConfirmation ? /* @__PURE__ */ jsxs(Fragment, { children: [
169
- /* @__PURE__ */ jsx("h2", { children: msg(messages.confirmResetTitle) }),
170
- /* @__PURE__ */ jsx("p", { children: msg(messages.confirmResetDescription) }),
172
+ /* @__PURE__ */ jsx("h2", { className: "tl-error-boundary__title", children: msg(messages.confirmResetTitle) }),
173
+ /* @__PURE__ */ jsx("div", { className: "tl-error-boundary__body", children: /* @__PURE__ */ jsx("p", { children: msg(messages.confirmResetDescription) }) }),
171
174
  /* @__PURE__ */ jsxs("div", { className: "tl-error-boundary__content__actions", children: [
172
- /* @__PURE__ */ jsx("button", { className: "tlui-button", onClick: () => setShouldShowResetConfirmation(false), children: msg(messages.cancel) }),
173
- /* @__PURE__ */ jsx("button", { className: "tlui-button tl-error-boundary__reset", onClick: resetLocalState, children: msg(messages.resetData) })
175
+ /* @__PURE__ */ jsx("div", {}),
176
+ /* @__PURE__ */ jsxs("div", { className: "tl-error-boundary__content__actions__group", children: [
177
+ /* @__PURE__ */ jsx(
178
+ "button",
179
+ {
180
+ className: "tlui-button tl-error-boundary__button",
181
+ onClick: () => setShouldShowResetConfirmation(false),
182
+ children: msg(messages.cancel)
183
+ }
184
+ ),
185
+ /* @__PURE__ */ jsx(
186
+ "button",
187
+ {
188
+ className: "tlui-button tl-error-boundary__button tl-error-boundary__reset",
189
+ onClick: resetLocalState,
190
+ children: msg(messages.resetData)
191
+ }
192
+ )
193
+ ] })
174
194
  ] })
175
195
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
176
- /* @__PURE__ */ jsx("h2", { children: msg(messages.title) }),
177
- /* @__PURE__ */ jsx("p", { children: msg(messages.refreshHint) }),
178
- /* @__PURE__ */ jsx("p", { children: msg(messages.resetHint) }),
179
- /* @__PURE__ */ jsxs("p", { children: [
180
- /* @__PURE__ */ jsx("strong", { children: msg(messages.noteLabel) }),
181
- " ",
182
- msg(messages.resetNote)
183
- ] }),
184
- process.env.NODE_ENV !== "production" && /* @__PURE__ */ jsxs("p", { children: [
185
- "If you're developing with the SDK and need help, join us on",
186
- " ",
187
- /* @__PURE__ */ jsx("a", { href: "https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen", children: "Discord" }),
188
- "."
189
- ] }),
190
- shouldShowError && /* @__PURE__ */ jsxs(Fragment, { children: [
191
- msg(messages.messageLabel),
192
- /* @__PURE__ */ jsx("h4", { children: /* @__PURE__ */ jsx("code", { children: errorMessage }) }),
193
- msg(messages.stackTraceLabel),
194
- /* @__PURE__ */ jsxs("div", { className: "tl-error-boundary__content__error", children: [
195
- /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: errorStack ?? errorMessage }) }),
196
- /* @__PURE__ */ jsx("button", { className: "tlui-button", onClick: copyError, children: didCopy ? msg(messages.copied) : msg(messages.copy) })
196
+ /* @__PURE__ */ jsx("h2", { className: "tl-error-boundary__title", children: msg(messages.title) }),
197
+ /* @__PURE__ */ jsxs("div", { className: "tl-error-boundary__body", children: [
198
+ /* @__PURE__ */ jsxs("p", { children: [
199
+ msg(messages.refreshHint),
200
+ " ",
201
+ msg(messages.resetHint),
202
+ " ",
203
+ /* @__PURE__ */ jsx("strong", { children: msg(messages.noteLabel) }),
204
+ " ",
205
+ msg(messages.resetNote)
206
+ ] }),
207
+ process.env.NODE_ENV !== "production" && /* @__PURE__ */ jsxs("p", { children: [
208
+ "If you're developing with the SDK and need help, join us on",
209
+ " ",
210
+ /* @__PURE__ */ jsx("a", { href: "https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen", children: "Discord" }),
211
+ "."
212
+ ] }),
213
+ shouldShowError && /* @__PURE__ */ jsxs("div", { className: "tl-error-boundary__stack", "data-copied": didCopy, children: [
214
+ /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: errorDetails }) }),
215
+ /* @__PURE__ */ jsx(
216
+ "button",
217
+ {
218
+ className: "tlui-button tl-error-boundary__button tl-error-boundary__copy",
219
+ onClick: copyError,
220
+ title: didCopy ? msg(messages.copied) : msg(messages.copy),
221
+ "aria-label": didCopy ? msg(messages.copied) : msg(messages.copy),
222
+ children: didCopy ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
223
+ }
224
+ )
197
225
  ] })
198
226
  ] }),
199
227
  /* @__PURE__ */ jsxs("div", { className: "tl-error-boundary__content__actions", children: [
200
- /* @__PURE__ */ jsx("button", { className: "tlui-button", onClick: () => setShouldShowError(!shouldShowError), children: shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails) }),
228
+ /* @__PURE__ */ jsx(
229
+ "button",
230
+ {
231
+ className: "tlui-button tl-error-boundary__button",
232
+ onClick: () => setShouldShowError(!shouldShowError),
233
+ children: shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails)
234
+ }
235
+ ),
201
236
  /* @__PURE__ */ jsxs("div", { className: "tl-error-boundary__content__actions__group", children: [
202
237
  /* @__PURE__ */ jsx(
203
238
  "button",
204
239
  {
205
- className: "tlui-button tl-error-boundary__reset",
240
+ className: "tlui-button tl-error-boundary__button tl-error-boundary__reset",
206
241
  onClick: () => setShouldShowResetConfirmation(true),
207
242
  children: msg(messages.resetData)
208
243
  }
209
244
  ),
210
- /* @__PURE__ */ jsx("button", { className: "tlui-button tl-error-boundary__refresh", onClick: refresh, children: msg(messages.refreshPage) })
245
+ /* @__PURE__ */ jsx(
246
+ "button",
247
+ {
248
+ className: "tlui-button tl-error-boundary__button tl-error-boundary__refresh",
249
+ onClick: refresh,
250
+ children: msg(messages.refreshPage)
251
+ }
252
+ )
211
253
  ] })
212
254
  ] })
213
255
  ] })
@@ -217,6 +259,26 @@ My browser: ${navigator.userAgent}`
217
259
  }
218
260
  );
219
261
  }
262
+ function CopyIcon() {
263
+ return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 30 30", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
264
+ "path",
265
+ {
266
+ fillRule: "evenodd",
267
+ clipRule: "evenodd",
268
+ d: "M2 19.0001C2 20.6569 3.34315 22.0001 5 22.0001H8L8 20.0001H5C4.44772 20.0001 4 19.5524 4 19.0001L4 5.00009C4 4.44781 4.44772 4.00009 5 4.00009L19 4.00009C19.5523 4.00009 20 4.44781 20 5.00009V8.00001H11C9.34315 8.00001 8 9.34316 8 11V25C8 26.6569 9.34315 28 11 28H25C26.6569 28 28 26.6569 28 25V11C28 9.34316 26.6569 8.00001 25 8.00001H22V5.00009C22 3.34324 20.6569 2.00009 19 2.00009H5C3.34315 2.00009 2 3.34324 2 5.00009V19.0001ZM10 11C10 10.4477 10.4477 10 11 10H25C25.5523 10 26 10.4477 26 11V25C26 25.5523 25.5523 26 25 26H11C10.4477 26 10 25.5523 10 25V11Z",
269
+ fill: "currentColor"
270
+ }
271
+ ) });
272
+ }
273
+ function CheckIcon() {
274
+ return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 30 30", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
275
+ "path",
276
+ {
277
+ d: "M22.9339 7.45369C23.5118 7.83148 23.6739 8.60615 23.2961 9.18396L14.7961 22.184C14.5958 22.4903 14.2712 22.6935 13.9082 22.7398C13.5451 22.7862 13.1799 22.6711 12.909 22.4248L7.40905 17.4248C6.89822 16.9604 6.86058 16.1699 7.32496 15.6591C7.78935 15.1482 8.57991 15.1106 9.09073 15.575L13.506 19.5888L21.2037 7.81584C21.5815 7.23803 22.3561 7.07589 22.9339 7.45369Z",
278
+ fill: "currentColor"
279
+ }
280
+ ) });
281
+ }
220
282
  export {
221
283
  DefaultErrorFallback
222
284
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/components/default-components/DefaultErrorFallback.tsx"],
4
- "sourcesContent": ["import { useValue } from '@tldraw/state-react'\nimport { noop } from '@tldraw/utils'\nimport classNames from 'classnames'\nimport { ComponentType, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport {\n\tdefineMessages,\n\ttranslateMessage,\n\ttype TLI18nMessage,\n\ttype TLI18nValues,\n} from '../../config/TLI18n'\nimport { Editor } from '../../editor/Editor'\nimport { getOwnerDocument } from '../../exports/domUtils'\nimport { useEditorComponents } from '../../hooks/EditorComponentsContext'\nimport { EditorProvider } from '../../hooks/useEditor'\nimport { getGlobalWindow } from '../../utils/dom'\nimport { hardResetEditor, refreshPage } from '../../utils/runtime'\nimport { ErrorBoundary } from '../ErrorBoundary'\n\nconst BASE_ERROR_URL = 'https://github.com/tldraw/tldraw/issues/new'\n\nconst messages = defineMessages({\n\tconfirmResetTitle: { id: 'error.confirm-reset.title', defaultMessage: 'Are you sure?' },\n\tconfirmResetDescription: {\n\t\tid: 'error.confirm-reset.description',\n\t\tdefaultMessage: 'Resetting your data will delete your drawing and cannot be undone.',\n\t},\n\tcancel: { id: 'error.cancel', defaultMessage: 'Cancel' },\n\tresetData: { id: 'error.reset-data', defaultMessage: 'Reset data' },\n\ttitle: { id: 'error.title', defaultMessage: 'Something went wrong' },\n\trefreshHint: { id: 'error.refresh-hint', defaultMessage: 'Please refresh your browser.' },\n\tresetHint: {\n\t\tid: 'error.reset-hint',\n\t\tdefaultMessage:\n\t\t\t'If the issue continues after refreshing, you may need to reset the tldraw data stored on your device.',\n\t},\n\tnoteLabel: { id: 'error.note-label', defaultMessage: 'Note:' },\n\tresetNote: {\n\t\tid: 'error.reset-note',\n\t\tdefaultMessage: 'Resetting will erase your current project and any unsaved work.',\n\t},\n\tmessageLabel: { id: 'error.message-label', defaultMessage: 'Message:' },\n\tstackTraceLabel: { id: 'error.stack-trace-label', defaultMessage: 'Stack trace:' },\n\tcopy: { id: 'error.copy', defaultMessage: 'Copy' },\n\tcopied: { id: 'error.copied', defaultMessage: 'Copied!' },\n\tshowDetails: { id: 'error.show-details', defaultMessage: 'Show details' },\n\thideDetails: { id: 'error.hide-details', defaultMessage: 'Hide details' },\n\trefreshPage: { id: 'error.refresh-page', defaultMessage: 'Refresh page' },\n})\n\n// This renders because something already threw, so reading the editor is done defensively the way\n// the rest of this component reads it: English beats a second crash on the error screen.\nfunction useErrorMsg(editor: Editor | undefined) {\n\treturn useCallback(\n\t\t(message: TLI18nMessage, values?: TLI18nValues) => {\n\t\t\ttry {\n\t\t\t\treturn translateMessage(editor?.i18n(), message, values)\n\t\t\t} catch {\n\t\t\t\treturn message.defaultMessage\n\t\t\t}\n\t\t},\n\t\t[editor]\n\t)\n}\n\n/** @public */\nexport interface TLErrorFallbackProps {\n\t/** The error that was caught. */\n\terror: unknown\n\t/**\n\t * Only set when the caller renders the fallback with an editor; the editor's own error\n\t * boundaries pass just `error`.\n\t */\n\teditor?: Editor\n}\n\n/** @public */\nexport type TLErrorFallbackComponent = ComponentType<TLErrorFallbackProps>\n\n/** @public @react */\nexport function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps) {\n\tconst msg = useErrorMsg(editor)\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\tconst [shouldShowError, setShouldShowError] = useState(process.env.NODE_ENV === 'development')\n\tconst [didCopy, setDidCopy] = useState(false)\n\tconst [shouldShowResetConfirmation, setShouldShowResetConfirmation] = useState(false)\n\n\tlet Canvas: React.ComponentType | null = null\n\ttry {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst components = useEditorComponents()\n\t\tCanvas = components.Canvas ?? null\n\t} catch {\n\t\t// allow this to fail silently\n\t}\n\n\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\tconst errorStack = error instanceof Error ? error.stack : null\n\n\tconst isDarkModeFromApp = useValue(\n\t\t'isDarkMode',\n\t\t() => {\n\t\t\ttry {\n\t\t\t\tif (editor) {\n\t\t\t\t\treturn editor.user.getIsDarkMode()\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// we're in a funky error state so this might not work for spooky\n\t\t\t\t// reasons. if not, we'll have another attempt later:\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\t[editor]\n\t)\n\tconst [isDarkMode, setIsDarkMode] = useState<null | boolean>(null)\n\tuseLayoutEffect(() => {\n\t\t// if we found a theme class from the app, we can just use that\n\t\tif (isDarkModeFromApp !== null) {\n\t\t\tsetIsDarkMode(isDarkModeFromApp)\n\t\t}\n\n\t\t// do any of our parents have a theme class? if yes then we can just\n\t\t// rely on that and don't need to set our own class\n\t\tlet parent = containerRef.current?.parentElement\n\t\tlet foundParentThemeClass = false\n\t\twhile (parent) {\n\t\t\tif (\n\t\t\t\tparent.classList.contains('tl-theme__dark') ||\n\t\t\t\tparent.classList.contains('tl-theme__light')\n\t\t\t) {\n\t\t\t\tfoundParentThemeClass = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tparent = parent.parentElement\n\t\t}\n\t\tif (foundParentThemeClass) {\n\t\t\tsetIsDarkMode(null)\n\t\t\treturn\n\t\t}\n\n\t\t// if we can't find a theme class from the app or from a parent, we have\n\t\t// to fall back on using a media query:\n\t\tif (typeof window !== 'undefined' && getGlobalWindow().matchMedia) {\n\t\t\tsetIsDarkMode(getGlobalWindow().matchMedia('(prefers-color-scheme: dark)').matches)\n\t\t}\n\t}, [isDarkModeFromApp])\n\n\tuseEffect(() => {\n\t\tif (didCopy) {\n\t\t\tconst timeout = editor?.timers.setTimeout(() => {\n\t\t\t\tsetDidCopy(false)\n\t\t\t}, 2000)\n\t\t\treturn () => clearTimeout(timeout)\n\t\t}\n\t}, [didCopy, editor])\n\n\tconst copyError = () => {\n\t\tconst doc = getOwnerDocument(containerRef.current)\n\t\tconst textarea = doc.createElement('textarea')\n\t\ttextarea.value = errorStack ?? errorMessage\n\t\tdoc.body.appendChild(textarea)\n\t\ttextarea.select()\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\t\tdoc.execCommand('copy')\n\t\ttextarea.remove()\n\t\tsetDidCopy(true)\n\t}\n\n\tconst refresh = () => {\n\t\trefreshPage()\n\t}\n\n\tconst resetLocalState = async () => {\n\t\thardResetEditor()\n\t}\n\n\tconst url = new URL(BASE_ERROR_URL)\n\turl.searchParams.set('title', errorMessage)\n\turl.searchParams.set('labels', `bug`)\n\turl.searchParams.set(\n\t\t'body',\n\t\t`Hey, I ran into an error while using tldraw:\n\n\\`\\`\\`js\n${errorStack ?? errorMessage}\n\\`\\`\\`\n\nMy browser: ${navigator.userAgent}`\n\t)\n\n\treturn (\n\t\t<div\n\t\t\tref={containerRef}\n\t\t\tclassName={classNames(\n\t\t\t\t'tl-container tl-error-boundary',\n\t\t\t\t// error-boundary is sometimes used outside of the theme\n\t\t\t\t// container, so we need to provide it with a theme for our\n\t\t\t\t// styles to work correctly\n\t\t\t\tisDarkMode === null ? '' : isDarkMode ? 'tl-theme__dark' : 'tl-theme__light'\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"tl-error-boundary__overlay\" />\n\t\t\t{editor && (\n\t\t\t\t// opportunistically attempt to render the canvas to reassure\n\t\t\t\t// the user that their document is still there. there's a good\n\t\t\t\t// chance this won't work (ie the error that we're currently\n\t\t\t\t// notifying the user about originates in the canvas) so it's\n\t\t\t\t// not a big deal if it doesn't work - in that case we just have\n\t\t\t\t// a plain grey background.\n\t\t\t\t<ErrorBoundary onError={noop} fallback={() => null}>\n\t\t\t\t\t<EditorProvider editor={editor}>\n\t\t\t\t\t\t<div className=\"tl-overlay tl-error-boundary__canvas\">{Canvas ? <Canvas /> : null}</div>\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</ErrorBoundary>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tclassName={classNames('tl-modal', 'tl-error-boundary__content', {\n\t\t\t\t\t'tl-error-boundary__content__expanded': shouldShowError && !shouldShowResetConfirmation,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{shouldShowResetConfirmation ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2>{msg(messages.confirmResetTitle)}</h2>\n\t\t\t\t\t\t<p>{msg(messages.confirmResetDescription)}</p>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions\">\n\t\t\t\t\t\t\t<button className=\"tlui-button\" onClick={() => setShouldShowResetConfirmation(false)}>\n\t\t\t\t\t\t\t\t{msg(messages.cancel)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<button className=\"tlui-button tl-error-boundary__reset\" onClick={resetLocalState}>\n\t\t\t\t\t\t\t\t{msg(messages.resetData)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2>{msg(messages.title)}</h2>\n\t\t\t\t\t\t<p>{msg(messages.refreshHint)}</p>\n\t\t\t\t\t\t<p>{msg(messages.resetHint)}</p>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<strong>{msg(messages.noteLabel)}</strong> {msg(messages.resetNote)}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t{process.env.NODE_ENV !== 'production' && (\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\tIf you&apos;re developing with the SDK and need help, join us on{' '}\n\t\t\t\t\t\t\t\t<a href=\"https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen\">\n\t\t\t\t\t\t\t\t\tDiscord\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{shouldShowError && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{msg(messages.messageLabel)}\n\t\t\t\t\t\t\t\t<h4>\n\t\t\t\t\t\t\t\t\t<code>{errorMessage}</code>\n\t\t\t\t\t\t\t\t</h4>\n\t\t\t\t\t\t\t\t{msg(messages.stackTraceLabel)}\n\t\t\t\t\t\t\t\t<div className=\"tl-error-boundary__content__error\">\n\t\t\t\t\t\t\t\t\t<pre>\n\t\t\t\t\t\t\t\t\t\t<code>{errorStack ?? errorMessage}</code>\n\t\t\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t\t\t\t<button className=\"tlui-button\" onClick={copyError}>\n\t\t\t\t\t\t\t\t\t\t{didCopy ? msg(messages.copied) : msg(messages.copy)}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions\">\n\t\t\t\t\t\t\t<button className=\"tlui-button\" onClick={() => setShouldShowError(!shouldShowError)}>\n\t\t\t\t\t\t\t\t{shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions__group\">\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__reset\"\n\t\t\t\t\t\t\t\t\tonClick={() => setShouldShowResetConfirmation(true)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.resetData)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button className=\"tlui-button tl-error-boundary__refresh\" onClick={refresh}>\n\t\t\t\t\t\t\t\t\t{msg(messages.refreshPage)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],
5
- "mappings": "AAwMG,SAoBE,UApBF,KAuBG,YAvBH;AAxMH,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,OAAO,gBAAgB;AACvB,SAAwB,aAAa,WAAW,iBAAiB,QAAQ,gBAAgB;AACzF;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AAEP,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,iBAAiB,mBAAmB;AAC7C,SAAS,qBAAqB;AAE9B,MAAM,iBAAiB;AAEvB,MAAM,WAAW,eAAe;AAAA,EAC/B,mBAAmB,EAAE,IAAI,6BAA6B,gBAAgB,gBAAgB;AAAA,EACtF,yBAAyB;AAAA,IACxB,IAAI;AAAA,IACJ,gBAAgB;AAAA,EACjB;AAAA,EACA,QAAQ,EAAE,IAAI,gBAAgB,gBAAgB,SAAS;AAAA,EACvD,WAAW,EAAE,IAAI,oBAAoB,gBAAgB,aAAa;AAAA,EAClE,OAAO,EAAE,IAAI,eAAe,gBAAgB,uBAAuB;AAAA,EACnE,aAAa,EAAE,IAAI,sBAAsB,gBAAgB,+BAA+B;AAAA,EACxF,WAAW;AAAA,IACV,IAAI;AAAA,IACJ,gBACC;AAAA,EACF;AAAA,EACA,WAAW,EAAE,IAAI,oBAAoB,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'@tldraw/utils'\nimport classNames from 'classnames'\nimport { ComponentType, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport {\n\tdefineMessages,\n\ttranslateMessage,\n\ttype TLI18nMessage,\n\ttype TLI18nValues,\n} from '../../config/TLI18n'\nimport { Editor } from '../../editor/Editor'\nimport { getOwnerDocument } from '../../exports/domUtils'\nimport { useEditorComponents } from '../../hooks/EditorComponentsContext'\nimport { EditorProvider } from '../../hooks/useEditor'\nimport { getGlobalWindow } from '../../utils/dom'\nimport { hardResetEditor, refreshPage } from '../../utils/runtime'\nimport { ErrorBoundary } from '../ErrorBoundary'\n\nconst BASE_ERROR_URL = 'https://github.com/tldraw/tldraw/issues/new'\n\nconst messages = defineMessages({\n\tconfirmResetTitle: { id: 'error.confirm-reset.title', defaultMessage: 'Are you sure?' },\n\tconfirmResetDescription: {\n\t\tid: 'error.confirm-reset.description',\n\t\tdefaultMessage: 'Resetting your data will delete your drawing and cannot be undone.',\n\t},\n\tcancel: { id: 'error.cancel', defaultMessage: 'Cancel' },\n\tresetData: { id: 'error.reset-data', defaultMessage: 'Reset data' },\n\ttitle: { id: 'error.title', defaultMessage: 'Something went wrong' },\n\trefreshHint: { id: 'error.refresh-hint', defaultMessage: 'Please refresh your browser.' },\n\tresetHint: {\n\t\tid: 'error.reset-hint',\n\t\tdefaultMessage:\n\t\t\t'If the issue continues after refreshing, you may need to reset the tldraw data stored on your device.',\n\t},\n\tnoteLabel: { id: 'error.note-label', defaultMessage: 'Note:' },\n\tresetNote: {\n\t\tid: 'error.reset-note',\n\t\tdefaultMessage: 'Resetting will erase your current project and any unsaved work.',\n\t},\n\t// No longer rendered, but still published translation keys that apps may override.\n\tmessageLabel: { id: 'error.message-label', defaultMessage: 'Message:' },\n\tstackTraceLabel: { id: 'error.stack-trace-label', defaultMessage: 'Stack trace:' },\n\tcopy: { id: 'error.copy', defaultMessage: 'Copy' },\n\tcopied: { id: 'error.copied', defaultMessage: 'Copied!' },\n\tshowDetails: { id: 'error.show-details', defaultMessage: 'Show details' },\n\thideDetails: { id: 'error.hide-details', defaultMessage: 'Hide details' },\n\trefreshPage: { id: 'error.refresh-page', defaultMessage: 'Refresh page' },\n})\n\n// This renders because something already threw, so reading the editor is done defensively the way\n// the rest of this component reads it: English beats a second crash on the error screen.\nfunction useErrorMsg(editor: Editor | undefined) {\n\treturn useCallback(\n\t\t(message: TLI18nMessage, values?: TLI18nValues) => {\n\t\t\ttry {\n\t\t\t\treturn translateMessage(editor?.i18n(), message, values)\n\t\t\t} catch {\n\t\t\t\treturn message.defaultMessage\n\t\t\t}\n\t\t},\n\t\t[editor]\n\t)\n}\n\n/** @public */\nexport interface TLErrorFallbackProps {\n\t/** The error that was caught. */\n\terror: unknown\n\t/**\n\t * Only set when the caller renders the fallback with an editor; the editor's own error\n\t * boundaries pass just `error`.\n\t */\n\teditor?: Editor\n}\n\n/** @public */\nexport type TLErrorFallbackComponent = ComponentType<TLErrorFallbackProps>\n\n/** @public @react */\nexport function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps) {\n\tconst msg = useErrorMsg(editor)\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\tconst [shouldShowError, setShouldShowError] = useState(process.env.NODE_ENV === 'development')\n\tconst [didCopy, setDidCopy] = useState(false)\n\tconst [shouldShowResetConfirmation, setShouldShowResetConfirmation] = useState(false)\n\n\tlet Canvas: React.ComponentType | null = null\n\ttry {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst components = useEditorComponents()\n\t\tCanvas = components.Canvas ?? null\n\t} catch {\n\t\t// allow this to fail silently\n\t}\n\n\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\tconst errorStack = error instanceof Error ? error.stack : null\n\t// Chrome's stack starts with the message; Safari and Firefox leave it out.\n\tconst errorDetails =\n\t\terrorStack && !errorStack.includes(errorMessage)\n\t\t\t? `${errorMessage}\\n${errorStack}`\n\t\t\t: (errorStack ?? errorMessage)\n\n\tconst isDarkModeFromApp = useValue(\n\t\t'isDarkMode',\n\t\t() => {\n\t\t\ttry {\n\t\t\t\tif (editor) {\n\t\t\t\t\treturn editor.user.getIsDarkMode()\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// we're in a funky error state so this might not work for spooky\n\t\t\t\t// reasons. if not, we'll have another attempt later:\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\t[editor]\n\t)\n\tconst [isDarkMode, setIsDarkMode] = useState<null | boolean>(null)\n\tuseLayoutEffect(() => {\n\t\t// if we found a theme class from the app, we can just use that\n\t\tif (isDarkModeFromApp !== null) {\n\t\t\tsetIsDarkMode(isDarkModeFromApp)\n\t\t}\n\n\t\t// do any of our parents have a theme class? if yes then we can just\n\t\t// rely on that and don't need to set our own class\n\t\tlet parent = containerRef.current?.parentElement\n\t\tlet foundParentThemeClass = false\n\t\twhile (parent) {\n\t\t\tif (\n\t\t\t\tparent.classList.contains('tl-theme__dark') ||\n\t\t\t\tparent.classList.contains('tl-theme__light')\n\t\t\t) {\n\t\t\t\tfoundParentThemeClass = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tparent = parent.parentElement\n\t\t}\n\t\tif (foundParentThemeClass) {\n\t\t\tsetIsDarkMode(null)\n\t\t\treturn\n\t\t}\n\n\t\t// if we can't find a theme class from the app or from a parent, we have\n\t\t// to fall back on using a media query:\n\t\tif (typeof window !== 'undefined' && getGlobalWindow().matchMedia) {\n\t\t\tsetIsDarkMode(getGlobalWindow().matchMedia('(prefers-color-scheme: dark)').matches)\n\t\t}\n\t}, [isDarkModeFromApp])\n\n\tuseEffect(() => {\n\t\tif (didCopy) {\n\t\t\tconst timeout = editor?.timers.setTimeout(() => {\n\t\t\t\tsetDidCopy(false)\n\t\t\t}, 2000)\n\t\t\treturn () => clearTimeout(timeout)\n\t\t}\n\t}, [didCopy, editor])\n\n\tconst copyError = () => {\n\t\tconst doc = getOwnerDocument(containerRef.current)\n\t\tconst textarea = doc.createElement('textarea')\n\t\ttextarea.value = errorDetails\n\t\tdoc.body.appendChild(textarea)\n\t\ttextarea.select()\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\t\tdoc.execCommand('copy')\n\t\ttextarea.remove()\n\t\tsetDidCopy(true)\n\t}\n\n\tconst refresh = () => {\n\t\trefreshPage()\n\t}\n\n\tconst resetLocalState = async () => {\n\t\thardResetEditor()\n\t}\n\n\tconst url = new URL(BASE_ERROR_URL)\n\turl.searchParams.set('title', errorMessage)\n\turl.searchParams.set('labels', `bug`)\n\turl.searchParams.set(\n\t\t'body',\n\t\t`Hey, I ran into an error while using tldraw:\n\n\\`\\`\\`js\n${errorStack ?? errorMessage}\n\\`\\`\\`\n\nMy browser: ${navigator.userAgent}`\n\t)\n\n\treturn (\n\t\t<div\n\t\t\tref={containerRef}\n\t\t\tclassName={classNames(\n\t\t\t\t'tl-container tl-error-boundary',\n\t\t\t\t// error-boundary is sometimes used outside of the theme\n\t\t\t\t// container, so we need to provide it with a theme for our\n\t\t\t\t// styles to work correctly\n\t\t\t\tisDarkMode === null ? '' : isDarkMode ? 'tl-theme__dark' : 'tl-theme__light'\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"tl-error-boundary__overlay\" />\n\t\t\t{editor && (\n\t\t\t\t// opportunistically attempt to render the canvas to reassure\n\t\t\t\t// the user that their document is still there. there's a good\n\t\t\t\t// chance this won't work (ie the error that we're currently\n\t\t\t\t// notifying the user about originates in the canvas) so it's\n\t\t\t\t// not a big deal if it doesn't work - in that case we just have\n\t\t\t\t// a plain grey background.\n\t\t\t\t<ErrorBoundary onError={noop} fallback={() => null}>\n\t\t\t\t\t<EditorProvider editor={editor}>\n\t\t\t\t\t\t<div className=\"tl-overlay tl-error-boundary__canvas\">{Canvas ? <Canvas /> : null}</div>\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</ErrorBoundary>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tclassName={classNames('tl-modal', 'tl-error-boundary__content', {\n\t\t\t\t\t'tl-error-boundary__content__expanded': shouldShowError && !shouldShowResetConfirmation,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{shouldShowResetConfirmation ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2 className=\"tl-error-boundary__title\">{msg(messages.confirmResetTitle)}</h2>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__body\">\n\t\t\t\t\t\t\t<p>{msg(messages.confirmResetDescription)}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions\">\n\t\t\t\t\t\t\t<div />\n\t\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions__group\">\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button\"\n\t\t\t\t\t\t\t\t\tonClick={() => setShouldShowResetConfirmation(false)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.cancel)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button tl-error-boundary__reset\"\n\t\t\t\t\t\t\t\t\tonClick={resetLocalState}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.resetData)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2 className=\"tl-error-boundary__title\">{msg(messages.title)}</h2>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__body\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{msg(messages.refreshHint)} {msg(messages.resetHint)}{' '}\n\t\t\t\t\t\t\t\t<strong>{msg(messages.noteLabel)}</strong> {msg(messages.resetNote)}\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t{process.env.NODE_ENV !== 'production' && (\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\tIf you&apos;re developing with the SDK and need help, join us on{' '}\n\t\t\t\t\t\t\t\t\t<a href=\"https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen\">\n\t\t\t\t\t\t\t\t\t\tDiscord\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{shouldShowError && (\n\t\t\t\t\t\t\t\t<div className=\"tl-error-boundary__stack\" data-copied={didCopy}>\n\t\t\t\t\t\t\t\t\t<pre>\n\t\t\t\t\t\t\t\t\t\t<code>{errorDetails}</code>\n\t\t\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button tl-error-boundary__copy\"\n\t\t\t\t\t\t\t\t\t\tonClick={copyError}\n\t\t\t\t\t\t\t\t\t\ttitle={didCopy ? msg(messages.copied) : msg(messages.copy)}\n\t\t\t\t\t\t\t\t\t\taria-label={didCopy ? msg(messages.copied) : msg(messages.copy)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{didCopy ? <CheckIcon /> : <CopyIcon />}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions\">\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button\"\n\t\t\t\t\t\t\t\tonClick={() => setShouldShowError(!shouldShowError)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<div className=\"tl-error-boundary__content__actions__group\">\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button tl-error-boundary__reset\"\n\t\t\t\t\t\t\t\t\tonClick={() => setShouldShowResetConfirmation(true)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.resetData)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"tlui-button tl-error-boundary__button tl-error-boundary__refresh\"\n\t\t\t\t\t\t\t\t\tonClick={refresh}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{msg(messages.refreshPage)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nfunction CopyIcon() {\n\treturn (\n\t\t<svg width=\"16\" height=\"16\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M2 19.0001C2 20.6569 3.34315 22.0001 5 22.0001H8L8 20.0001H5C4.44772 20.0001 4 19.5524 4 19.0001L4 5.00009C4 4.44781 4.44772 4.00009 5 4.00009L19 4.00009C19.5523 4.00009 20 4.44781 20 5.00009V8.00001H11C9.34315 8.00001 8 9.34316 8 11V25C8 26.6569 9.34315 28 11 28H25C26.6569 28 28 26.6569 28 25V11C28 9.34316 26.6569 8.00001 25 8.00001H22V5.00009C22 3.34324 20.6569 2.00009 19 2.00009H5C3.34315 2.00009 2 3.34324 2 5.00009V19.0001ZM10 11C10 10.4477 10.4477 10 11 10H25C25.5523 10 26 10.4477 26 11V25C26 25.5523 25.5523 26 25 26H11C10.4477 26 10 25.5523 10 25V11Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction CheckIcon() {\n\treturn (\n\t\t<svg width=\"16\" height=\"16\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M22.9339 7.45369C23.5118 7.83148 23.6739 8.60615 23.2961 9.18396L14.7961 22.184C14.5958 22.4903 14.2712 22.6935 13.9082 22.7398C13.5451 22.7862 13.1799 22.6711 12.909 22.4248L7.40905 17.4248C6.89822 16.9604 6.86058 16.1699 7.32496 15.6591C7.78935 15.1482 8.57991 15.1106 9.09073 15.575L13.506 19.5888L21.2037 7.81584C21.5815 7.23803 22.3561 7.07589 22.9339 7.45369Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n"],
5
+ "mappings": "AA8MG,SAoBE,UApBF,KA2BI,YA3BJ;AA9MH,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,OAAO,gBAAgB;AACvB,SAAwB,aAAa,WAAW,iBAAiB,QAAQ,gBAAgB;AACzF;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AAEP,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,iBAAiB,mBAAmB;AAC7C,SAAS,qBAAqB;AAE9B,MAAM,iBAAiB;AAEvB,MAAM,WAAW,eAAe;AAAA,EAC/B,mBAAmB,EAAE,IAAI,6BAA6B,gBAAgB,gBAAgB;AAAA,EACtF,yBAAyB;AAAA,IACxB,IAAI;AAAA,IACJ,gBAAgB;AAAA,EACjB;AAAA,EACA,QAAQ,EAAE,IAAI,gBAAgB,gBAAgB,SAAS;AAAA,EACvD,WAAW,EAAE,IAAI,oBAAoB,gBAAgB,aAAa;AAAA,EAClE,OAAO,EAAE,IAAI,eAAe,gBAAgB,uBAAuB;AAAA,EACnE,aAAa,EAAE,IAAI,sBAAsB,gBAAgB,+BAA+B;AAAA,EACxF,WAAW;AAAA,IACV,IAAI;AAAA,IACJ,gBACC;AAAA,EACF;A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e;AAAA,oBAEjD,4BAAkB,IAAI,SAAS,WAAW,IAAI,IAAI,SAAS,WAAW;AAAA;AAAA,gBACxE;AAAA,gBACA,qBAAC,SAAI,WAAU,8CACd;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAU;AAAA,sBACV,SAAS,MAAM,+BAA+B,IAAI;AAAA,sBAEjD,cAAI,SAAS,SAAS;AAAA;AAAA,kBACxB;AAAA,kBACA;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAU;AAAA,sBACV,SAAS;AAAA,sBAER,cAAI,SAAS,WAAW;AAAA;AAAA,kBAC1B;AAAA,mBACD;AAAA,iBACD;AAAA,eACD;AAAA;AAAA,QAEF;AAAA;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,WAAW;AACnB,SACC,oBAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,UAAS;AAAA,MACT,UAAS;AAAA,MACT,GAAE;AAAA,MACF,MAAK;AAAA;AAAA,EACN,GACD;AAEF;AAEA,SAAS,YAAY;AACpB,SACC,oBAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,GAAE;AAAA,MACF,MAAK;AAAA;AAAA,EACN,GACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,8 @@
1
- const version = "5.7.0-canary.986cfb91c3b4";
1
+ const version = "5.7.0-canary.98770694aa48";
2
2
  const publishDates = {
3
3
  major: "2026-05-06T16:28:18.473Z",
4
- minor: "2026-11-10T16:01:36.695Z",
5
- patch: "2026-11-10T16:01:36.695Z"
4
+ minor: "2026-11-16T15:16:43.648Z",
5
+ patch: "2026-11-16T15:16:43.648Z"
6
6
  };
7
7
  export {
8
8
  publishDates,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/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 = '5.7.0-canary.986cfb91c3b4'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-11-10T16:01:36.695Z',\n\tpatch: '2026-11-10T16:01:36.695Z',\n}\n"],
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 = '5.7.0-canary.98770694aa48'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-11-16T15:16:43.648Z',\n\tpatch: '2026-11-16T15:16:43.648Z',\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/editor.css CHANGED
@@ -270,6 +270,33 @@
270
270
  inset 0px 0px 0px 1px var(--tl-color-panel-contrast);
271
271
  }
272
272
 
273
+ /* The wash an open menu trigger shows: clear at one edge, muted-2 at the other, named for the
274
+ direction it fades in. Declared on the theme element, after both themes' colours, so each stop
275
+ resolves to the current theme's value. */
276
+ .tl-theme__light,
277
+ .tl-theme__dark {
278
+ --tl-muted-gradient-to-bottom: linear-gradient(
279
+ 180deg,
280
+ var(--tl-color-muted-none) 0%,
281
+ var(--tl-color-muted-2) 100%
282
+ );
283
+ --tl-muted-gradient-to-top: linear-gradient(
284
+ 0deg,
285
+ var(--tl-color-muted-none) 0%,
286
+ var(--tl-color-muted-2) 100%
287
+ );
288
+ --tl-muted-gradient-to-right: linear-gradient(
289
+ 90deg,
290
+ var(--tl-color-muted-none) 0%,
291
+ var(--tl-color-muted-2) 100%
292
+ );
293
+ --tl-muted-gradient-to-left: linear-gradient(
294
+ 270deg,
295
+ var(--tl-color-muted-none) 0%,
296
+ var(--tl-color-muted-2) 100%
297
+ );
298
+ }
299
+
273
300
  .tl-counter-scaled {
274
301
  transform: scale(var(--tl-scale));
275
302
  transform-origin: top left;
@@ -1462,40 +1489,47 @@ it from receiving any pointer events or affecting the cursor. */
1462
1489
  }
1463
1490
 
1464
1491
  .tl-error-boundary__content {
1465
- width: fit-content;
1466
- height: fit-content;
1467
- max-width: 100%;
1468
1492
  width: 400px;
1493
+ max-width: 100%;
1469
1494
  max-height: 100%;
1470
1495
  background-color: var(--tl-color-panel);
1471
- padding: 16px;
1472
- border-radius: 16px;
1473
- box-shadow: var(--tl-shadow-2);
1474
- font-size: 14px;
1496
+ border-radius: var(--tl-radius-3);
1497
+ box-shadow: var(--tl-shadow-3);
1498
+ font-size: 12px;
1475
1499
  font-weight: 400;
1476
1500
  display: flex;
1477
1501
  flex-direction: column;
1478
- overflow: auto;
1502
+ overflow: hidden;
1479
1503
  z-index: var(--tl-layer-error-content);
1480
- gap: 12px;
1481
1504
  }
1482
1505
 
1483
1506
  .tl-error-boundary__content__expanded {
1484
1507
  width: 600px;
1485
1508
  }
1486
1509
 
1487
- .tl-error-boundary__content h2 {
1488
- font-size: 16px;
1510
+ .tl-error-boundary__title {
1511
+ flex: 0 0 auto;
1512
+ display: flex;
1513
+ align-items: center;
1514
+ height: 40px;
1489
1515
  margin: 0px;
1516
+ padding-inline: var(--tl-space-4);
1517
+ font-size: 12px;
1490
1518
  font-weight: 500;
1519
+ color: var(--tl-color-text-1);
1491
1520
  }
1492
1521
 
1493
- .tl-error-boundary__content h4 {
1494
- border: 1px solid var(--tl-color-low-border);
1495
- margin: -6px 0 0 0;
1496
- padding: var(--tl-space-5);
1497
- border-radius: var(--tl-radius-2);
1498
- font-weight: normal;
1522
+ .tl-error-boundary__body {
1523
+ flex: 0 1 auto;
1524
+ min-height: 0;
1525
+ display: flex;
1526
+ flex-direction: column;
1527
+ gap: var(--tl-space-4);
1528
+ padding: var(--tl-space-4) var(--tl-space-4);
1529
+ overflow-y: auto;
1530
+ overflow-x: hidden;
1531
+ overflow-wrap: anywhere;
1532
+ color: var(--tl-color-text-1);
1499
1533
  }
1500
1534
 
1501
1535
  .tl-error-boundary__content p {
@@ -1503,27 +1537,28 @@ it from receiving any pointer events or affecting the cursor. */
1503
1537
  margin: 0px;
1504
1538
  }
1505
1539
 
1540
+ .tl-error-boundary__content strong {
1541
+ font-weight: 600;
1542
+ }
1543
+
1506
1544
  .tl-error-boundary__content pre {
1545
+ margin: 0px;
1546
+ padding: var(--tl-space-3) var(--tl-space-4);
1507
1547
  background-color: var(--tl-color-muted-2);
1508
- margin-top: 0;
1509
- padding: var(--tl-space-5);
1510
1548
  border-radius: var(--tl-radius-2);
1511
- overflow: auto;
1512
- font-size: 12px;
1513
- max-height: 320px;
1549
+ font-family: var(--tl-font-mono);
1550
+ font-size: 11px;
1551
+ line-height: 1.6;
1514
1552
  }
1515
1553
 
1516
- .tl-error-boundary__content button {
1517
- background: none;
1518
- border: none;
1519
- font-family: inherit;
1520
- font-size: 14px;
1521
- font-weight: 500;
1522
- padding: var(--tl-space-4);
1523
- border-radius: var(--tl-radius-3);
1524
- cursor: var(--tl-cursor-pointer);
1525
- color: inherit;
1526
- background-color: transparent;
1554
+ .tl-error-boundary__stack {
1555
+ position: relative;
1556
+ }
1557
+
1558
+ .tl-error-boundary__stack pre {
1559
+ overflow: auto;
1560
+ max-height: 240px;
1561
+ overflow-wrap: normal;
1527
1562
  }
1528
1563
 
1529
1564
  .tl-error-boundary__content a {
@@ -1532,43 +1567,93 @@ it from receiving any pointer events or affecting the cursor. */
1532
1567
  text-decoration: none;
1533
1568
  }
1534
1569
 
1535
- .tl-error-boundary__content__error {
1570
+ /* Mirrors .tlui-button so the fallback looks the same when only editor.css is loaded. */
1571
+ .tl-error-boundary__button {
1536
1572
  position: relative;
1537
- margin: -6px 0 0 0;
1573
+ isolation: isolate;
1574
+ height: 40px;
1575
+ min-width: 40px;
1576
+ padding: 0px 12px;
1577
+ display: flex;
1578
+ align-items: center;
1579
+ justify-content: center;
1580
+ background: none;
1581
+ border: none;
1582
+ font-family: inherit;
1583
+ font-size: 12px;
1584
+ font-weight: inherit;
1585
+ color: var(--tl-color-text-1);
1586
+ cursor: var(--tl-cursor-pointer);
1538
1587
  }
1539
1588
 
1540
- .tl-error-boundary__content__error button {
1589
+ .tl-error-boundary__button::after {
1590
+ content: '';
1591
+ position: absolute;
1592
+ inset: 4px;
1593
+ z-index: -1;
1594
+ border-radius: var(--tl-radius-2);
1595
+ background: var(--tl-color-muted-2);
1596
+ opacity: 0;
1597
+ }
1598
+
1599
+ .tl-error-boundary__content .tl-error-boundary__copy {
1541
1600
  position: absolute;
1542
1601
  top: var(--tl-space-2);
1543
- right: var(--tl-space-2);
1544
- font-size: 12px;
1545
- padding: var(--tl-space-2) var(--tl-space-3);
1602
+ inset-inline-end: var(--tl-space-2);
1603
+ height: 32px;
1604
+ min-width: 32px;
1605
+ padding: 0px;
1606
+ color: var(--tl-color-text-3);
1546
1607
  background-color: var(--tl-color-panel);
1547
- border-radius: var(--tl-radius-1);
1608
+ border-radius: var(--tl-radius-2);
1609
+ }
1610
+
1611
+ .tl-error-boundary__content .tl-error-boundary__copy::after {
1612
+ inset: 0px;
1613
+ }
1614
+
1615
+ /* Touch screens can't hover, so the button stays visible there. */
1616
+ @media (hover: hover) {
1617
+ .tl-error-boundary__content .tl-error-boundary__copy {
1618
+ opacity: 0;
1619
+ }
1620
+
1621
+ .tl-error-boundary__stack:hover .tl-error-boundary__copy,
1622
+ .tl-error-boundary__stack:focus-within .tl-error-boundary__copy,
1623
+ .tl-error-boundary__stack[data-copied='true'] .tl-error-boundary__copy {
1624
+ opacity: 1;
1625
+ }
1548
1626
  }
1549
1627
 
1550
1628
  .tl-error-boundary__content__actions {
1629
+ flex: 0 0 auto;
1551
1630
  display: flex;
1631
+ align-items: center;
1552
1632
  justify-content: space-between;
1553
- gap: var(--tl-space-4);
1554
- margin: 0px;
1555
- margin-left: -4px;
1633
+ height: 40px;
1556
1634
  }
1635
+
1557
1636
  .tl-error-boundary__content__actions__group {
1558
1637
  display: flex;
1559
- gap: var(--tl-space-4);
1638
+ align-items: center;
1560
1639
  }
1561
- .tl-error-boundary__content .tl-error-boundary__reset {
1562
- color: var(--tl-color-danger);
1640
+
1641
+ .tl-error-boundary__content__actions__group > .tl-error-boundary__button:nth-last-child(n + 2) {
1642
+ margin-inline-end: -4px;
1563
1643
  }
1644
+
1564
1645
  .tl-error-boundary__content .tl-error-boundary__refresh {
1565
- background-color: var(--tl-color-primary);
1566
- color: var(--tl-color-selected-contrast);
1646
+ color: var(--tl-color-primary);
1647
+ }
1648
+
1649
+ .tl-error-boundary__content .tl-error-boundary__reset {
1650
+ color: var(--tl-color-danger);
1567
1651
  }
1568
- .tl-container__focused:not(.tl-container__no-focus-ring)
1569
- .tlui-button.tl-error-boundary__refresh:focus-visible {
1570
- border-radius: 8px;
1571
- outline-offset: 0;
1652
+
1653
+ .tl-container__focused:not(.tl-container__no-focus-ring) .tl-error-boundary__button:focus-visible {
1654
+ border-radius: 10px;
1655
+ outline: 2px solid var(--tl-color-focus);
1656
+ outline-offset: -5px;
1572
1657
  }
1573
1658
 
1574
1659
  /* ---------------- Hit test blocker ---------------- */
@@ -1606,16 +1691,12 @@ it from receiving any pointer events or affecting the cursor. */
1606
1691
  color: var(--tl-color-selected);
1607
1692
  }
1608
1693
 
1609
- .tl-error-boundary__content button:hover {
1610
- background-color: var(--tl-color-low);
1694
+ .tl-error-boundary__button:hover::after {
1695
+ opacity: 1;
1611
1696
  }
1612
1697
  .tl-error-boundary__content a:hover {
1613
1698
  color: var(--tl-color-text-1);
1614
1699
  }
1615
- .tl-error-boundary__content .tl-error-boundary__refresh:hover {
1616
- background-color: var(--tl-color-primary);
1617
- opacity: 0.9;
1618
- }
1619
1700
 
1620
1701
  /* These three rules help preserve clicking into specific points in text areas *while*
1621
1702
  * already in edit mode when jumping from shape to shape. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/editor",
3
3
  "description": "tldraw infinite canvas SDK (editor).",
4
- "version": "5.7.0-canary.986cfb91c3b4",
4
+ "version": "5.7.0-canary.98770694aa48",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -43,12 +43,12 @@
43
43
  "@tiptap/core": "^3.12.1",
44
44
  "@tiptap/pm": "^3.12.1",
45
45
  "@tiptap/react": "^3.12.1",
46
- "@tldraw/state": "5.7.0-canary.986cfb91c3b4",
47
- "@tldraw/state-react": "5.7.0-canary.986cfb91c3b4",
48
- "@tldraw/store": "5.7.0-canary.986cfb91c3b4",
49
- "@tldraw/tlschema": "5.7.0-canary.986cfb91c3b4",
50
- "@tldraw/utils": "5.7.0-canary.986cfb91c3b4",
51
- "@tldraw/validate": "5.7.0-canary.986cfb91c3b4",
46
+ "@tldraw/state": "5.7.0-canary.98770694aa48",
47
+ "@tldraw/state-react": "5.7.0-canary.98770694aa48",
48
+ "@tldraw/store": "5.7.0-canary.98770694aa48",
49
+ "@tldraw/tlschema": "5.7.0-canary.98770694aa48",
50
+ "@tldraw/utils": "5.7.0-canary.98770694aa48",
51
+ "@tldraw/validate": "5.7.0-canary.98770694aa48",
52
52
  "classnames": "^2.5.1",
53
53
  "eventemitter3": "^4.0.7",
54
54
  "idb": "^7.1.1",
@@ -38,6 +38,7 @@ const messages = defineMessages({
38
38
  id: 'error.reset-note',
39
39
  defaultMessage: 'Resetting will erase your current project and any unsaved work.',
40
40
  },
41
+ // No longer rendered, but still published translation keys that apps may override.
41
42
  messageLabel: { id: 'error.message-label', defaultMessage: 'Message:' },
42
43
  stackTraceLabel: { id: 'error.stack-trace-label', defaultMessage: 'Stack trace:' },
43
44
  copy: { id: 'error.copy', defaultMessage: 'Copy' },
@@ -95,6 +96,11 @@ export function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps) {
95
96
 
96
97
  const errorMessage = error instanceof Error ? error.message : String(error)
97
98
  const errorStack = error instanceof Error ? error.stack : null
99
+ // Chrome's stack starts with the message; Safari and Firefox leave it out.
100
+ const errorDetails =
101
+ errorStack && !errorStack.includes(errorMessage)
102
+ ? `${errorMessage}\n${errorStack}`
103
+ : (errorStack ?? errorMessage)
98
104
 
99
105
  const isDarkModeFromApp = useValue(
100
106
  'isDarkMode',
@@ -156,7 +162,7 @@ export function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps) {
156
162
  const copyError = () => {
157
163
  const doc = getOwnerDocument(containerRef.current)
158
164
  const textarea = doc.createElement('textarea')
159
- textarea.value = errorStack ?? errorMessage
165
+ textarea.value = errorDetails
160
166
  doc.body.appendChild(textarea)
161
167
  textarea.select()
162
168
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -219,63 +225,79 @@ My browser: ${navigator.userAgent}`
219
225
  >
220
226
  {shouldShowResetConfirmation ? (
221
227
  <>
222
- <h2>{msg(messages.confirmResetTitle)}</h2>
223
- <p>{msg(messages.confirmResetDescription)}</p>
228
+ <h2 className="tl-error-boundary__title">{msg(messages.confirmResetTitle)}</h2>
229
+ <div className="tl-error-boundary__body">
230
+ <p>{msg(messages.confirmResetDescription)}</p>
231
+ </div>
224
232
  <div className="tl-error-boundary__content__actions">
225
- <button className="tlui-button" onClick={() => setShouldShowResetConfirmation(false)}>
226
- {msg(messages.cancel)}
227
- </button>
228
- <button className="tlui-button tl-error-boundary__reset" onClick={resetLocalState}>
229
- {msg(messages.resetData)}
230
- </button>
233
+ <div />
234
+ <div className="tl-error-boundary__content__actions__group">
235
+ <button
236
+ className="tlui-button tl-error-boundary__button"
237
+ onClick={() => setShouldShowResetConfirmation(false)}
238
+ >
239
+ {msg(messages.cancel)}
240
+ </button>
241
+ <button
242
+ className="tlui-button tl-error-boundary__button tl-error-boundary__reset"
243
+ onClick={resetLocalState}
244
+ >
245
+ {msg(messages.resetData)}
246
+ </button>
247
+ </div>
231
248
  </div>
232
249
  </>
233
250
  ) : (
234
251
  <>
235
- <h2>{msg(messages.title)}</h2>
236
- <p>{msg(messages.refreshHint)}</p>
237
- <p>{msg(messages.resetHint)}</p>
238
- <p>
239
- <strong>{msg(messages.noteLabel)}</strong> {msg(messages.resetNote)}
240
- </p>
241
- {process.env.NODE_ENV !== 'production' && (
252
+ <h2 className="tl-error-boundary__title">{msg(messages.title)}</h2>
253
+ <div className="tl-error-boundary__body">
242
254
  <p>
243
- If you&apos;re developing with the SDK and need help, join us on{' '}
244
- <a href="https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen">
245
- Discord
246
- </a>
247
- .
255
+ {msg(messages.refreshHint)} {msg(messages.resetHint)}{' '}
256
+ <strong>{msg(messages.noteLabel)}</strong> {msg(messages.resetNote)}
248
257
  </p>
249
- )}
250
- {shouldShowError && (
251
- <>
252
- {msg(messages.messageLabel)}
253
- <h4>
254
- <code>{errorMessage}</code>
255
- </h4>
256
- {msg(messages.stackTraceLabel)}
257
- <div className="tl-error-boundary__content__error">
258
+ {process.env.NODE_ENV !== 'production' && (
259
+ <p>
260
+ If you&apos;re developing with the SDK and need help, join us on{' '}
261
+ <a href="https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen">
262
+ Discord
263
+ </a>
264
+ .
265
+ </p>
266
+ )}
267
+ {shouldShowError && (
268
+ <div className="tl-error-boundary__stack" data-copied={didCopy}>
258
269
  <pre>
259
- <code>{errorStack ?? errorMessage}</code>
270
+ <code>{errorDetails}</code>
260
271
  </pre>
261
- <button className="tlui-button" onClick={copyError}>
262
- {didCopy ? msg(messages.copied) : msg(messages.copy)}
272
+ <button
273
+ className="tlui-button tl-error-boundary__button tl-error-boundary__copy"
274
+ onClick={copyError}
275
+ title={didCopy ? msg(messages.copied) : msg(messages.copy)}
276
+ aria-label={didCopy ? msg(messages.copied) : msg(messages.copy)}
277
+ >
278
+ {didCopy ? <CheckIcon /> : <CopyIcon />}
263
279
  </button>
264
280
  </div>
265
- </>
266
- )}
281
+ )}
282
+ </div>
267
283
  <div className="tl-error-boundary__content__actions">
268
- <button className="tlui-button" onClick={() => setShouldShowError(!shouldShowError)}>
284
+ <button
285
+ className="tlui-button tl-error-boundary__button"
286
+ onClick={() => setShouldShowError(!shouldShowError)}
287
+ >
269
288
  {shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails)}
270
289
  </button>
271
290
  <div className="tl-error-boundary__content__actions__group">
272
291
  <button
273
- className="tlui-button tl-error-boundary__reset"
292
+ className="tlui-button tl-error-boundary__button tl-error-boundary__reset"
274
293
  onClick={() => setShouldShowResetConfirmation(true)}
275
294
  >
276
295
  {msg(messages.resetData)}
277
296
  </button>
278
- <button className="tlui-button tl-error-boundary__refresh" onClick={refresh}>
297
+ <button
298
+ className="tlui-button tl-error-boundary__button tl-error-boundary__refresh"
299
+ onClick={refresh}
300
+ >
279
301
  {msg(messages.refreshPage)}
280
302
  </button>
281
303
  </div>
@@ -286,3 +308,27 @@ My browser: ${navigator.userAgent}`
286
308
  </div>
287
309
  )
288
310
  }
311
+
312
+ function CopyIcon() {
313
+ return (
314
+ <svg width="16" height="16" viewBox="0 0 30 30" fill="none" aria-hidden="true">
315
+ <path
316
+ fillRule="evenodd"
317
+ clipRule="evenodd"
318
+ d="M2 19.0001C2 20.6569 3.34315 22.0001 5 22.0001H8L8 20.0001H5C4.44772 20.0001 4 19.5524 4 19.0001L4 5.00009C4 4.44781 4.44772 4.00009 5 4.00009L19 4.00009C19.5523 4.00009 20 4.44781 20 5.00009V8.00001H11C9.34315 8.00001 8 9.34316 8 11V25C8 26.6569 9.34315 28 11 28H25C26.6569 28 28 26.6569 28 25V11C28 9.34316 26.6569 8.00001 25 8.00001H22V5.00009C22 3.34324 20.6569 2.00009 19 2.00009H5C3.34315 2.00009 2 3.34324 2 5.00009V19.0001ZM10 11C10 10.4477 10.4477 10 11 10H25C25.5523 10 26 10.4477 26 11V25C26 25.5523 25.5523 26 25 26H11C10.4477 26 10 25.5523 10 25V11Z"
319
+ fill="currentColor"
320
+ />
321
+ </svg>
322
+ )
323
+ }
324
+
325
+ function CheckIcon() {
326
+ return (
327
+ <svg width="16" height="16" viewBox="0 0 30 30" fill="none" aria-hidden="true">
328
+ <path
329
+ d="M22.9339 7.45369C23.5118 7.83148 23.6739 8.60615 23.2961 9.18396L14.7961 22.184C14.5958 22.4903 14.2712 22.6935 13.9082 22.7398C13.5451 22.7862 13.1799 22.6711 12.909 22.4248L7.40905 17.4248C6.89822 16.9604 6.86058 16.1699 7.32496 15.6591C7.78935 15.1482 8.57991 15.1106 9.09073 15.575L13.506 19.5888L21.2037 7.81584C21.5815 7.23803 22.3561 7.07589 22.9339 7.45369Z"
330
+ fill="currentColor"
331
+ />
332
+ </svg>
333
+ )
334
+ }
package/src/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 = '5.7.0-canary.986cfb91c3b4'
4
+ export const version = '5.7.0-canary.98770694aa48'
5
5
  export const publishDates = {
6
6
  major: '2026-05-06T16:28:18.473Z',
7
- minor: '2026-11-10T16:01:36.695Z',
8
- patch: '2026-11-10T16:01:36.695Z',
7
+ minor: '2026-11-16T15:16:43.648Z',
8
+ patch: '2026-11-16T15:16:43.648Z',
9
9
  }