@tldraw/editor 3.15.0 → 3.16.0-canary.01f62b6d4455
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +185 -9
- package/dist-cjs/index.js +5 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +3 -1
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/components/MenuClickCapture.js +0 -5
- package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
- package/dist-cjs/lib/components/Shape.js +4 -26
- package/dist-cjs/lib/components/Shape.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +1 -1
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultScribble.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +9 -1
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeWrapper.js +53 -0
- package/dist-cjs/lib/components/default-components/DefaultShapeWrapper.js.map +7 -0
- package/dist-cjs/lib/config/TLUserPreferences.js +9 -3
- package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +110 -59
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +9 -4
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/types/misc-types.js.map +1 -1
- package/dist-cjs/lib/exports/getSvgJsx.js +1 -2
- package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +24 -20
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useEditorComponents.js +2 -0
- package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
- package/dist-cjs/lib/hooks/useStateAttribute.js +35 -0
- package/dist-cjs/lib/hooks/useStateAttribute.js.map +7 -0
- package/dist-cjs/lib/license/Watermark.js +6 -6
- package/dist-cjs/lib/license/Watermark.js.map +1 -1
- package/dist-cjs/lib/options.js +7 -0
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/lib/utils/EditorAtom.js +45 -0
- package/dist-cjs/lib/utils/EditorAtom.js.map +7 -0
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +185 -9
- package/dist-esm/index.mjs +7 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +3 -1
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/components/MenuClickCapture.mjs +0 -5
- package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
- package/dist-esm/lib/components/Shape.mjs +4 -26
- package/dist-esm/lib/components/Shape.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +1 -1
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultScribble.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +9 -1
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultShapeWrapper.mjs +23 -0
- package/dist-esm/lib/components/default-components/DefaultShapeWrapper.mjs.map +7 -0
- package/dist-esm/lib/config/TLUserPreferences.mjs +9 -3
- package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +110 -59
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +9 -4
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/exports/getSvgJsx.mjs +2 -2
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +25 -21
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useEditorComponents.mjs +4 -0
- package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useStateAttribute.mjs +15 -0
- package/dist-esm/lib/hooks/useStateAttribute.mjs.map +7 -0
- package/dist-esm/lib/license/Watermark.mjs +6 -6
- package/dist-esm/lib/license/Watermark.mjs.map +1 -1
- package/dist-esm/lib/options.mjs +7 -0
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/lib/utils/EditorAtom.mjs +25 -0
- package/dist-esm/lib/utils/EditorAtom.mjs.map +7 -0
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +297 -311
- package/package.json +12 -36
- package/src/index.ts +7 -0
- package/src/lib/TldrawEditor.tsx +7 -5
- package/src/lib/components/MenuClickCapture.tsx +0 -8
- package/src/lib/components/Shape.tsx +6 -21
- package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +1 -1
- package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -1
- package/src/lib/components/default-components/DefaultScribble.tsx +1 -1
- package/src/lib/components/default-components/DefaultShapeIndicator.tsx +5 -1
- package/src/lib/components/default-components/DefaultShapeWrapper.tsx +35 -0
- package/src/lib/config/TLUserPreferences.ts +8 -1
- package/src/lib/editor/Editor.test.ts +12 -11
- package/src/lib/editor/Editor.ts +141 -82
- package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +15 -14
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +16 -15
- package/src/lib/editor/managers/FocusManager/FocusManager.test.ts +49 -48
- package/src/lib/editor/managers/FontManager/FontManager.test.ts +24 -23
- package/src/lib/editor/managers/HistoryManager/HistoryManager.test.ts +7 -6
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +12 -11
- package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +57 -50
- package/src/lib/editor/managers/TextManager/TextManager.test.ts +51 -26
- package/src/lib/editor/managers/TickManager/TickManager.test.ts +14 -13
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +34 -26
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +6 -1
- package/src/lib/editor/shapes/ShapeUtil.ts +57 -0
- package/src/lib/editor/types/misc-types.ts +73 -1
- package/src/lib/exports/getSvgJsx.tsx +2 -2
- package/src/lib/hooks/useCanvasEvents.ts +39 -32
- package/src/lib/hooks/useEditorComponents.tsx +7 -1
- package/src/lib/hooks/useStateAttribute.ts +15 -0
- package/src/lib/license/LicenseManager.test.ts +3 -1
- package/src/lib/license/Watermark.test.tsx +2 -1
- package/src/lib/license/Watermark.tsx +6 -6
- package/src/lib/options.ts +8 -0
- package/src/lib/utils/EditorAtom.ts +37 -0
- package/src/lib/utils/sync/LocalIndexedDb.test.ts +2 -1
- package/src/lib/utils/sync/TLLocalSyncClient.test.ts +15 -15
- package/src/version.ts +3 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useStateAttribute_exports = {};
|
|
20
|
+
__export(useStateAttribute_exports, {
|
|
21
|
+
useStateAttribute: () => useStateAttribute
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useStateAttribute_exports);
|
|
24
|
+
var import_state = require("@tldraw/state");
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_useEditor = require("./useEditor");
|
|
27
|
+
function useStateAttribute() {
|
|
28
|
+
const editor = (0, import_useEditor.useEditor)();
|
|
29
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
30
|
+
return (0, import_state.react)("stateAttribute", () => {
|
|
31
|
+
editor.getContainer().setAttribute("data-state", editor.getPath());
|
|
32
|
+
});
|
|
33
|
+
}, [editor]);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=useStateAttribute.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/hooks/useStateAttribute.ts"],
|
|
4
|
+
"sourcesContent": ["import { react } from '@tldraw/state'\nimport { useLayoutEffect } from 'react'\nimport { useEditor } from './useEditor'\n\nexport function useStateAttribute() {\n\tconst editor = useEditor()\n\n\t// we use a layout effect because we don't want there to be any perceptible delay between the\n\t// editor mounting and this attribute being applied, because styles may depend on it:\n\tuseLayoutEffect(() => {\n\t\treturn react('stateAttribute', () => {\n\t\t\teditor.getContainer().setAttribute('data-state', editor.getPath())\n\t\t})\n\t}, [editor])\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,mBAAgC;AAChC,uBAA0B;AAEnB,SAAS,oBAAoB;AACnC,QAAM,aAAS,4BAAU;AAIzB,oCAAgB,MAAM;AACrB,eAAO,oBAAM,kBAAkB,MAAM;AACpC,aAAO,aAAa,EAAE,aAAa,cAAc,OAAO,QAAQ,CAAC;AAAA,IAClE,CAAC;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AACZ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -99,15 +99,15 @@ To remove the watermark, please purchase a license at tldraw.dev.
|
|
|
99
99
|
|
|
100
100
|
.${className} {
|
|
101
101
|
position: absolute;
|
|
102
|
-
bottom: var(--space-2);
|
|
103
|
-
right: var(--space-2);
|
|
102
|
+
bottom: var(--tl-space-2);
|
|
103
|
+
right: var(--tl-space-2);
|
|
104
104
|
width: 96px;
|
|
105
105
|
height: 32px;
|
|
106
106
|
display: flex;
|
|
107
107
|
align-items: center;
|
|
108
108
|
justify-content: center;
|
|
109
|
-
z-index: var(--layer-watermark) !important;
|
|
110
|
-
background-color: color-mix(in srgb, var(--color-background) 62%, transparent);
|
|
109
|
+
z-index: var(--tl-layer-watermark) !important;
|
|
110
|
+
background-color: color-mix(in srgb, var(--tl-color-background) 62%, transparent);
|
|
111
111
|
opacity: 1;
|
|
112
112
|
border-radius: 5px;
|
|
113
113
|
pointer-events: all;
|
|
@@ -121,7 +121,7 @@ To remove the watermark, please purchase a license at tldraw.dev.
|
|
|
121
121
|
height: 32px;
|
|
122
122
|
pointer-events: all;
|
|
123
123
|
cursor: inherit;
|
|
124
|
-
color: var(--color-text);
|
|
124
|
+
color: var(--tl-color-text);
|
|
125
125
|
opacity: .38;
|
|
126
126
|
border: 0;
|
|
127
127
|
padding: 0;
|
|
@@ -150,7 +150,7 @@ To remove the watermark, please purchase a license at tldraw.dev.
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
.${className}:hover {
|
|
153
|
-
background-color: var(--color-background);
|
|
153
|
+
background-color: var(--tl-color-background);
|
|
154
154
|
transition: background-color 0.2s ease-in-out;
|
|
155
155
|
transition-delay: 0.32s;
|
|
156
156
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/license/Watermark.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useValue } from '@tldraw/state-react'\nimport { memo, useRef } from 'react'\nimport { useCanvasEvents } from '../hooks/useCanvasEvents'\nimport { useEditor } from '../hooks/useEditor'\nimport { usePassThroughWheelEvents } from '../hooks/usePassThroughWheelEvents'\nimport { preventDefault, stopEventPropagation } from '../utils/dom'\nimport { runtime } from '../utils/runtime'\nimport { watermarkDesktopSvg, watermarkMobileSvg } from '../watermarks'\nimport { LicenseManager } from './LicenseManager'\nimport { useLicenseContext } from './LicenseProvider'\nimport { useLicenseManagerState } from './useLicenseManagerState'\n\nconst WATERMARK_DESKTOP_LOCAL_SRC = `data:image/svg+xml;utf8,${encodeURIComponent(watermarkDesktopSvg)}`\nconst WATERMARK_MOBILE_LOCAL_SRC = `data:image/svg+xml;utf8,${encodeURIComponent(watermarkMobileSvg)}`\n\n/** @internal */\nexport const Watermark = memo(function Watermark() {\n\tconst licenseManager = useLicenseContext()\n\tconst editor = useEditor()\n\tconst isMobile = useValue('is mobile', () => editor.getViewportScreenBounds().width < 700, [\n\t\teditor,\n\t])\n\n\tconst licenseManagerState = useLicenseManagerState(licenseManager)\n\n\tif (!['licensed-with-watermark', 'unlicensed'].includes(licenseManagerState)) return null\n\n\treturn (\n\t\t<>\n\t\t\t<LicenseStyles />\n\t\t\t<WatermarkInner src={isMobile ? WATERMARK_MOBILE_LOCAL_SRC : WATERMARK_DESKTOP_LOCAL_SRC} />\n\t\t</>\n\t)\n})\n\nconst WatermarkInner = memo(function WatermarkInner({ src }: { src: string }) {\n\tconst editor = useEditor()\n\tconst isDebugMode = useValue('debug mode', () => editor.getInstanceState().isDebugMode, [editor])\n\tconst isMobile = useValue('is mobile', () => editor.getViewportScreenBounds().width < 700, [\n\t\teditor,\n\t])\n\tconst events = useCanvasEvents()\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst maskCss = `url('${src}') center 100% / 100% no-repeat`\n\tconst url = 'https://tldraw.dev/?utm_source=dotcom&utm_medium=organic&utm_campaign=watermark'\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={LicenseManager.className}\n\t\t\tdata-debug={isDebugMode}\n\t\t\tdata-mobile={isMobile}\n\t\t\tdraggable={false}\n\t\t\t{...events}\n\t\t>\n\t\t\t<button\n\t\t\t\tdraggable={false}\n\t\t\t\trole=\"button\"\n\t\t\t\tonPointerDown={(e) => {\n\t\t\t\t\tstopEventPropagation(e)\n\t\t\t\t\tpreventDefault(e)\n\t\t\t\t}}\n\t\t\t\ttitle=\"made with tldraw\"\n\t\t\t\tonClick={() => runtime.openWindow(url, '_blank')}\n\t\t\t\tstyle={{ mask: maskCss, WebkitMask: maskCss }}\n\t\t\t/>\n\t\t</div>\n\t)\n})\n\nconst LicenseStyles = memo(function LicenseStyles() {\n\tconst editor = useEditor()\n\tconst className = LicenseManager.className\n\n\tconst CSS = `/* ------------------- SEE LICENSE -------------------\nThe tldraw watermark is part of tldraw's license. It is shown for unlicensed\nor \"licensed-with-watermark\" users. By using this library, you agree to\npreserve the watermark's behavior, keeping it visible, unobscured, and\navailable to user-interaction.\n\nTo remove the watermark, please purchase a license at tldraw.dev.\n*/\n\n\t.${className} {\n\t\tposition: absolute;\n\t\tbottom: var(--space-2);\n\t\tright: var(--space-2);\n\t\twidth: 96px;\n\t\theight: 32px;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tz-index: var(--layer-watermark) !important;\n\t\tbackground-color: color-mix(in srgb, var(--color-background) 62%, transparent);\n\t\topacity: 1;\n\t\tborder-radius: 5px;\n\t\tpointer-events: all;\n\t\tpadding: 2px;\n\t\tbox-sizing: content-box;\n\t}\n\n\t.${className} > button {\n\t\tposition: absolute;\n\t\twidth: 96px;\n\t\theight: 32px;\n\t\tpointer-events: all;\n\t\tcursor: inherit;\n\t\tcolor: var(--color-text);\n\t\topacity: .38;\n\t\tborder: 0;\n\t\tpadding: 0;\n\t\tbackground-color: currentColor;\n\t}\n\n\t.${className}[data-debug='true'] {\n\t\tbottom: 46px;\n\t}\n\n\t.${className}[data-mobile='true'] {\n\t\tborder-radius: 4px 0px 0px 4px;\n\t\tright: -2px;\n\t\twidth: 8px;\n\t\theight: 48px;\n\t}\n\n\t.${className}[data-mobile='true'] > button {\n\t\twidth: 8px;\n\t\theight: 32px;\n\t}\n\n\t@media (hover: hover) {\n\t\t.${className} > button {\n\t\t\tpointer-events: none;\n\t\t}\n\n\t\t.${className}:hover {\n\t\t\tbackground-color: var(--color-background);\n\t\t\ttransition: background-color 0.2s ease-in-out;\n\t\t\ttransition-delay: 0.32s;\n\t\t}\n\n\t\t.${className}:hover > button {\n\t\t\tanimation: ${className}_delayed_link 0.2s forwards ease-in-out;\n\t\t\tanimation-delay: 0.32s;\n\t\t}\n\n\t\t.${className} > button:focus-visible {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\n\t@keyframes ${className}_delayed_link {\n\t\t0% {\n\t\t\tcursor: inherit;\n\t\t\topacity: .38;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t100% {\n\t\t\tcursor: pointer;\n\t\t\topacity: 1;\n\t\t\tpointer-events: all;\n\t\t}\n\t}`\n\n\treturn <style nonce={editor.options.nonce}>{CSS}</style>\n})\n"],
|
|
4
|
+
"sourcesContent": ["import { useValue } from '@tldraw/state-react'\nimport { memo, useRef } from 'react'\nimport { useCanvasEvents } from '../hooks/useCanvasEvents'\nimport { useEditor } from '../hooks/useEditor'\nimport { usePassThroughWheelEvents } from '../hooks/usePassThroughWheelEvents'\nimport { preventDefault, stopEventPropagation } from '../utils/dom'\nimport { runtime } from '../utils/runtime'\nimport { watermarkDesktopSvg, watermarkMobileSvg } from '../watermarks'\nimport { LicenseManager } from './LicenseManager'\nimport { useLicenseContext } from './LicenseProvider'\nimport { useLicenseManagerState } from './useLicenseManagerState'\n\nconst WATERMARK_DESKTOP_LOCAL_SRC = `data:image/svg+xml;utf8,${encodeURIComponent(watermarkDesktopSvg)}`\nconst WATERMARK_MOBILE_LOCAL_SRC = `data:image/svg+xml;utf8,${encodeURIComponent(watermarkMobileSvg)}`\n\n/** @internal */\nexport const Watermark = memo(function Watermark() {\n\tconst licenseManager = useLicenseContext()\n\tconst editor = useEditor()\n\tconst isMobile = useValue('is mobile', () => editor.getViewportScreenBounds().width < 700, [\n\t\teditor,\n\t])\n\n\tconst licenseManagerState = useLicenseManagerState(licenseManager)\n\n\tif (!['licensed-with-watermark', 'unlicensed'].includes(licenseManagerState)) return null\n\n\treturn (\n\t\t<>\n\t\t\t<LicenseStyles />\n\t\t\t<WatermarkInner src={isMobile ? WATERMARK_MOBILE_LOCAL_SRC : WATERMARK_DESKTOP_LOCAL_SRC} />\n\t\t</>\n\t)\n})\n\nconst WatermarkInner = memo(function WatermarkInner({ src }: { src: string }) {\n\tconst editor = useEditor()\n\tconst isDebugMode = useValue('debug mode', () => editor.getInstanceState().isDebugMode, [editor])\n\tconst isMobile = useValue('is mobile', () => editor.getViewportScreenBounds().width < 700, [\n\t\teditor,\n\t])\n\tconst events = useCanvasEvents()\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst maskCss = `url('${src}') center 100% / 100% no-repeat`\n\tconst url = 'https://tldraw.dev/?utm_source=dotcom&utm_medium=organic&utm_campaign=watermark'\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={LicenseManager.className}\n\t\t\tdata-debug={isDebugMode}\n\t\t\tdata-mobile={isMobile}\n\t\t\tdraggable={false}\n\t\t\t{...events}\n\t\t>\n\t\t\t<button\n\t\t\t\tdraggable={false}\n\t\t\t\trole=\"button\"\n\t\t\t\tonPointerDown={(e) => {\n\t\t\t\t\tstopEventPropagation(e)\n\t\t\t\t\tpreventDefault(e)\n\t\t\t\t}}\n\t\t\t\ttitle=\"made with tldraw\"\n\t\t\t\tonClick={() => runtime.openWindow(url, '_blank')}\n\t\t\t\tstyle={{ mask: maskCss, WebkitMask: maskCss }}\n\t\t\t/>\n\t\t</div>\n\t)\n})\n\nconst LicenseStyles = memo(function LicenseStyles() {\n\tconst editor = useEditor()\n\tconst className = LicenseManager.className\n\n\tconst CSS = `/* ------------------- SEE LICENSE -------------------\nThe tldraw watermark is part of tldraw's license. It is shown for unlicensed\nor \"licensed-with-watermark\" users. By using this library, you agree to\npreserve the watermark's behavior, keeping it visible, unobscured, and\navailable to user-interaction.\n\nTo remove the watermark, please purchase a license at tldraw.dev.\n*/\n\n\t.${className} {\n\t\tposition: absolute;\n\t\tbottom: var(--tl-space-2);\n\t\tright: var(--tl-space-2);\n\t\twidth: 96px;\n\t\theight: 32px;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tz-index: var(--tl-layer-watermark) !important;\n\t\tbackground-color: color-mix(in srgb, var(--tl-color-background) 62%, transparent);\n\t\topacity: 1;\n\t\tborder-radius: 5px;\n\t\tpointer-events: all;\n\t\tpadding: 2px;\n\t\tbox-sizing: content-box;\n\t}\n\n\t.${className} > button {\n\t\tposition: absolute;\n\t\twidth: 96px;\n\t\theight: 32px;\n\t\tpointer-events: all;\n\t\tcursor: inherit;\n\t\tcolor: var(--tl-color-text);\n\t\topacity: .38;\n\t\tborder: 0;\n\t\tpadding: 0;\n\t\tbackground-color: currentColor;\n\t}\n\n\t.${className}[data-debug='true'] {\n\t\tbottom: 46px;\n\t}\n\n\t.${className}[data-mobile='true'] {\n\t\tborder-radius: 4px 0px 0px 4px;\n\t\tright: -2px;\n\t\twidth: 8px;\n\t\theight: 48px;\n\t}\n\n\t.${className}[data-mobile='true'] > button {\n\t\twidth: 8px;\n\t\theight: 32px;\n\t}\n\n\t@media (hover: hover) {\n\t\t.${className} > button {\n\t\t\tpointer-events: none;\n\t\t}\n\n\t\t.${className}:hover {\n\t\t\tbackground-color: var(--tl-color-background);\n\t\t\ttransition: background-color 0.2s ease-in-out;\n\t\t\ttransition-delay: 0.32s;\n\t\t}\n\n\t\t.${className}:hover > button {\n\t\t\tanimation: ${className}_delayed_link 0.2s forwards ease-in-out;\n\t\t\tanimation-delay: 0.32s;\n\t\t}\n\n\t\t.${className} > button:focus-visible {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\n\t@keyframes ${className}_delayed_link {\n\t\t0% {\n\t\t\tcursor: inherit;\n\t\t\topacity: .38;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t100% {\n\t\t\tcursor: pointer;\n\t\t\topacity: 1;\n\t\t\tpointer-events: all;\n\t\t}\n\t}`\n\n\treturn <style nonce={editor.options.nonce}>{CSS}</style>\n})\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BE;AA5BF,yBAAyB;AACzB,mBAA6B;AAC7B,6BAAgC;AAChC,uBAA0B;AAC1B,uCAA0C;AAC1C,iBAAqD;AACrD,qBAAwB;AACxB,wBAAwD;AACxD,4BAA+B;AAC/B,6BAAkC;AAClC,oCAAuC;AAEvC,MAAM,8BAA8B,2BAA2B,mBAAmB,qCAAmB,CAAC;AACtG,MAAM,6BAA6B,2BAA2B,mBAAmB,oCAAkB,CAAC;AAG7F,MAAM,gBAAY,mBAAK,SAASA,aAAY;AAClD,QAAM,qBAAiB,0CAAkB;AACzC,QAAM,aAAS,4BAAU;AACzB,QAAM,eAAW,6BAAS,aAAa,MAAM,OAAO,wBAAwB,EAAE,QAAQ,KAAK;AAAA,IAC1F;AAAA,EACD,CAAC;AAED,QAAM,0BAAsB,sDAAuB,cAAc;AAEjE,MAAI,CAAC,CAAC,2BAA2B,YAAY,EAAE,SAAS,mBAAmB,EAAG,QAAO;AAErF,SACC,4EACC;AAAA,gDAAC,iBAAc;AAAA,IACf,4CAAC,kBAAe,KAAK,WAAW,6BAA6B,6BAA6B;AAAA,KAC3F;AAEF,CAAC;AAED,MAAM,qBAAiB,mBAAK,SAASC,gBAAe,EAAE,IAAI,GAAoB;AAC7E,QAAM,aAAS,4BAAU;AACzB,QAAM,kBAAc,6BAAS,cAAc,MAAM,OAAO,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAAC;AAChG,QAAM,eAAW,6BAAS,aAAa,MAAM,OAAO,wBAAwB,EAAE,QAAQ,KAAK;AAAA,IAC1F;AAAA,EACD,CAAC;AACD,QAAM,aAAS,wCAAgB;AAE/B,QAAM,UAAM,qBAAuB,IAAI;AACvC,kEAA0B,GAAG;AAE7B,QAAM,UAAU,QAAQ,GAAG;AAC3B,QAAM,MAAM;AAEZ,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAW,qCAAe;AAAA,MAC1B,cAAY;AAAA,MACZ,eAAa;AAAA,MACb,WAAW;AAAA,MACV,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACA,WAAW;AAAA,UACX,MAAK;AAAA,UACL,eAAe,CAAC,MAAM;AACrB,iDAAqB,CAAC;AACtB,2CAAe,CAAC;AAAA,UACjB;AAAA,UACA,OAAM;AAAA,UACN,SAAS,MAAM,uBAAQ,WAAW,KAAK,QAAQ;AAAA,UAC/C,OAAO,EAAE,MAAM,SAAS,YAAY,QAAQ;AAAA;AAAA,MAC7C;AAAA;AAAA,EACD;AAEF,CAAC;AAED,MAAM,oBAAgB,mBAAK,SAASC,iBAAgB;AACnD,QAAM,aAAS,4BAAU;AACzB,QAAM,YAAY,qCAAe;AAEjC,QAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAST,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAkBT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAaT,SAAS;AAAA;AAAA;AAAA;AAAA,IAIT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAMR,SAAS;AAAA;AAAA;AAAA;AAAA,KAIT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAMT,SAAS;AAAA,gBACE,SAAS;AAAA;AAAA;AAAA;AAAA,KAIpB,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAMA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAatB,SAAO,4CAAC,WAAM,OAAO,OAAO,QAAQ,OAAQ,eAAI;AACjD,CAAC;",
|
|
6
6
|
"names": ["Watermark", "WatermarkInner", "LicenseStyles"]
|
|
7
7
|
}
|
package/dist-cjs/lib/options.js
CHANGED
|
@@ -34,6 +34,12 @@ const defaultTldrawOptions = {
|
|
|
34
34
|
// 6 squared
|
|
35
35
|
dragDistanceSquared: 16,
|
|
36
36
|
// 4 squared
|
|
37
|
+
uiDragDistanceSquared: 16,
|
|
38
|
+
// 4 squared
|
|
39
|
+
// it's really easy to accidentally drag from the toolbar on mobile, so we use a much larger
|
|
40
|
+
// threshold than usual here to try and prevent accidental drags.
|
|
41
|
+
uiCoarseDragDistanceSquared: 625,
|
|
42
|
+
// 25 squared
|
|
37
43
|
defaultSvgPadding: 32,
|
|
38
44
|
cameraSlideFriction: 0.09,
|
|
39
45
|
gridSteps: [
|
|
@@ -61,6 +67,7 @@ const defaultTldrawOptions = {
|
|
|
61
67
|
flattenImageBoundsPadding: 16,
|
|
62
68
|
laserDelayMs: 1200,
|
|
63
69
|
maxExportDelayMs: 5e3,
|
|
70
|
+
tooltipDelayMs: 700,
|
|
64
71
|
temporaryAssetPreviewLifetimeMs: 18e4,
|
|
65
72
|
actionShortcutsLocation: "swap",
|
|
66
73
|
createTextOnCanvasDoubleClick: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/options.ts"],
|
|
4
|
-
"sourcesContent": ["import { ComponentType, Fragment } from 'react'\n\n/**\n * Options for configuring tldraw. For defaults, see {@link defaultTldrawOptions}.\n *\n * @example\n * ```tsx\n * const options: Partial<TldrawOptions> = {\n * maxPages: 3,\n * maxShapesPerPage: 1000,\n * }\n *\n * function MyTldrawComponent() {\n * return <Tldraw options={options} />\n * }\n * ```\n *\n * @public\n */\nexport interface TldrawOptions {\n\treadonly maxShapesPerPage: number\n\treadonly maxFilesAtOnce: number\n\treadonly maxPages: number\n\treadonly animationMediumMs: number\n\treadonly followChaseViewportSnap: number\n\treadonly doubleClickDurationMs: number\n\treadonly multiClickDurationMs: number\n\treadonly coarseDragDistanceSquared: number\n\treadonly dragDistanceSquared: number\n\treadonly defaultSvgPadding: number\n\treadonly cameraSlideFriction: number\n\treadonly gridSteps: readonly {\n\t\treadonly min: number\n\t\treadonly mid: number\n\t\treadonly step: number\n\t}[]\n\treadonly collaboratorInactiveTimeoutMs: number\n\treadonly collaboratorIdleTimeoutMs: number\n\treadonly collaboratorCheckIntervalMs: number\n\treadonly cameraMovingTimeoutMs: number\n\treadonly hitTestMargin: number\n\treadonly edgeScrollDelay: number\n\treadonly edgeScrollEaseDuration: number\n\treadonly edgeScrollSpeed: number\n\treadonly edgeScrollDistance: number\n\treadonly coarsePointerWidth: number\n\treadonly coarseHandleRadius: number\n\treadonly handleRadius: number\n\treadonly longPressDurationMs: number\n\treadonly textShadowLod: number\n\treadonly adjacentShapeMargin: number\n\treadonly flattenImageBoundsExpand: number\n\treadonly flattenImageBoundsPadding: number\n\treadonly laserDelayMs: number\n\treadonly maxExportDelayMs: number\n\t/**\n\t * How long should previews created by {@link Editor.createTemporaryAssetPreview} last before\n\t * they expire? Defaults to 3 minutes.\n\t */\n\treadonly temporaryAssetPreviewLifetimeMs: number\n\treadonly actionShortcutsLocation: 'menu' | 'toolbar' | 'swap'\n\treadonly createTextOnCanvasDoubleClick: boolean\n\t/**\n\t * The react provider to use when exporting an image. This is useful if your shapes depend on\n\t * external context providers. By default, this is `React.Fragment`.\n\t */\n\treadonly exportProvider: ComponentType<{ children: React.ReactNode }>\n\t/**\n\t * By default, the toolbar items are accessible via number shortcuts according to their order. To disable this, set this option to false.\n\t */\n\treadonly enableToolbarKeyboardShortcuts: boolean\n\t/**\n\t * The maximum number of fonts that will be loaded while blocking the main rendering of the\n\t * canvas. If there are more than this number of fonts needed, we'll just show the canvas right\n\t * away and let the fonts load in in the background.\n\t */\n\treadonly maxFontsToLoadBeforeRender: number\n\t/**\n\t * If you have a CSP policy that blocks inline styles, you can use this prop to provide a\n\t * nonce to use in the editor's styles.\n\t */\n\treadonly nonce: string | undefined\n\t/**\n\t * Branding name of the app, currently only used for adding aria-label for the application.\n\t */\n\treadonly branding?: string\n}\n\n/** @public */\nexport const defaultTldrawOptions = {\n\tmaxShapesPerPage: 4000,\n\tmaxFilesAtOnce: 100,\n\tmaxPages: 40,\n\tanimationMediumMs: 320,\n\tfollowChaseViewportSnap: 2,\n\tdoubleClickDurationMs: 450,\n\tmultiClickDurationMs: 200,\n\tcoarseDragDistanceSquared: 36, // 6 squared\n\tdragDistanceSquared: 16, // 4 squared\n\tdefaultSvgPadding: 32,\n\tcameraSlideFriction: 0.09,\n\tgridSteps: [\n\t\t{ min: -1, mid: 0.15, step: 64 },\n\t\t{ min: 0.05, mid: 0.375, step: 16 },\n\t\t{ min: 0.15, mid: 1, step: 4 },\n\t\t{ min: 0.7, mid: 2.5, step: 1 },\n\t],\n\tcollaboratorInactiveTimeoutMs: 60000,\n\tcollaboratorIdleTimeoutMs: 3000,\n\tcollaboratorCheckIntervalMs: 1200,\n\tcameraMovingTimeoutMs: 64,\n\thitTestMargin: 8,\n\tedgeScrollDelay: 200,\n\tedgeScrollEaseDuration: 200,\n\tedgeScrollSpeed: 25,\n\tedgeScrollDistance: 8,\n\tcoarsePointerWidth: 12,\n\tcoarseHandleRadius: 20,\n\thandleRadius: 12,\n\tlongPressDurationMs: 500,\n\ttextShadowLod: 0.35,\n\tadjacentShapeMargin: 10,\n\tflattenImageBoundsExpand: 64,\n\tflattenImageBoundsPadding: 16,\n\tlaserDelayMs: 1200,\n\tmaxExportDelayMs: 5000,\n\ttemporaryAssetPreviewLifetimeMs: 180000,\n\tactionShortcutsLocation: 'swap',\n\tcreateTextOnCanvasDoubleClick: true,\n\texportProvider: Fragment,\n\tenableToolbarKeyboardShortcuts: true,\n\tmaxFontsToLoadBeforeRender: Infinity,\n\tnonce: undefined,\n} as const satisfies TldrawOptions\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwC;
|
|
4
|
+
"sourcesContent": ["import { ComponentType, Fragment } from 'react'\n\n/**\n * Options for configuring tldraw. For defaults, see {@link defaultTldrawOptions}.\n *\n * @example\n * ```tsx\n * const options: Partial<TldrawOptions> = {\n * maxPages: 3,\n * maxShapesPerPage: 1000,\n * }\n *\n * function MyTldrawComponent() {\n * return <Tldraw options={options} />\n * }\n * ```\n *\n * @public\n */\nexport interface TldrawOptions {\n\treadonly maxShapesPerPage: number\n\treadonly maxFilesAtOnce: number\n\treadonly maxPages: number\n\treadonly animationMediumMs: number\n\treadonly followChaseViewportSnap: number\n\treadonly doubleClickDurationMs: number\n\treadonly multiClickDurationMs: number\n\treadonly coarseDragDistanceSquared: number\n\treadonly dragDistanceSquared: number\n\treadonly uiDragDistanceSquared: number\n\treadonly uiCoarseDragDistanceSquared: number\n\treadonly defaultSvgPadding: number\n\treadonly cameraSlideFriction: number\n\treadonly gridSteps: readonly {\n\t\treadonly min: number\n\t\treadonly mid: number\n\t\treadonly step: number\n\t}[]\n\treadonly collaboratorInactiveTimeoutMs: number\n\treadonly collaboratorIdleTimeoutMs: number\n\treadonly collaboratorCheckIntervalMs: number\n\treadonly cameraMovingTimeoutMs: number\n\treadonly hitTestMargin: number\n\treadonly edgeScrollDelay: number\n\treadonly edgeScrollEaseDuration: number\n\treadonly edgeScrollSpeed: number\n\treadonly edgeScrollDistance: number\n\treadonly coarsePointerWidth: number\n\treadonly coarseHandleRadius: number\n\treadonly handleRadius: number\n\treadonly longPressDurationMs: number\n\treadonly textShadowLod: number\n\treadonly adjacentShapeMargin: number\n\treadonly flattenImageBoundsExpand: number\n\treadonly flattenImageBoundsPadding: number\n\treadonly laserDelayMs: number\n\treadonly maxExportDelayMs: number\n\treadonly tooltipDelayMs: number\n\t/**\n\t * How long should previews created by {@link Editor.createTemporaryAssetPreview} last before\n\t * they expire? Defaults to 3 minutes.\n\t */\n\treadonly temporaryAssetPreviewLifetimeMs: number\n\treadonly actionShortcutsLocation: 'menu' | 'toolbar' | 'swap'\n\treadonly createTextOnCanvasDoubleClick: boolean\n\t/**\n\t * The react provider to use when exporting an image. This is useful if your shapes depend on\n\t * external context providers. By default, this is `React.Fragment`.\n\t */\n\treadonly exportProvider: ComponentType<{ children: React.ReactNode }>\n\t/**\n\t * By default, the toolbar items are accessible via number shortcuts according to their order. To disable this, set this option to false.\n\t */\n\treadonly enableToolbarKeyboardShortcuts: boolean\n\t/**\n\t * The maximum number of fonts that will be loaded while blocking the main rendering of the\n\t * canvas. If there are more than this number of fonts needed, we'll just show the canvas right\n\t * away and let the fonts load in in the background.\n\t */\n\treadonly maxFontsToLoadBeforeRender: number\n\t/**\n\t * If you have a CSP policy that blocks inline styles, you can use this prop to provide a\n\t * nonce to use in the editor's styles.\n\t */\n\treadonly nonce: string | undefined\n\t/**\n\t * Branding name of the app, currently only used for adding aria-label for the application.\n\t */\n\treadonly branding?: string\n}\n\n/** @public */\nexport const defaultTldrawOptions = {\n\tmaxShapesPerPage: 4000,\n\tmaxFilesAtOnce: 100,\n\tmaxPages: 40,\n\tanimationMediumMs: 320,\n\tfollowChaseViewportSnap: 2,\n\tdoubleClickDurationMs: 450,\n\tmultiClickDurationMs: 200,\n\tcoarseDragDistanceSquared: 36, // 6 squared\n\tdragDistanceSquared: 16, // 4 squared\n\tuiDragDistanceSquared: 16, // 4 squared\n\t// it's really easy to accidentally drag from the toolbar on mobile, so we use a much larger\n\t// threshold than usual here to try and prevent accidental drags.\n\tuiCoarseDragDistanceSquared: 625, // 25 squared\n\tdefaultSvgPadding: 32,\n\tcameraSlideFriction: 0.09,\n\tgridSteps: [\n\t\t{ min: -1, mid: 0.15, step: 64 },\n\t\t{ min: 0.05, mid: 0.375, step: 16 },\n\t\t{ min: 0.15, mid: 1, step: 4 },\n\t\t{ min: 0.7, mid: 2.5, step: 1 },\n\t],\n\tcollaboratorInactiveTimeoutMs: 60000,\n\tcollaboratorIdleTimeoutMs: 3000,\n\tcollaboratorCheckIntervalMs: 1200,\n\tcameraMovingTimeoutMs: 64,\n\thitTestMargin: 8,\n\tedgeScrollDelay: 200,\n\tedgeScrollEaseDuration: 200,\n\tedgeScrollSpeed: 25,\n\tedgeScrollDistance: 8,\n\tcoarsePointerWidth: 12,\n\tcoarseHandleRadius: 20,\n\thandleRadius: 12,\n\tlongPressDurationMs: 500,\n\ttextShadowLod: 0.35,\n\tadjacentShapeMargin: 10,\n\tflattenImageBoundsExpand: 64,\n\tflattenImageBoundsPadding: 16,\n\tlaserDelayMs: 1200,\n\tmaxExportDelayMs: 5000,\n\ttooltipDelayMs: 700,\n\ttemporaryAssetPreviewLifetimeMs: 180000,\n\tactionShortcutsLocation: 'swap',\n\tcreateTextOnCanvasDoubleClick: true,\n\texportProvider: Fragment,\n\tenableToolbarKeyboardShortcuts: true,\n\tmaxFontsToLoadBeforeRender: Infinity,\n\tnonce: undefined,\n} as const satisfies TldrawOptions\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwC;AA4FjC,MAAM,uBAAuB;AAAA,EACnC,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EACzB,uBAAuB;AAAA,EACvB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA;AAAA,EAC3B,qBAAqB;AAAA;AAAA,EACrB,uBAAuB;AAAA;AAAA;AAAA;AAAA,EAGvB,6BAA6B;AAAA;AAAA,EAC7B,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,WAAW;AAAA,IACV,EAAE,KAAK,IAAI,KAAK,MAAM,MAAM,GAAG;AAAA,IAC/B,EAAE,KAAK,MAAM,KAAK,OAAO,MAAM,GAAG;AAAA,IAClC,EAAE,KAAK,MAAM,KAAK,GAAG,MAAM,EAAE;AAAA,IAC7B,EAAE,KAAK,KAAK,KAAK,KAAK,MAAM,EAAE;AAAA,EAC/B;AAAA,EACA,+BAA+B;AAAA,EAC/B,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,uBAAuB;AAAA,EACvB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,wBAAwB;AAAA,EACxB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,qBAAqB;AAAA,EACrB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,iCAAiC;AAAA,EACjC,yBAAyB;AAAA,EACzB,+BAA+B;AAAA,EAC/B,gBAAgB;AAAA,EAChB,gCAAgC;AAAA,EAChC,4BAA4B;AAAA,EAC5B,OAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var EditorAtom_exports = {};
|
|
20
|
+
__export(EditorAtom_exports, {
|
|
21
|
+
EditorAtom: () => EditorAtom
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(EditorAtom_exports);
|
|
24
|
+
var import_state = require("@tldraw/state");
|
|
25
|
+
var import_utils = require("@tldraw/utils");
|
|
26
|
+
class EditorAtom {
|
|
27
|
+
constructor(name, getInitialState) {
|
|
28
|
+
this.name = name;
|
|
29
|
+
this.getInitialState = getInitialState;
|
|
30
|
+
}
|
|
31
|
+
states = new import_utils.WeakCache();
|
|
32
|
+
getAtom(editor) {
|
|
33
|
+
return this.states.get(editor, () => (0, import_state.atom)(this.name, this.getInitialState(editor)));
|
|
34
|
+
}
|
|
35
|
+
get(editor) {
|
|
36
|
+
return this.getAtom(editor).get();
|
|
37
|
+
}
|
|
38
|
+
update(editor, update) {
|
|
39
|
+
return this.getAtom(editor).update(update);
|
|
40
|
+
}
|
|
41
|
+
set(editor, state) {
|
|
42
|
+
return this.getAtom(editor).set(state);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=EditorAtom.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/utils/EditorAtom.ts"],
|
|
4
|
+
"sourcesContent": ["import { atom, Atom } from '@tldraw/state'\nimport { WeakCache } from '@tldraw/utils'\nimport { Editor } from '../editor/Editor'\n\n/**\n * An Atom that is scoped to the lifetime of an Editor.\n *\n * This is useful for storing UI state for tldraw applications. Keeping state scoped to an editor\n * instead of stored in a global atom can prevent issues with state being shared between editors\n * when navigating between pages, or when multiple editor instances are used on the same page.\n *\n * @public\n */\nexport class EditorAtom<T> {\n\tprivate states = new WeakCache<Editor, Atom<T>>()\n\n\tconstructor(\n\t\tprivate name: string,\n\t\tprivate getInitialState: (editor: Editor) => T\n\t) {}\n\n\tgetAtom(editor: Editor): Atom<T> {\n\t\treturn this.states.get(editor, () => atom(this.name, this.getInitialState(editor)))\n\t}\n\n\tget(editor: Editor): T {\n\t\treturn this.getAtom(editor).get()\n\t}\n\n\tupdate(editor: Editor, update: (state: T) => T): T {\n\t\treturn this.getAtom(editor).update(update)\n\t}\n\n\tset(editor: Editor, state: T): T {\n\t\treturn this.getAtom(editor).set(state)\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAC3B,mBAA0B;AAYnB,MAAM,WAAc;AAAA,EAG1B,YACS,MACA,iBACP;AAFO;AACA;AAAA,EACN;AAAA,EALK,SAAS,IAAI,uBAA2B;AAAA,EAOhD,QAAQ,QAAyB;AAChC,WAAO,KAAK,OAAO,IAAI,QAAQ,UAAM,mBAAK,KAAK,MAAM,KAAK,gBAAgB,MAAM,CAAC,CAAC;AAAA,EACnF;AAAA,EAEA,IAAI,QAAmB;AACtB,WAAO,KAAK,QAAQ,MAAM,EAAE,IAAI;AAAA,EACjC;AAAA,EAEA,OAAO,QAAgB,QAA4B;AAClD,WAAO,KAAK,QAAQ,MAAM,EAAE,OAAO,MAAM;AAAA,EAC1C;AAAA,EAEA,IAAI,QAAgB,OAAa;AAChC,WAAO,KAAK,QAAQ,MAAM,EAAE,IAAI,KAAK;AAAA,EACtC;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist-cjs/version.js
CHANGED
|
@@ -22,10 +22,10 @@ __export(version_exports, {
|
|
|
22
22
|
version: () => version
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(version_exports);
|
|
25
|
-
const version = "3.
|
|
25
|
+
const version = "3.16.0-canary.01f62b6d4455";
|
|
26
26
|
const publishDates = {
|
|
27
27
|
major: "2024-09-13T14:36:29.063Z",
|
|
28
|
-
minor: "2025-
|
|
29
|
-
patch: "2025-
|
|
28
|
+
minor: "2025-08-15T16:40:58.045Z",
|
|
29
|
+
patch: "2025-08-15T16:40:58.045Z"
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=version.js.map
|
package/dist-cjs/version.js.map
CHANGED
|
@@ -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 = '3.
|
|
4
|
+
"sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.16.0-canary.01f62b6d4455'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-08-15T16:40:58.045Z',\n\tpatch: '2025-08-15T16:40:58.045Z',\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
|
}
|
package/dist-esm/index.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ import { Editor as Editor_2 } from '@tiptap/core';
|
|
|
7
7
|
import { EditorProviderProps as EditorProviderProps_2 } from '@tiptap/react';
|
|
8
8
|
import EventEmitter from 'eventemitter3';
|
|
9
9
|
import { ExoticComponent } from 'react';
|
|
10
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
10
11
|
import { HistoryEntry } from '@tldraw/store';
|
|
11
12
|
import { IndexKey } from '@tldraw/utils';
|
|
12
13
|
import { JsonObject } from '@tldraw/utils';
|
|
@@ -23,6 +24,7 @@ import { ReactElement } from 'react';
|
|
|
23
24
|
import { ReactNode } from 'react';
|
|
24
25
|
import { RecordProps } from '@tldraw/tlschema';
|
|
25
26
|
import { RecordsDiff } from '@tldraw/store';
|
|
27
|
+
import { RefAttributes } from 'react';
|
|
26
28
|
import { RefObject } from 'react';
|
|
27
29
|
import { SerializedSchema } from '@tldraw/store';
|
|
28
30
|
import { SerializedStore } from '@tldraw/store';
|
|
@@ -817,6 +819,9 @@ export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicato
|
|
|
817
819
|
/** @public @react */
|
|
818
820
|
export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicatorsProps>;
|
|
819
821
|
|
|
822
|
+
/** @public @react */
|
|
823
|
+
export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
824
|
+
|
|
820
825
|
/** @public @react */
|
|
821
826
|
export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX_2.Element;
|
|
822
827
|
|
|
@@ -884,6 +889,9 @@ export declare const defaultTldrawOptions: {
|
|
|
884
889
|
readonly nonce: undefined;
|
|
885
890
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
886
891
|
readonly textShadowLod: 0.35;
|
|
892
|
+
readonly tooltipDelayMs: 700;
|
|
893
|
+
readonly uiCoarseDragDistanceSquared: 625;
|
|
894
|
+
readonly uiDragDistanceSquared: 16;
|
|
887
895
|
};
|
|
888
896
|
|
|
889
897
|
/** @public */
|
|
@@ -899,6 +907,7 @@ export declare const defaultUserPreferences: Readonly<{
|
|
|
899
907
|
isWrapMode: false;
|
|
900
908
|
locale: "ar" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fa" | "fi" | "fr" | "gl" | "gu-in" | "he" | "hi-in" | "hr" | "hu" | "id" | "it" | "ja" | "km-kh" | "kn" | "ko-kr" | "ml" | "mr" | "ms" | "ne" | "nl" | "no" | "pa" | "pl" | "pt-br" | "pt-pt" | "ro" | "ru" | "sl" | "so" | "sv" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "ur" | "vi" | "zh-cn" | "zh-tw";
|
|
901
909
|
name: "";
|
|
910
|
+
showUiLabels: false;
|
|
902
911
|
}>;
|
|
903
912
|
|
|
904
913
|
/**
|
|
@@ -2685,15 +2694,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2685
2694
|
*
|
|
2686
2695
|
* @returns The shape at the given point, or undefined if there is no shape at the point.
|
|
2687
2696
|
*/
|
|
2688
|
-
getShapeAtPoint(point: VecLike, opts?:
|
|
2689
|
-
filter?(shape: TLShape): boolean;
|
|
2690
|
-
hitFrameInside?: boolean;
|
|
2691
|
-
hitInside?: boolean;
|
|
2692
|
-
hitLabels?: boolean;
|
|
2693
|
-
hitLocked?: boolean;
|
|
2694
|
-
margin?: number;
|
|
2695
|
-
renderingOnly?: boolean;
|
|
2696
|
-
}): TLShape | undefined;
|
|
2697
|
+
getShapeAtPoint(point: VecLike, opts?: TLGetShapeAtPointOptions): TLShape | undefined;
|
|
2697
2698
|
/**
|
|
2698
2699
|
* Get the shapes, if any, at a given page point.
|
|
2699
2700
|
*
|
|
@@ -3793,6 +3794,21 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3793
3794
|
* @public
|
|
3794
3795
|
*/
|
|
3795
3796
|
complete(): this;
|
|
3797
|
+
/**
|
|
3798
|
+
* Dispatch a pointer move event in the current position of the pointer. This is useful when
|
|
3799
|
+
* external circumstances have changed (e.g. the camera moved or a shape was moved) and you want
|
|
3800
|
+
* the current interaction to respond to that change.
|
|
3801
|
+
*
|
|
3802
|
+
* @example
|
|
3803
|
+
* ```ts
|
|
3804
|
+
* editor.updatePointer()
|
|
3805
|
+
* ```
|
|
3806
|
+
*
|
|
3807
|
+
* @param options - The options for updating the pointer.
|
|
3808
|
+
* @returns The editor instance.
|
|
3809
|
+
* @public
|
|
3810
|
+
*/
|
|
3811
|
+
updatePointer(options?: TLUpdatePointerOptions): this;
|
|
3796
3812
|
/**
|
|
3797
3813
|
* Puts the editor into focused mode.
|
|
3798
3814
|
*
|
|
@@ -4016,6 +4032,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
4016
4032
|
/* Excluded from this release type: maybeTrackPerformance */
|
|
4017
4033
|
}
|
|
4018
4034
|
|
|
4035
|
+
/**
|
|
4036
|
+
* An Atom that is scoped to the lifetime of an Editor.
|
|
4037
|
+
*
|
|
4038
|
+
* This is useful for storing UI state for tldraw applications. Keeping state scoped to an editor
|
|
4039
|
+
* instead of stored in a global atom can prevent issues with state being shared between editors
|
|
4040
|
+
* when navigating between pages, or when multiple editor instances are used on the same page.
|
|
4041
|
+
*
|
|
4042
|
+
* @public
|
|
4043
|
+
*/
|
|
4044
|
+
export declare class EditorAtom<T> {
|
|
4045
|
+
private name;
|
|
4046
|
+
private getInitialState;
|
|
4047
|
+
private states;
|
|
4048
|
+
constructor(name: string, getInitialState: (editor: Editor) => T);
|
|
4049
|
+
getAtom(editor: Editor): Atom<T>;
|
|
4050
|
+
get(editor: Editor): T;
|
|
4051
|
+
update(editor: Editor, update: (state: T) => T): T;
|
|
4052
|
+
set(editor: Editor, state: T): T;
|
|
4053
|
+
}
|
|
4054
|
+
|
|
4019
4055
|
/** @public */
|
|
4020
4056
|
export declare const EditorContext: React_3.Context<Editor | null>;
|
|
4021
4057
|
|
|
@@ -5418,6 +5454,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5418
5454
|
* @public
|
|
5419
5455
|
*/
|
|
5420
5456
|
onResizeEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
|
|
5457
|
+
/**
|
|
5458
|
+
* A callback called when a shape resize is cancelled.
|
|
5459
|
+
*
|
|
5460
|
+
* @param initial - The shape at the start of the resize.
|
|
5461
|
+
* @param current - The current shape.
|
|
5462
|
+
* @public
|
|
5463
|
+
*/
|
|
5464
|
+
onResizeCancel?(initial: Shape, current: Shape): void;
|
|
5421
5465
|
/**
|
|
5422
5466
|
* A callback called when a shape starts being translated.
|
|
5423
5467
|
*
|
|
@@ -5444,6 +5488,23 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5444
5488
|
* @public
|
|
5445
5489
|
*/
|
|
5446
5490
|
onTranslateEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
|
|
5491
|
+
/**
|
|
5492
|
+
* A callback called when a shape translation is cancelled.
|
|
5493
|
+
*
|
|
5494
|
+
* @param initial - The shape at the start of the translation.
|
|
5495
|
+
* @param current - The current shape.
|
|
5496
|
+
* @public
|
|
5497
|
+
*/
|
|
5498
|
+
onTranslateCancel?(initial: Shape, current: Shape): void;
|
|
5499
|
+
/**
|
|
5500
|
+
* A callback called when a shape's handle starts being dragged.
|
|
5501
|
+
*
|
|
5502
|
+
* @param shape - The shape.
|
|
5503
|
+
* @param info - An object containing the handle and whether the handle is 'precise' or not.
|
|
5504
|
+
* @returns A change to apply to the shape, or void.
|
|
5505
|
+
* @public
|
|
5506
|
+
*/
|
|
5507
|
+
onHandleDragStart?(shape: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
|
|
5447
5508
|
/**
|
|
5448
5509
|
* A callback called when a shape's handle changes.
|
|
5449
5510
|
*
|
|
@@ -5453,6 +5514,23 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5453
5514
|
* @public
|
|
5454
5515
|
*/
|
|
5455
5516
|
onHandleDrag?(shape: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
|
|
5517
|
+
/**
|
|
5518
|
+
* A callback called when a shape's handle finishes being dragged.
|
|
5519
|
+
*
|
|
5520
|
+
* @param current - The current shape.
|
|
5521
|
+
* @param info - An object containing the handle and whether the handle is 'precise' or not.
|
|
5522
|
+
* @returns A change to apply to the shape, or void.
|
|
5523
|
+
* @public
|
|
5524
|
+
*/
|
|
5525
|
+
onHandleDragEnd?(current: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
|
|
5526
|
+
/**
|
|
5527
|
+
* A callback called when a shape's handle drag is cancelled.
|
|
5528
|
+
*
|
|
5529
|
+
* @param current - The current shape.
|
|
5530
|
+
* @param info - An object containing the handle and whether the handle is 'precise' or not.
|
|
5531
|
+
* @public
|
|
5532
|
+
*/
|
|
5533
|
+
onHandleDragCancel?(current: Shape, info: TLHandleDragInfo<Shape>): void;
|
|
5456
5534
|
/**
|
|
5457
5535
|
* A callback called when a shape starts being rotated.
|
|
5458
5536
|
*
|
|
@@ -5479,6 +5557,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5479
5557
|
* @public
|
|
5480
5558
|
*/
|
|
5481
5559
|
onRotateEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
|
|
5560
|
+
/**
|
|
5561
|
+
* A callback called when a shape rotation is cancelled.
|
|
5562
|
+
*
|
|
5563
|
+
* @param initial - The shape at the start of the rotation.
|
|
5564
|
+
* @param current - The current shape.
|
|
5565
|
+
* @public
|
|
5566
|
+
*/
|
|
5567
|
+
onRotateCancel?(initial: Shape, current: Shape): void;
|
|
5482
5568
|
/* Excluded from this release type: onBindingChange */
|
|
5483
5569
|
/**
|
|
5484
5570
|
* A callback called when a shape's children change.
|
|
@@ -6338,6 +6424,8 @@ export declare interface TldrawOptions {
|
|
|
6338
6424
|
readonly multiClickDurationMs: number;
|
|
6339
6425
|
readonly coarseDragDistanceSquared: number;
|
|
6340
6426
|
readonly dragDistanceSquared: number;
|
|
6427
|
+
readonly uiDragDistanceSquared: number;
|
|
6428
|
+
readonly uiCoarseDragDistanceSquared: number;
|
|
6341
6429
|
readonly defaultSvgPadding: number;
|
|
6342
6430
|
readonly cameraSlideFriction: number;
|
|
6343
6431
|
readonly gridSteps: readonly {
|
|
@@ -6364,6 +6452,7 @@ export declare interface TldrawOptions {
|
|
|
6364
6452
|
readonly flattenImageBoundsPadding: number;
|
|
6365
6453
|
readonly laserDelayMs: number;
|
|
6366
6454
|
readonly maxExportDelayMs: number;
|
|
6455
|
+
readonly tooltipDelayMs: number;
|
|
6367
6456
|
/**
|
|
6368
6457
|
* How long should previews created by {@link Editor.createTemporaryAssetPreview} last before
|
|
6369
6458
|
* they expire? Defaults to 3 minutes.
|
|
@@ -6429,6 +6518,7 @@ export declare interface TLEditorComponents {
|
|
|
6429
6518
|
SelectionForeground?: ComponentType<TLSelectionForegroundProps> | null;
|
|
6430
6519
|
ShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
|
|
6431
6520
|
ShapeIndicators?: ComponentType | null;
|
|
6521
|
+
ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
|
|
6432
6522
|
SnapIndicator?: ComponentType<TLSnapIndicatorProps> | null;
|
|
6433
6523
|
Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
|
|
6434
6524
|
SvgDefs?: ComponentType | null;
|
|
@@ -6764,6 +6854,59 @@ export declare interface TLGeometryOpts {
|
|
|
6764
6854
|
context?: string;
|
|
6765
6855
|
}
|
|
6766
6856
|
|
|
6857
|
+
/**
|
|
6858
|
+
* Options to {@link Editor.getShapeAtPoint}.
|
|
6859
|
+
*
|
|
6860
|
+
* @public
|
|
6861
|
+
*/
|
|
6862
|
+
export declare interface TLGetShapeAtPointOptions {
|
|
6863
|
+
/**
|
|
6864
|
+
* The margin to apply to the shape.
|
|
6865
|
+
* If a number, it will be applied to both the inside and outside of the shape.
|
|
6866
|
+
* If an array, the first element will be applied to the inside of the shape, and the second element will be applied to the outside.
|
|
6867
|
+
*
|
|
6868
|
+
* @example
|
|
6869
|
+
* ```ts
|
|
6870
|
+
* // Get the shape at the center of the screen
|
|
6871
|
+
* const shape = editor.getShapeAtProps({
|
|
6872
|
+
* margin: 10,
|
|
6873
|
+
* })
|
|
6874
|
+
*
|
|
6875
|
+
* // Get the shape at the center of the screen with a 10px inner margin and a 5px outer margin
|
|
6876
|
+
* const shape = editor.getShapeAtProps({
|
|
6877
|
+
* margin: [10, 5],
|
|
6878
|
+
* })
|
|
6879
|
+
* ```
|
|
6880
|
+
*/
|
|
6881
|
+
margin?: [number, number] | number;
|
|
6882
|
+
/**
|
|
6883
|
+
* Whether to register hits inside of shapes (beyond the margin), such as the inside of a solid shape.
|
|
6884
|
+
*/
|
|
6885
|
+
hitInside?: boolean;
|
|
6886
|
+
/**
|
|
6887
|
+
* Whether to register hits on locked shapes.
|
|
6888
|
+
*/
|
|
6889
|
+
hitLocked?: boolean;
|
|
6890
|
+
/**
|
|
6891
|
+
* Whether to register hits on labels.
|
|
6892
|
+
*/
|
|
6893
|
+
hitLabels?: boolean;
|
|
6894
|
+
/**
|
|
6895
|
+
* Whether to only return hits on shapes that are currently being rendered.
|
|
6896
|
+
* todo: rename this to hitCulled or hitNotRendering
|
|
6897
|
+
*/
|
|
6898
|
+
renderingOnly?: boolean;
|
|
6899
|
+
/**
|
|
6900
|
+
* Whether to register hits on the inside of frame shapes.
|
|
6901
|
+
* todo: rename this to hitInsideFrames
|
|
6902
|
+
*/
|
|
6903
|
+
hitFrameInside?: boolean;
|
|
6904
|
+
/**
|
|
6905
|
+
* A filter function to apply to the shapes.
|
|
6906
|
+
*/
|
|
6907
|
+
filter?(shape: TLShape): boolean;
|
|
6908
|
+
}
|
|
6909
|
+
|
|
6767
6910
|
/** @public */
|
|
6768
6911
|
export declare interface TLGridProps {
|
|
6769
6912
|
x: number;
|
|
@@ -6776,6 +6919,7 @@ export declare interface TLGridProps {
|
|
|
6776
6919
|
export declare interface TLHandleDragInfo<T extends TLShape> {
|
|
6777
6920
|
handle: TLHandle;
|
|
6778
6921
|
isPrecise: boolean;
|
|
6922
|
+
isCreatingShape: boolean;
|
|
6779
6923
|
initial?: T | undefined;
|
|
6780
6924
|
}
|
|
6781
6925
|
|
|
@@ -7302,6 +7446,16 @@ export declare interface TLShapeUtilConstructor<T extends TLUnknownShape, U exte
|
|
|
7302
7446
|
migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
7303
7447
|
}
|
|
7304
7448
|
|
|
7449
|
+
/** @public */
|
|
7450
|
+
export declare interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7451
|
+
/** The shape being rendered. */
|
|
7452
|
+
shape: TLShape;
|
|
7453
|
+
/** Whether this is the shapes regular, or background component. */
|
|
7454
|
+
isBackground: boolean;
|
|
7455
|
+
/** The shape's rendered component. */
|
|
7456
|
+
children: ReactNode;
|
|
7457
|
+
}
|
|
7458
|
+
|
|
7305
7459
|
/** @public */
|
|
7306
7460
|
export declare interface TLSnapIndicatorProps {
|
|
7307
7461
|
className?: string;
|
|
@@ -7484,6 +7638,25 @@ export declare interface TLTldrawExternalContentSource {
|
|
|
7484
7638
|
data: TLContent;
|
|
7485
7639
|
}
|
|
7486
7640
|
|
|
7641
|
+
/** @public */
|
|
7642
|
+
export declare interface TLUpdatePointerOptions {
|
|
7643
|
+
/** Whether to update the pointer immediately, rather than on the next tick. */
|
|
7644
|
+
immediate?: boolean;
|
|
7645
|
+
/**
|
|
7646
|
+
* The point, in screen-space, to update the pointer to. Defaults to the position of the last
|
|
7647
|
+
* pointer event.
|
|
7648
|
+
*/
|
|
7649
|
+
point?: VecLike;
|
|
7650
|
+
pointerId?: number;
|
|
7651
|
+
ctrlKey?: boolean;
|
|
7652
|
+
altKey?: boolean;
|
|
7653
|
+
shiftKey?: boolean;
|
|
7654
|
+
metaKey?: boolean;
|
|
7655
|
+
accelKey?: boolean;
|
|
7656
|
+
isPen?: boolean;
|
|
7657
|
+
button?: number;
|
|
7658
|
+
}
|
|
7659
|
+
|
|
7487
7660
|
/** @public */
|
|
7488
7661
|
export declare interface TLUrlExternalAsset {
|
|
7489
7662
|
type: 'url';
|
|
@@ -7520,6 +7693,7 @@ export declare interface TLUserPreferences {
|
|
|
7520
7693
|
isWrapMode?: boolean | null;
|
|
7521
7694
|
isDynamicSizeMode?: boolean | null;
|
|
7522
7695
|
isPasteAtCursorMode?: boolean | null;
|
|
7696
|
+
showUiLabels?: boolean | null;
|
|
7523
7697
|
}
|
|
7524
7698
|
|
|
7525
7699
|
/** @public */
|
|
@@ -7692,6 +7866,7 @@ export declare class UserPreferencesManager {
|
|
|
7692
7866
|
isWrapMode: boolean;
|
|
7693
7867
|
locale: string;
|
|
7694
7868
|
name: string;
|
|
7869
|
+
showUiLabels: boolean;
|
|
7695
7870
|
};
|
|
7696
7871
|
getIsDarkMode(): boolean;
|
|
7697
7872
|
/**
|
|
@@ -7708,6 +7883,7 @@ export declare class UserPreferencesManager {
|
|
|
7708
7883
|
getIsWrapMode(): boolean;
|
|
7709
7884
|
getIsDynamicResizeMode(): boolean;
|
|
7710
7885
|
getIsPasteAtCursorMode(): boolean;
|
|
7886
|
+
getShowUiLabels(): boolean;
|
|
7711
7887
|
}
|
|
7712
7888
|
|
|
7713
7889
|
/** @public */
|
package/dist-esm/index.mjs
CHANGED
|
@@ -46,6 +46,9 @@ import {
|
|
|
46
46
|
import {
|
|
47
47
|
DefaultShapeIndicators
|
|
48
48
|
} from "./lib/components/default-components/DefaultShapeIndicators.mjs";
|
|
49
|
+
import {
|
|
50
|
+
DefaultShapeWrapper
|
|
51
|
+
} from "./lib/components/default-components/DefaultShapeWrapper.mjs";
|
|
49
52
|
import {
|
|
50
53
|
DefaultSnapIndicator
|
|
51
54
|
} from "./lib/components/default-components/DefaultSnapIndictor.mjs";
|
|
@@ -270,6 +273,7 @@ import {
|
|
|
270
273
|
setPointerCapture,
|
|
271
274
|
stopEventPropagation
|
|
272
275
|
} from "./lib/utils/dom.mjs";
|
|
276
|
+
import { EditorAtom } from "./lib/utils/EditorAtom.mjs";
|
|
273
277
|
import { getIncrementedName } from "./lib/utils/getIncrementedName.mjs";
|
|
274
278
|
import { getPointerInfo } from "./lib/utils/getPointerInfo.mjs";
|
|
275
279
|
import { getSvgPathFromPoints } from "./lib/utils/getSvgPathFromPoints.mjs";
|
|
@@ -299,7 +303,7 @@ function debugEnableLicensing() {
|
|
|
299
303
|
}
|
|
300
304
|
registerTldrawLibraryVersion(
|
|
301
305
|
"@tldraw/editor",
|
|
302
|
-
"3.
|
|
306
|
+
"3.16.0-canary.01f62b6d4455",
|
|
303
307
|
"esm"
|
|
304
308
|
);
|
|
305
309
|
export {
|
|
@@ -330,6 +334,7 @@ export {
|
|
|
330
334
|
DefaultSelectionForeground,
|
|
331
335
|
DefaultShapeIndicator,
|
|
332
336
|
DefaultShapeIndicators,
|
|
337
|
+
DefaultShapeWrapper,
|
|
333
338
|
DefaultSnapIndicator,
|
|
334
339
|
DefaultSpinner,
|
|
335
340
|
DefaultSvgDefs,
|
|
@@ -338,6 +343,7 @@ export {
|
|
|
338
343
|
Edge2d,
|
|
339
344
|
EdgeScrollManager,
|
|
340
345
|
Editor,
|
|
346
|
+
EditorAtom,
|
|
341
347
|
EditorContext,
|
|
342
348
|
EditorProvider,
|
|
343
349
|
Ellipse2d,
|