@tldraw/editor 3.8.0-canary.7764274c3dd2 → 3.8.0-canary.79362534f1d1
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 +12 -8
- package/dist-cjs/index.js +2 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +13 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/hooks/useDocumentEvents.js +1 -3
- package/dist-cjs/lib/hooks/useDocumentEvents.js.map +2 -2
- package/dist-cjs/lib/options.js +0 -2
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/lib/utils/dom.js +6 -0
- package/dist-cjs/lib/utils/dom.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 +12 -8
- package/dist-esm/index.mjs +3 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +13 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/hooks/useDocumentEvents.mjs +2 -4
- package/dist-esm/lib/hooks/useDocumentEvents.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +0 -2
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/lib/utils/dom.mjs +6 -0
- package/dist-esm/lib/utils/dom.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 +1 -0
- package/src/lib/editor/shapes/ShapeUtil.ts +19 -0
- package/src/lib/hooks/useDocumentEvents.ts +2 -11
- package/src/lib/options.ts +0 -8
- package/src/lib/utils/dom.ts +12 -0
- package/src/version.ts +3 -3
package/src/lib/options.ts
CHANGED
|
@@ -29,7 +29,6 @@ export interface TldrawOptions {
|
|
|
29
29
|
readonly dragDistanceSquared: number
|
|
30
30
|
readonly defaultSvgPadding: number
|
|
31
31
|
readonly cameraSlideFriction: number
|
|
32
|
-
readonly maxPointsPerDrawShape: number
|
|
33
32
|
readonly gridSteps: readonly {
|
|
34
33
|
readonly min: number
|
|
35
34
|
readonly mid: number
|
|
@@ -66,11 +65,6 @@ export interface TldrawOptions {
|
|
|
66
65
|
* external context providers. By default, this is `React.Fragment`.
|
|
67
66
|
*/
|
|
68
67
|
readonly exportProvider: ComponentType<{ children: React.ReactNode }>
|
|
69
|
-
/**
|
|
70
|
-
* How should the note shape resize? By default it does not resize (except automatically based on its text content),
|
|
71
|
-
* but you can set it to be user-resizable using scale.
|
|
72
|
-
*/
|
|
73
|
-
readonly noteShapeResizeMode: 'none' | 'scale'
|
|
74
68
|
/**
|
|
75
69
|
* By default, the toolbar items are accessible via number shortcuts according to their order. To disable this, set this option to false.
|
|
76
70
|
*/
|
|
@@ -90,7 +84,6 @@ export const defaultTldrawOptions = {
|
|
|
90
84
|
dragDistanceSquared: 16, // 4 squared
|
|
91
85
|
defaultSvgPadding: 32,
|
|
92
86
|
cameraSlideFriction: 0.09,
|
|
93
|
-
maxPointsPerDrawShape: 500,
|
|
94
87
|
gridSteps: [
|
|
95
88
|
{ min: -1, mid: 0.15, step: 64 },
|
|
96
89
|
{ min: 0.05, mid: 0.375, step: 16 },
|
|
@@ -120,6 +113,5 @@ export const defaultTldrawOptions = {
|
|
|
120
113
|
actionShortcutsLocation: 'swap',
|
|
121
114
|
createTextOnCanvasDoubleClick: true,
|
|
122
115
|
exportProvider: Fragment,
|
|
123
|
-
noteShapeResizeMode: 'none',
|
|
124
116
|
enableToolbarKeyboardShortcuts: true,
|
|
125
117
|
} as const satisfies TldrawOptions
|
package/src/lib/utils/dom.ts
CHANGED
|
@@ -90,3 +90,15 @@ export const setStyleProperty = (
|
|
|
90
90
|
if (!elm) return
|
|
91
91
|
elm.style.setProperty(property, value as string)
|
|
92
92
|
}
|
|
93
|
+
|
|
94
|
+
const INPUTS = ['input', 'select', 'button', 'textarea']
|
|
95
|
+
|
|
96
|
+
/** @internal */
|
|
97
|
+
export function activeElementShouldCaptureKeys() {
|
|
98
|
+
const { activeElement } = document
|
|
99
|
+
return !!(
|
|
100
|
+
activeElement &&
|
|
101
|
+
(activeElement.getAttribute('contenteditable') ||
|
|
102
|
+
INPUTS.indexOf(activeElement.tagName.toLowerCase()) > -1)
|
|
103
|
+
)
|
|
104
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is automatically generated by internal/scripts/refresh-assets.ts.
|
|
2
2
|
// Do not edit manually. Or do, I'm a comment, not a cop.
|
|
3
3
|
|
|
4
|
-
export const version = '3.8.0-canary.
|
|
4
|
+
export const version = '3.8.0-canary.79362534f1d1'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2024-09-13T14:36:29.063Z',
|
|
7
|
-
minor: '2025-02-
|
|
8
|
-
patch: '2025-02-
|
|
7
|
+
minor: '2025-02-11T14:22:58.700Z',
|
|
8
|
+
patch: '2025-02-11T14:22:58.700Z',
|
|
9
9
|
}
|