@tldraw/editor 3.16.0-canary.e4220f725a90 → 3.16.0-canary.e455ab838b8f
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 +27 -28
- package/dist-cjs/index.js +2 -4
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +0 -2
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +4 -4
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +29 -0
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +4 -2
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +17 -17
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useDocumentEvents.js +4 -4
- package/dist-cjs/lib/hooks/useDocumentEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -1
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useHandleEvents.js +6 -6
- package/dist-cjs/lib/hooks/useHandleEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useSelectionEvents.js +8 -8
- package/dist-cjs/lib/hooks/useSelectionEvents.js.map +2 -2
- package/dist-cjs/lib/license/Watermark.js +97 -90
- package/dist-cjs/lib/license/Watermark.js.map +2 -2
- package/dist-cjs/lib/utils/dom.js +1 -12
- package/dist-cjs/lib/utils/dom.js.map +2 -2
- package/dist-cjs/lib/utils/getPointerInfo.js +2 -3
- package/dist-cjs/lib/utils/getPointerInfo.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +27 -28
- package/dist-esm/index.mjs +3 -7
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +0 -2
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +5 -5
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +29 -0
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +4 -2
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +18 -24
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useDocumentEvents.mjs +5 -10
- package/dist-esm/lib/hooks/useDocumentEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +2 -2
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useHandleEvents.mjs +7 -12
- package/dist-esm/lib/hooks/useHandleEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useSelectionEvents.mjs +9 -15
- package/dist-esm/lib/hooks/useSelectionEvents.mjs.map +2 -2
- package/dist-esm/lib/license/Watermark.mjs +98 -91
- package/dist-esm/lib/license/Watermark.mjs.map +2 -2
- package/dist-esm/lib/utils/dom.mjs +1 -12
- package/dist-esm/lib/utils/dom.mjs.map +2 -2
- package/dist-esm/lib/utils/getPointerInfo.mjs +2 -3
- package/dist-esm/lib/utils/getPointerInfo.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +0 -2
- package/src/lib/TldrawEditor.tsx +0 -2
- package/src/lib/components/default-components/DefaultCanvas.tsx +5 -5
- package/src/lib/editor/Editor.ts +33 -0
- package/src/lib/editor/managers/FocusManager/FocusManager.ts +6 -2
- package/src/lib/hooks/useCanvasEvents.ts +18 -24
- package/src/lib/hooks/useDocumentEvents.ts +5 -10
- package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +2 -2
- package/src/lib/hooks/useHandleEvents.ts +7 -12
- package/src/lib/hooks/useSelectionEvents.ts +9 -15
- package/src/lib/license/Watermark.tsx +100 -92
- package/src/lib/utils/dom.test.ts +33 -24
- package/src/lib/utils/dom.ts +1 -31
- package/src/lib/utils/getPointerInfo.ts +3 -3
- package/src/version.ts +3 -3
|
@@ -58,10 +58,11 @@ const UnlicensedWatermark = (0, import_react.memo)(function UnlicensedWatermark2
|
|
|
58
58
|
isDebugMode,
|
|
59
59
|
isMobile
|
|
60
60
|
}) {
|
|
61
|
+
const editor = (0, import_useEditor.useEditor)();
|
|
61
62
|
const events = (0, import_useCanvasEvents.useCanvasEvents)();
|
|
62
63
|
const ref = (0, import_react.useRef)(null);
|
|
63
64
|
(0, import_usePassThroughWheelEvents.usePassThroughWheelEvents)(ref);
|
|
64
|
-
const url = "https://tldraw.dev
|
|
65
|
+
const url = "https://tldraw.dev/pricing?utm_source=dotcom&utm_medium=organic&utm_campaign=watermark";
|
|
65
66
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
67
|
"div",
|
|
67
68
|
{
|
|
@@ -79,25 +80,12 @@ const UnlicensedWatermark = (0, import_react.memo)(function UnlicensedWatermark2
|
|
|
79
80
|
draggable: false,
|
|
80
81
|
role: "button",
|
|
81
82
|
onPointerDown: (e) => {
|
|
82
|
-
|
|
83
|
+
editor.markEventAsHandled(e);
|
|
83
84
|
(0, import_dom.preventDefault)(e);
|
|
84
85
|
},
|
|
85
|
-
title: "
|
|
86
|
+
title: "The tldraw SDK requires a license key to work in production. You can get a free 100-day trial license at tldraw.dev/pricing.",
|
|
86
87
|
onClick: () => import_runtime.runtime.openWindow(url, "_blank"),
|
|
87
|
-
|
|
88
|
-
position: "absolute",
|
|
89
|
-
pointerEvents: "all",
|
|
90
|
-
cursor: "pointer",
|
|
91
|
-
color: "var(--tl-color-text)",
|
|
92
|
-
opacity: 0.8,
|
|
93
|
-
border: 0,
|
|
94
|
-
padding: 0,
|
|
95
|
-
backgroundColor: "transparent",
|
|
96
|
-
fontSize: "11px",
|
|
97
|
-
fontWeight: "600",
|
|
98
|
-
textAlign: "center"
|
|
99
|
-
},
|
|
100
|
-
children: "Unlicensed"
|
|
88
|
+
children: "Get a license for production"
|
|
101
89
|
}
|
|
102
90
|
)
|
|
103
91
|
}
|
|
@@ -136,10 +124,10 @@ const WatermarkInner = (0, import_react.memo)(function WatermarkInner2({
|
|
|
136
124
|
draggable: false,
|
|
137
125
|
role: "button",
|
|
138
126
|
onPointerDown: (e) => {
|
|
139
|
-
|
|
127
|
+
editor.markEventAsHandled(e);
|
|
140
128
|
(0, import_dom.preventDefault)(e);
|
|
141
129
|
},
|
|
142
|
-
title: "
|
|
130
|
+
title: "Build infinite canvas applications with the tldraw SDK. Learn more at https://tldraw.dev.",
|
|
143
131
|
onClick: () => import_runtime.runtime.openWindow(url, "_blank"),
|
|
144
132
|
style: { mask: maskCss, WebkitMask: maskCss }
|
|
145
133
|
}
|
|
@@ -150,7 +138,8 @@ const WatermarkInner = (0, import_react.memo)(function WatermarkInner2({
|
|
|
150
138
|
const LicenseStyles = (0, import_react.memo)(function LicenseStyles2() {
|
|
151
139
|
const editor = (0, import_useEditor.useEditor)();
|
|
152
140
|
const className = import_LicenseManager.LicenseManager.className;
|
|
153
|
-
const CSS =
|
|
141
|
+
const CSS = `
|
|
142
|
+
/* ------------------- SEE LICENSE -------------------
|
|
154
143
|
The tldraw watermark is part of tldraw's license. It is shown for unlicensed
|
|
155
144
|
or "licensed-with-watermark" users. By using this library, you agree to
|
|
156
145
|
preserve the watermark's behavior, keeping it visible, unobscured, and
|
|
@@ -159,87 +148,105 @@ available to user-interaction.
|
|
|
159
148
|
To remove the watermark, please purchase a license at tldraw.dev.
|
|
160
149
|
*/
|
|
161
150
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
151
|
+
.${className} {
|
|
152
|
+
position: absolute;
|
|
153
|
+
bottom: max(var(--tl-space-2), env(safe-area-inset-bottom));
|
|
154
|
+
right: max(var(--tl-space-2), env(safe-area-inset-right));
|
|
155
|
+
width: 96px;
|
|
156
|
+
height: 32px;
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
z-index: var(--tl-layer-watermark) !important;
|
|
161
|
+
background-color: color-mix(in srgb, var(--tl-color-background) 62%, transparent);
|
|
162
|
+
opacity: 1;
|
|
163
|
+
border-radius: 5px;
|
|
164
|
+
pointer-events: all;
|
|
165
|
+
padding: 2px;
|
|
166
|
+
box-sizing: content-box;
|
|
167
|
+
}
|
|
179
168
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
169
|
+
.${className} > button {
|
|
170
|
+
position: absolute;
|
|
171
|
+
width: 96px;
|
|
172
|
+
height: 32px;
|
|
173
|
+
pointer-events: all;
|
|
174
|
+
cursor: inherit;
|
|
175
|
+
color: var(--tl-color-text);
|
|
176
|
+
opacity: .38;
|
|
177
|
+
border: 0;
|
|
178
|
+
padding: 0;
|
|
179
|
+
background-color: currentColor;
|
|
180
|
+
}
|
|
192
181
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
182
|
+
.${className}[data-debug='true'] {
|
|
183
|
+
bottom: max(46px, env(safe-area-inset-bottom));
|
|
184
|
+
}
|
|
196
185
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
186
|
+
.${className}[data-mobile='true'] {
|
|
187
|
+
border-radius: 4px 0px 0px 4px;
|
|
188
|
+
right: max(-2px, calc(env(safe-area-inset-right) - 2px));
|
|
189
|
+
width: 8px;
|
|
190
|
+
height: 48px;
|
|
191
|
+
}
|
|
203
192
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
193
|
+
.${className}[data-mobile='true'] > button {
|
|
194
|
+
width: 8px;
|
|
195
|
+
height: 32px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.${className}[data-unlicensed='true'] > button {
|
|
199
|
+
font-size: 100px;
|
|
200
|
+
position: absolute;
|
|
201
|
+
pointer-events: all;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
color: var(--tl-color-text);
|
|
204
|
+
opacity: 0.8;
|
|
205
|
+
border: 0;
|
|
206
|
+
padding: 0;
|
|
207
|
+
background-color: transparent;
|
|
208
|
+
font-size: 11px;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
text-align: center;
|
|
211
|
+
}
|
|
208
212
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
+
.${className}[data-mobile='true'][data-unlicensed='true'] > button {
|
|
214
|
+
display: none;
|
|
215
|
+
}
|
|
213
216
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
217
|
+
@media (hover: hover) {
|
|
218
|
+
.${className}[data-licensed='false'] > button {
|
|
219
|
+
pointer-events: none;
|
|
220
|
+
}
|
|
219
221
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
.${className}[data-licensed='false']:hover {
|
|
223
|
+
background-color: var(--tl-color-background);
|
|
224
|
+
transition: background-color 0.2s ease-in-out;
|
|
225
|
+
transition-delay: 0.32s;
|
|
226
|
+
}
|
|
224
227
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
.${className}[data-licensed='false']:hover > button {
|
|
229
|
+
animation: ${className}_delayed_link 0.2s forwards ease-in-out;
|
|
230
|
+
animation-delay: 0.32s;
|
|
228
231
|
}
|
|
229
232
|
|
|
233
|
+
.${className}[data-licensed='false'] > button:focus-visible {
|
|
234
|
+
opacity: 1;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
230
237
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
@keyframes ${className}_delayed_link {
|
|
239
|
+
0% {
|
|
240
|
+
cursor: inherit;
|
|
241
|
+
opacity: .38;
|
|
242
|
+
pointer-events: none;
|
|
243
|
+
}
|
|
244
|
+
100% {
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
opacity: 1;
|
|
247
|
+
pointer-events: all;
|
|
248
|
+
}
|
|
249
|
+
}`;
|
|
243
250
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { nonce: editor.options.nonce, children: CSS });
|
|
244
251
|
});
|
|
245
252
|
//# sourceMappingURL=Watermark.js.map
|
|
@@ -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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BE;AA5BF,yBAAyB;AACzB,mBAA6B;AAC7B,6BAAgC;AAChC,uBAA0B;AAC1B,uCAA0C;AAC1C,
|
|
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 } 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\n\t\t\t\tsrc={isMobile ? WATERMARK_MOBILE_LOCAL_SRC : WATERMARK_DESKTOP_LOCAL_SRC}\n\t\t\t\tisUnlicensed={licenseManagerState === 'unlicensed'}\n\t\t\t/>\n\t\t</>\n\t)\n})\n\nconst UnlicensedWatermark = memo(function UnlicensedWatermark({\n\tisDebugMode,\n\tisMobile,\n}: {\n\tisDebugMode: boolean\n\tisMobile: boolean\n}) {\n\tconst editor = useEditor()\n\tconst events = useCanvasEvents()\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst url =\n\t\t'https://tldraw.dev/pricing?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\tdata-unlicensed={true}\n\t\t\tdata-testid=\"tl-watermark-unlicensed\"\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\teditor.markEventAsHandled(e)\n\t\t\t\t\tpreventDefault(e)\n\t\t\t\t}}\n\t\t\t\ttitle=\"The tldraw SDK requires a license key to work in production. You can get a free 100-day trial license at tldraw.dev/pricing.\"\n\t\t\t\tonClick={() => runtime.openWindow(url, '_blank')}\n\t\t\t>\n\t\t\t\tGet a license for production\n\t\t\t</button>\n\t\t</div>\n\t)\n})\n\nconst WatermarkInner = memo(function WatermarkInner({\n\tsrc,\n\tisUnlicensed,\n}: {\n\tsrc: string\n\tisUnlicensed: boolean\n}) {\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\tif (isUnlicensed) {\n\t\treturn <UnlicensedWatermark isDebugMode={isDebugMode} isMobile={isMobile} />\n\t}\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\tdata-testid=\"tl-watermark-licensed\"\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\teditor.markEventAsHandled(e)\n\t\t\t\t\tpreventDefault(e)\n\t\t\t\t}}\n\t\t\t\ttitle=\"Build infinite canvas applications with the tldraw SDK. Learn more at https://tldraw.dev.\"\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 = `\n/* ------------------- 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.${className} {\n\tposition: absolute;\n\tbottom: max(var(--tl-space-2), env(safe-area-inset-bottom));\n\tright: max(var(--tl-space-2), env(safe-area-inset-right));\n\twidth: 96px;\n\theight: 32px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tz-index: var(--tl-layer-watermark) !important;\n\tbackground-color: color-mix(in srgb, var(--tl-color-background) 62%, transparent);\n\topacity: 1;\n\tborder-radius: 5px;\n\tpointer-events: all;\n\tpadding: 2px;\n\tbox-sizing: content-box;\n}\n\n.${className} > button {\n\tposition: absolute;\n\twidth: 96px;\n\theight: 32px;\n\tpointer-events: all;\n\tcursor: inherit;\n\tcolor: var(--tl-color-text);\n\topacity: .38;\n\tborder: 0;\n\tpadding: 0;\n\tbackground-color: currentColor;\n}\n\n.${className}[data-debug='true'] {\n\tbottom: max(46px, env(safe-area-inset-bottom));\n}\n\n.${className}[data-mobile='true'] {\n\tborder-radius: 4px 0px 0px 4px;\n\tright: max(-2px, calc(env(safe-area-inset-right) - 2px));\n\twidth: 8px;\n\theight: 48px;\n}\n\n.${className}[data-mobile='true'] > button {\n\twidth: 8px;\n\theight: 32px;\n}\n\n.${className}[data-unlicensed='true'] > button {\n\tfont-size: 100px;\n\tposition: absolute;\n\tpointer-events: all;\n\tcursor: pointer;\n\tcolor: var(--tl-color-text);\n\topacity: 0.8;\n\tborder: 0;\n\tpadding: 0;\n\tbackground-color: transparent;\n\tfont-size: 11px;\n\tfont-weight: 600;\n\ttext-align: center;\n}\n\n.${className}[data-mobile='true'][data-unlicensed='true'] > button {\n\tdisplay: none;\n}\n\n@media (hover: hover) {\n\t.${className}[data-licensed='false'] > button {\n\t\tpointer-events: none;\n\t}\n\n\t.${className}[data-licensed='false']:hover {\n\t\tbackground-color: var(--tl-color-background);\n\t\ttransition: background-color 0.2s ease-in-out;\n\t\ttransition-delay: 0.32s;\n\t}\n\n\t.${className}[data-licensed='false']:hover > button {\n\t\tanimation: ${className}_delayed_link 0.2s forwards ease-in-out;\n\t\tanimation-delay: 0.32s;\n\t}\n\n\t.${className}[data-licensed='false'] > button:focus-visible {\n\t\topacity: 1;\n\t}\n}\n\n@keyframes ${className}_delayed_link {\n\t0% {\n\t\tcursor: inherit;\n\t\topacity: .38;\n\t\tpointer-events: none;\n\t}\n\t100% {\n\t\tcursor: pointer;\n\t\topacity: 1;\n\t\tpointer-events: all;\n\t}\n}`\n\n\treturn <style nonce={editor.options.nonce}>{CSS}</style>\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BE;AA5BF,yBAAyB;AACzB,mBAA6B;AAC7B,6BAAgC;AAChC,uBAA0B;AAC1B,uCAA0C;AAC1C,iBAA+B;AAC/B,qBAAwB;AACxB,wBAAwD;AACxD,4BAA+B;AAC/B,6BAAkC;AAClC,oCAAuC;AAEvC,MAAM,8BAA8B,2BAA2B,mBAAmB,qCAAmB,CAAC;AACtG,MAAM,6BAA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;AAAA;AAAA;AAAA;AAAA;AAAA,GAaT,SAAS;AAAA;AAAA;AAAA;AAAA,GAIT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAOT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,GAKT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAeT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,IAKR,SAAS;AAAA;AAAA;AAAA;AAAA,IAIT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMT,SAAS;AAAA,eACE,SAAS;AAAA;AAAA;AAAA;AAAA,IAIpB,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,aAKA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAarB,SAAO,4CAAC,WAAM,OAAO,OAAO,QAAQ,OAAQ,eAAI;AACjD,CAAC;",
|
|
6
6
|
"names": ["Watermark", "UnlicensedWatermark", "WatermarkInner", "LicenseStyles"]
|
|
7
7
|
}
|
|
@@ -20,13 +20,11 @@ var dom_exports = {};
|
|
|
20
20
|
__export(dom_exports, {
|
|
21
21
|
activeElementShouldCaptureKeys: () => activeElementShouldCaptureKeys,
|
|
22
22
|
loopToHtmlElement: () => loopToHtmlElement,
|
|
23
|
-
markEventAsHandled: () => markEventAsHandled,
|
|
24
23
|
preventDefault: () => preventDefault,
|
|
25
24
|
releasePointerCapture: () => releasePointerCapture,
|
|
26
25
|
setPointerCapture: () => setPointerCapture,
|
|
27
26
|
setStyleProperty: () => setStyleProperty,
|
|
28
|
-
stopEventPropagation: () => stopEventPropagation
|
|
29
|
-
wasEventAlreadyHandled: () => wasEventAlreadyHandled
|
|
27
|
+
stopEventPropagation: () => stopEventPropagation
|
|
30
28
|
});
|
|
31
29
|
module.exports = __toCommonJS(dom_exports);
|
|
32
30
|
var import_debug_flags = require("./debug-flags");
|
|
@@ -67,15 +65,6 @@ function releasePointerCapture(element, event) {
|
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
const stopEventPropagation = (e) => e.stopPropagation();
|
|
70
|
-
const handledEvents = /* @__PURE__ */ new WeakSet();
|
|
71
|
-
function markEventAsHandled(e) {
|
|
72
|
-
const nativeEvent = "nativeEvent" in e ? e.nativeEvent : e;
|
|
73
|
-
handledEvents.add(nativeEvent);
|
|
74
|
-
}
|
|
75
|
-
function wasEventAlreadyHandled(e) {
|
|
76
|
-
const nativeEvent = "nativeEvent" in e ? e.nativeEvent : e;
|
|
77
|
-
return handledEvents.has(nativeEvent);
|
|
78
|
-
}
|
|
79
68
|
const setStyleProperty = (elm, property, value) => {
|
|
80
69
|
if (!elm) return;
|
|
81
70
|
elm.style.setProperty(property, value);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/utils/dom.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nThis is used to facilitate double clicking and pointer capture on elements.\n\nThe events in this file are possibly set on individual SVG elements, \nsuch as handles or corner handles, rather than on HTML elements or \nSVGSVGElements. Raw SVG elemnets do not support pointerCapture in \nmost cases, meaning that in order for pointer capture to work, we \nneed to crawl up the DOM tree to find the nearest HTML element. Then,\nin order for that element to also call the `onPointerUp` event from\nthis file, we need to manually set that event on that element and\nlater remove it when the pointerup occurs. This is a potential leak\nif the user clicks on a handle but the pointerup does not fire for\nwhatever reason.\n*/\n\nimport React from 'react'\nimport { debugFlags, pointerCaptureTrackingObject } from './debug-flags'\n\n/** @public */\nexport function loopToHtmlElement(elm: Element): HTMLElement {\n\tif (elm.nodeType === Node.ELEMENT_NODE) return elm as HTMLElement\n\tif (elm.parentElement) return loopToHtmlElement(elm.parentElement)\n\telse throw Error('Could not find a parent element of an HTML type!')\n}\n\n/**\n * This function calls `event.preventDefault()` for you. Why is that useful?\n *\n * Beacuase if you enable `window.preventDefaultLogging = true` it'll log out a message when it\n * happens. Because we use console.warn rather than (log) you'll get a stack trace in the inspector\n * telling you exactly where it happened. This is important because `e.preventDefault()` is the\n * source of many bugs, but unfortuantly it can't be avoided because it also stops a lot of default\n * behaviour which doesn't make sense in our UI\n *\n * @param event - To prevent default on\n * @public\n */\nexport function preventDefault(event: React.BaseSyntheticEvent | Event) {\n\tevent.preventDefault()\n\tif (debugFlags.logPreventDefaults.get()) {\n\t\tconsole.warn('preventDefault called on event:', event)\n\t}\n}\n\n/** @public */\nexport function setPointerCapture(\n\telement: Element,\n\tevent: React.PointerEvent<Element> | PointerEvent\n) {\n\telement.setPointerCapture(event.pointerId)\n\tif (debugFlags.logPointerCaptures.get()) {\n\t\tconst trackingObj = pointerCaptureTrackingObject.get()\n\t\ttrackingObj.set(element, (trackingObj.get(element) ?? 0) + 1)\n\t\tconsole.warn('setPointerCapture called on element:', element, event)\n\t}\n}\n\n/** @public */\nexport function releasePointerCapture(\n\telement: Element,\n\tevent: React.PointerEvent<Element> | PointerEvent\n) {\n\tif (!element.hasPointerCapture(event.pointerId)) {\n\t\treturn\n\t}\n\n\telement.releasePointerCapture(event.pointerId)\n\tif (debugFlags.logPointerCaptures.get()) {\n\t\tconst trackingObj = pointerCaptureTrackingObject.get()\n\t\tif (trackingObj.get(element) === 1) {\n\t\t\ttrackingObj.delete(element)\n\t\t} else if (trackingObj.has(element)) {\n\t\t\ttrackingObj.set(element, trackingObj.get(element)! - 1)\n\t\t} else {\n\t\t\tconsole.warn('Release without capture')\n\t\t}\n\t\tconsole.warn('releasePointerCapture called on element:', element, event)\n\t}\n}\n\n/**\n * Calls `event.stopPropagation()`.\n *\n * @deprecated Use {@link markEventAsHandled} instead, or manually call `event.stopPropagation()` if\n * that's what you really want.\n *\n * @public\n */\nexport const stopEventPropagation = (e: any) => e.stopPropagation()\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/*\nThis is used to facilitate double clicking and pointer capture on elements.\n\nThe events in this file are possibly set on individual SVG elements, \nsuch as handles or corner handles, rather than on HTML elements or \nSVGSVGElements. Raw SVG elemnets do not support pointerCapture in \nmost cases, meaning that in order for pointer capture to work, we \nneed to crawl up the DOM tree to find the nearest HTML element. Then,\nin order for that element to also call the `onPointerUp` event from\nthis file, we need to manually set that event on that element and\nlater remove it when the pointerup occurs. This is a potential leak\nif the user clicks on a handle but the pointerup does not fire for\nwhatever reason.\n*/\n\nimport React from 'react'\nimport { debugFlags, pointerCaptureTrackingObject } from './debug-flags'\n\n/** @public */\nexport function loopToHtmlElement(elm: Element): HTMLElement {\n\tif (elm.nodeType === Node.ELEMENT_NODE) return elm as HTMLElement\n\tif (elm.parentElement) return loopToHtmlElement(elm.parentElement)\n\telse throw Error('Could not find a parent element of an HTML type!')\n}\n\n/**\n * This function calls `event.preventDefault()` for you. Why is that useful?\n *\n * Beacuase if you enable `window.preventDefaultLogging = true` it'll log out a message when it\n * happens. Because we use console.warn rather than (log) you'll get a stack trace in the inspector\n * telling you exactly where it happened. This is important because `e.preventDefault()` is the\n * source of many bugs, but unfortuantly it can't be avoided because it also stops a lot of default\n * behaviour which doesn't make sense in our UI\n *\n * @param event - To prevent default on\n * @public\n */\nexport function preventDefault(event: React.BaseSyntheticEvent | Event) {\n\tevent.preventDefault()\n\tif (debugFlags.logPreventDefaults.get()) {\n\t\tconsole.warn('preventDefault called on event:', event)\n\t}\n}\n\n/** @public */\nexport function setPointerCapture(\n\telement: Element,\n\tevent: React.PointerEvent<Element> | PointerEvent\n) {\n\telement.setPointerCapture(event.pointerId)\n\tif (debugFlags.logPointerCaptures.get()) {\n\t\tconst trackingObj = pointerCaptureTrackingObject.get()\n\t\ttrackingObj.set(element, (trackingObj.get(element) ?? 0) + 1)\n\t\tconsole.warn('setPointerCapture called on element:', element, event)\n\t}\n}\n\n/** @public */\nexport function releasePointerCapture(\n\telement: Element,\n\tevent: React.PointerEvent<Element> | PointerEvent\n) {\n\tif (!element.hasPointerCapture(event.pointerId)) {\n\t\treturn\n\t}\n\n\telement.releasePointerCapture(event.pointerId)\n\tif (debugFlags.logPointerCaptures.get()) {\n\t\tconst trackingObj = pointerCaptureTrackingObject.get()\n\t\tif (trackingObj.get(element) === 1) {\n\t\t\ttrackingObj.delete(element)\n\t\t} else if (trackingObj.has(element)) {\n\t\t\ttrackingObj.set(element, trackingObj.get(element)! - 1)\n\t\t} else {\n\t\t\tconsole.warn('Release without capture')\n\t\t}\n\t\tconsole.warn('releasePointerCapture called on element:', element, event)\n\t}\n}\n\n/**\n * Calls `event.stopPropagation()`.\n *\n * @deprecated Use {@link Editor.markEventAsHandled} instead, or manually call `event.stopPropagation()` if\n * that's what you really want.\n *\n * @public\n */\nexport const stopEventPropagation = (e: any) => e.stopPropagation()\n\n/** @internal */\nexport const setStyleProperty = (\n\telm: HTMLElement | null,\n\tproperty: string,\n\tvalue: string | number\n) => {\n\tif (!elm) return\n\telm.style.setProperty(property, value as string)\n}\n\n/** @internal */\nexport function activeElementShouldCaptureKeys(allowButtons = false) {\n\tconst { activeElement } = document\n\tconst elements = allowButtons ? ['input', 'textarea'] : ['input', 'select', 'button', 'textarea']\n\treturn !!(\n\t\tactiveElement &&\n\t\t((activeElement as HTMLElement).isContentEditable ||\n\t\t\telements.indexOf(activeElement.tagName.toLowerCase()) > -1 ||\n\t\t\tactiveElement.classList.contains('tlui-slider__thumb'))\n\t)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,yBAAyD;AAGlD,SAAS,kBAAkB,KAA2B;AAC5D,MAAI,IAAI,aAAa,KAAK,aAAc,QAAO;AAC/C,MAAI,IAAI,cAAe,QAAO,kBAAkB,IAAI,aAAa;AAAA,MAC5D,OAAM,MAAM,kDAAkD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,QAAQ,YAAY,CAAC,IAAI,MACxD,cAAc,UAAU,SAAS,oBAAoB;AAExD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -21,10 +21,9 @@ __export(getPointerInfo_exports, {
|
|
|
21
21
|
getPointerInfo: () => getPointerInfo
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(getPointerInfo_exports);
|
|
24
|
-
var import_dom = require("./dom");
|
|
25
24
|
var import_keyboard = require("./keyboard");
|
|
26
|
-
function getPointerInfo(e) {
|
|
27
|
-
|
|
25
|
+
function getPointerInfo(editor, e) {
|
|
26
|
+
editor.markEventAsHandled(e);
|
|
28
27
|
return {
|
|
29
28
|
point: {
|
|
30
29
|
x: e.clientX,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/utils/getPointerInfo.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { Editor } from '../editor/Editor'\nimport { isAccelKey } from './keyboard'\n\n/** @public */\nexport function getPointerInfo(editor: Editor, e: React.PointerEvent | PointerEvent) {\n\teditor.markEventAsHandled(e)\n\n\treturn {\n\t\tpoint: {\n\t\t\tx: e.clientX,\n\t\t\ty: e.clientY,\n\t\t\tz: e.pressure,\n\t\t},\n\t\tshiftKey: e.shiftKey,\n\t\taltKey: e.altKey,\n\t\tctrlKey: e.metaKey || e.ctrlKey,\n\t\tmetaKey: e.metaKey,\n\t\taccelKey: isAccelKey(e),\n\t\tpointerId: e.pointerId,\n\t\tbutton: e.button,\n\t\tisPen: e.pointerType === 'pen',\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAA2B;AAGpB,SAAS,eAAe,QAAgB,GAAsC;AACpF,SAAO,mBAAmB,CAAC;AAE3B,SAAO;AAAA,IACN,OAAO;AAAA,MACN,GAAG,EAAE;AAAA,MACL,GAAG,EAAE;AAAA,MACL,GAAG,EAAE;AAAA,IACN;AAAA,IACA,UAAU,EAAE;AAAA,IACZ,QAAQ,EAAE;AAAA,IACV,SAAS,EAAE,WAAW,EAAE;AAAA,IACxB,SAAS,EAAE;AAAA,IACX,cAAU,4BAAW,CAAC;AAAA,IACtB,WAAW,EAAE;AAAA,IACb,QAAQ,EAAE;AAAA,IACV,OAAO,EAAE,gBAAgB;AAAA,EAC1B;AACD;",
|
|
6
6
|
"names": []
|
|
7
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.16.0-canary.
|
|
25
|
+
const version = "3.16.0-canary.e455ab838b8f";
|
|
26
26
|
const publishDates = {
|
|
27
27
|
major: "2024-09-13T14:36:29.063Z",
|
|
28
|
-
minor: "2025-09-
|
|
29
|
-
patch: "2025-09-
|
|
28
|
+
minor: "2025-09-17T16:11:14.790Z",
|
|
29
|
+
patch: "2025-09-17T16:11:14.790Z"
|
|
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.16.0-canary.
|
|
4
|
+
"sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.16.0-canary.e455ab838b8f'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-09-17T16:11:14.790Z',\n\tpatch: '2025-09-17T16:11:14.790Z',\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
|
@@ -3959,6 +3959,31 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3959
3959
|
/* Excluded from this release type: capturedPointerId */
|
|
3960
3960
|
/* Excluded from this release type: performanceTracker */
|
|
3961
3961
|
/* Excluded from this release type: performanceTrackerTimeout */
|
|
3962
|
+
/* Excluded from this release type: handledEvents */
|
|
3963
|
+
/**
|
|
3964
|
+
* In tldraw, events are sometimes handled by multiple components. For example, the shapes might
|
|
3965
|
+
* have events, but the canvas handles events too. The way that the canvas handles events can
|
|
3966
|
+
* interfere with the with the shapes event handlers - for example, it calls `.preventDefault()`
|
|
3967
|
+
* on `pointerDown`, which also prevents `click` events from firing on the shapes.
|
|
3968
|
+
*
|
|
3969
|
+
* You can use `.stopPropagation()` to prevent the event from propagating to the rest of the
|
|
3970
|
+
* DOM, but that can impact non-tldraw event handlers set up elsewhere. By using
|
|
3971
|
+
* `markEventAsHandled`, you'll stop other parts of tldraw from handling the event without
|
|
3972
|
+
* impacting other, non-tldraw event handlers. See also {@link Editor.wasEventAlreadyHandled}.
|
|
3973
|
+
*
|
|
3974
|
+
* @public
|
|
3975
|
+
*/
|
|
3976
|
+
markEventAsHandled(e: {
|
|
3977
|
+
nativeEvent: Event;
|
|
3978
|
+
} | Event): void;
|
|
3979
|
+
/**
|
|
3980
|
+
* Checks if an event has already been handled. See {@link Editor.markEventAsHandled}.
|
|
3981
|
+
*
|
|
3982
|
+
* @public
|
|
3983
|
+
*/
|
|
3984
|
+
wasEventAlreadyHandled(e: {
|
|
3985
|
+
nativeEvent: Event;
|
|
3986
|
+
} | Event): boolean;
|
|
3962
3987
|
/**
|
|
3963
3988
|
* Dispatch an event to the editor.
|
|
3964
3989
|
*
|
|
@@ -4234,7 +4259,7 @@ export declare function getPerfectDashProps(totalLength: number, strokeWidth: nu
|
|
|
4234
4259
|
};
|
|
4235
4260
|
|
|
4236
4261
|
/** @public */
|
|
4237
|
-
export declare function getPointerInfo(e: PointerEvent | React.PointerEvent): {
|
|
4262
|
+
export declare function getPointerInfo(editor: Editor, e: PointerEvent | React.PointerEvent): {
|
|
4238
4263
|
accelKey: boolean;
|
|
4239
4264
|
altKey: boolean;
|
|
4240
4265
|
button: number;
|
|
@@ -4616,23 +4641,6 @@ export declare function loadSnapshot(store: TLStore, _snapshot: Partial<TLEditor
|
|
|
4616
4641
|
/** @public */
|
|
4617
4642
|
export declare function loopToHtmlElement(elm: Element): HTMLElement;
|
|
4618
4643
|
|
|
4619
|
-
/**
|
|
4620
|
-
* In tldraw, events are sometimes handled by multiple components. For example, the shapes might
|
|
4621
|
-
* have events, but the canvas handles events too. The way that the canvas handles events can
|
|
4622
|
-
* interfere with the with the shapes event handlers - for example, it calls `.preventDefault()` on
|
|
4623
|
-
* `pointerDown`, which also prevents `click` events from firing on the shapes.
|
|
4624
|
-
*
|
|
4625
|
-
* You can use `.stopPropagation()` to prevent the event from propagating to the rest of the DOM,
|
|
4626
|
-
* but that can impact non-tldraw event handlers set up elsewhere. By using `markEventAsHandled`,
|
|
4627
|
-
* you'll stop other parts of tldraw from handling the event without impacting other, non-tldraw
|
|
4628
|
-
* event handlers. See also {@link wasEventAlreadyHandled}.
|
|
4629
|
-
*
|
|
4630
|
-
* @public
|
|
4631
|
-
*/
|
|
4632
|
-
export declare function markEventAsHandled(e: {
|
|
4633
|
-
nativeEvent: Event;
|
|
4634
|
-
} | Event): void;
|
|
4635
|
-
|
|
4636
4644
|
/** @public */
|
|
4637
4645
|
export declare class Mat {
|
|
4638
4646
|
constructor(a: number, b: number, c: number, d: number, e: number, f: number);
|
|
@@ -5833,7 +5841,7 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
|
|
|
5833
5841
|
/**
|
|
5834
5842
|
* Calls `event.stopPropagation()`.
|
|
5835
5843
|
*
|
|
5836
|
-
* @deprecated Use {@link markEventAsHandled} instead, or manually call `event.stopPropagation()` if
|
|
5844
|
+
* @deprecated Use {@link Editor.markEventAsHandled} instead, or manually call `event.stopPropagation()` if
|
|
5837
5845
|
* that's what you really want.
|
|
5838
5846
|
*
|
|
5839
5847
|
* @public
|
|
@@ -8109,15 +8117,6 @@ export declare class Vec {
|
|
|
8109
8117
|
/** @public */
|
|
8110
8118
|
export declare type VecLike = Vec | VecModel;
|
|
8111
8119
|
|
|
8112
|
-
/**
|
|
8113
|
-
* Checks if an event has already been handled. See {@link markEventAsHandled}.
|
|
8114
|
-
*
|
|
8115
|
-
* @public
|
|
8116
|
-
*/
|
|
8117
|
-
export declare function wasEventAlreadyHandled(e: {
|
|
8118
|
-
nativeEvent: Event;
|
|
8119
|
-
} | Event): boolean;
|
|
8120
|
-
|
|
8121
8120
|
|
|
8122
8121
|
export * from "@tldraw/state";
|
|
8123
8122
|
export * from "@tldraw/state-react";
|
package/dist-esm/index.mjs
CHANGED
|
@@ -269,12 +269,10 @@ import {
|
|
|
269
269
|
import {
|
|
270
270
|
activeElementShouldCaptureKeys,
|
|
271
271
|
loopToHtmlElement,
|
|
272
|
-
markEventAsHandled,
|
|
273
272
|
preventDefault,
|
|
274
273
|
releasePointerCapture,
|
|
275
274
|
setPointerCapture,
|
|
276
|
-
stopEventPropagation
|
|
277
|
-
wasEventAlreadyHandled
|
|
275
|
+
stopEventPropagation
|
|
278
276
|
} from "./lib/utils/dom.mjs";
|
|
279
277
|
import { EditorAtom } from "./lib/utils/EditorAtom.mjs";
|
|
280
278
|
import { getIncrementedName } from "./lib/utils/getIncrementedName.mjs";
|
|
@@ -303,7 +301,7 @@ import { uniq } from "./lib/utils/uniq.mjs";
|
|
|
303
301
|
import { openWindow } from "./lib/utils/window-open.mjs";
|
|
304
302
|
registerTldrawLibraryVersion(
|
|
305
303
|
"@tldraw/editor",
|
|
306
|
-
"3.16.0-canary.
|
|
304
|
+
"3.16.0-canary.e455ab838b8f",
|
|
307
305
|
"esm"
|
|
308
306
|
);
|
|
309
307
|
export {
|
|
@@ -454,7 +452,6 @@ export {
|
|
|
454
452
|
loadSessionStateSnapshotIntoStore,
|
|
455
453
|
loadSnapshot,
|
|
456
454
|
loopToHtmlElement,
|
|
457
|
-
markEventAsHandled,
|
|
458
455
|
maybeSnapToGrid,
|
|
459
456
|
normalizeWheel,
|
|
460
457
|
openWindow,
|
|
@@ -518,7 +515,6 @@ export {
|
|
|
518
515
|
useTransform,
|
|
519
516
|
useUniqueSafeId,
|
|
520
517
|
useViewportHeight,
|
|
521
|
-
userTypeValidator
|
|
522
|
-
wasEventAlreadyHandled
|
|
518
|
+
userTypeValidator
|
|
523
519
|
};
|
|
524
520
|
//# sourceMappingURL=index.mjs.map
|