@tldraw/editor 3.10.0-canary.15f6aaa3d2d3 → 3.10.0-canary.283889799096
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/README.md +2 -2
- package/dist-cjs/index.d.ts +12 -3
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +7 -8
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/exports/ExportDelay.js +1 -1
- package/dist-cjs/lib/exports/ExportDelay.js.map +2 -2
- package/dist-cjs/lib/exports/StyleEmbedder.js +1 -1
- package/dist-cjs/lib/exports/StyleEmbedder.js.map +2 -2
- package/dist-cjs/lib/hooks/usePeerIds.js.map +1 -1
- package/dist-cjs/lib/hooks/usePresence.js.map +1 -1
- package/dist-cjs/lib/license/Watermark.js +1 -1
- package/dist-cjs/lib/license/Watermark.js.map +1 -1
- package/dist-cjs/lib/utils/browserCanvasMaxSize.js +5 -0
- package/dist-cjs/lib/utils/browserCanvasMaxSize.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 -3
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +2 -3
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/exports/ExportDelay.mjs +1 -1
- package/dist-esm/lib/exports/ExportDelay.mjs.map +2 -2
- package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -1
- package/dist-esm/lib/exports/StyleEmbedder.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePeerIds.mjs.map +1 -1
- package/dist-esm/lib/hooks/usePresence.mjs.map +1 -1
- package/dist-esm/lib/license/Watermark.mjs +1 -1
- package/dist-esm/lib/license/Watermark.mjs.map +1 -1
- package/dist-esm/lib/utils/browserCanvasMaxSize.mjs +5 -0
- package/dist-esm/lib/utils/browserCanvasMaxSize.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +4 -0
- package/package.json +7 -7
- package/src/lib/editor/Editor.ts +2 -3
- package/src/lib/exports/ExportDelay.tsx +1 -1
- package/src/lib/exports/StyleEmbedder.ts +1 -1
- package/src/lib/hooks/usePeerIds.ts +1 -1
- package/src/lib/hooks/usePresence.ts +2 -2
- package/src/lib/license/Watermark.tsx +1 -1
- package/src/lib/utils/browserCanvasMaxSize.ts +5 -3
- package/src/version.ts +3 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ You might be more interested in the general package [tldraw](https://github.com/
|
|
|
8
8
|
|
|
9
9
|
This project is part of the tldraw SDK. It is provided under the [tldraw SDK license](https://github.com/tldraw/tldraw/blob/main/LICENSE.md).
|
|
10
10
|
|
|
11
|
-
You can use the tldraw SDK in commercial or non-commercial projects so long as you preserve the "Made with tldraw" watermark on the canvas. To remove the watermark, you can purchase a [business license](https://tldraw.dev
|
|
11
|
+
You can use the tldraw SDK in commercial or non-commercial projects so long as you preserve the "Made with tldraw" watermark on the canvas. To remove the watermark, you can purchase a [business license](https://tldraw.dev#pricing). Visit [tldraw.dev](https://tldraw.dev) to learn more.
|
|
12
12
|
|
|
13
13
|
## Trademarks
|
|
14
14
|
|
|
@@ -24,7 +24,7 @@ Please see our [contributing guide](https://github.com/tldraw/tldraw/blob/main/C
|
|
|
24
24
|
|
|
25
25
|
## Community
|
|
26
26
|
|
|
27
|
-
Have questions, comments or feedback? [Join our discord](https://discord.tldraw.com/?utm_source=github&utm_medium=
|
|
27
|
+
Have questions, comments or feedback? [Join our discord](https://discord.tldraw.com/?utm_source=github&utm_medium=readme&utm_campaign=sociallink). For the latest news and release notes, visit [tldraw.dev](https://tldraw.dev).
|
|
28
28
|
|
|
29
29
|
## Contact
|
|
30
30
|
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -2298,7 +2298,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2298
2298
|
*/
|
|
2299
2299
|
updatePage(partial: RequiredKeys<Partial<TLPage>, 'id'>): this;
|
|
2300
2300
|
/**
|
|
2301
|
-
* Create a page.
|
|
2301
|
+
* Create a page whilst ensuring that the page name is unique.
|
|
2302
2302
|
*
|
|
2303
2303
|
* @example
|
|
2304
2304
|
* ```ts
|
|
@@ -7348,9 +7348,18 @@ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement
|
|
|
7348
7348
|
/** @public */
|
|
7349
7349
|
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
|
|
7350
7350
|
|
|
7351
|
-
|
|
7351
|
+
/**
|
|
7352
|
+
* @returns The list of peer UserIDs
|
|
7353
|
+
* @public
|
|
7354
|
+
*/
|
|
7355
|
+
export declare function usePeerIds(): string[];
|
|
7356
|
+
|
|
7357
|
+
/**
|
|
7358
|
+
* @returns The latest presence of the user matching userId
|
|
7359
|
+
* @public
|
|
7360
|
+
*/
|
|
7361
|
+
export declare function usePresence(userId: string): null | TLInstancePresence;
|
|
7352
7362
|
|
|
7353
|
-
/* Excluded from this release type: usePresence */
|
|
7354
7363
|
export { useQuickReactor }
|
|
7355
7364
|
|
|
7356
7365
|
/* Excluded from this release type: USER_COLORS */
|
package/dist-cjs/index.js
CHANGED
|
@@ -80,7 +80,6 @@ var import_state = require("@tldraw/state");
|
|
|
80
80
|
var import_store = require("@tldraw/store");
|
|
81
81
|
var import_tlschema = require("@tldraw/tlschema");
|
|
82
82
|
var import_utils = require("@tldraw/utils");
|
|
83
|
-
var import_core_js = require("core-js");
|
|
84
83
|
var import_eventemitter3 = __toESM(require("eventemitter3"));
|
|
85
84
|
var import_TLEditorSnapshot = require("../config/TLEditorSnapshot");
|
|
86
85
|
var import_createTLUser = require("../config/createTLUser");
|
|
@@ -2147,9 +2146,9 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
2147
2146
|
this.stopFollowingUser();
|
|
2148
2147
|
}
|
|
2149
2148
|
const _point = import_Vec.Vec.Cast(point);
|
|
2150
|
-
if (!
|
|
2151
|
-
if (!
|
|
2152
|
-
if (_point.z === void 0 || !
|
|
2149
|
+
if (!Number.isFinite(_point.x)) _point.x = 0;
|
|
2150
|
+
if (!Number.isFinite(_point.y)) _point.y = 0;
|
|
2151
|
+
if (_point.z === void 0 || !Number.isFinite(_point.z)) point.z = this.getZoomLevel();
|
|
2153
2152
|
const camera = this.getConstrainedCamera(_point, opts);
|
|
2154
2153
|
if (opts?.animation) {
|
|
2155
2154
|
const { width, height } = this.getViewportScreenBounds();
|
|
@@ -3022,7 +3021,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
3022
3021
|
return this.run(() => this.store.update(partial.id, (page) => ({ ...page, ...partial })));
|
|
3023
3022
|
}
|
|
3024
3023
|
/**
|
|
3025
|
-
* Create a page.
|
|
3024
|
+
* Create a page whilst ensuring that the page name is unique.
|
|
3026
3025
|
*
|
|
3027
3026
|
* @example
|
|
3028
3027
|
* ```ts
|
|
@@ -4010,7 +4009,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
4010
4009
|
indices = sib ? (0, import_utils.getIndicesAbove)(sib.index, ids.length) : (0, import_utils.getIndices)(ids.length);
|
|
4011
4010
|
}
|
|
4012
4011
|
const invertedParentTransform = parentTransform.clone().invert();
|
|
4013
|
-
const shapesToReparent = (0, import_utils.compact)(ids.map((id) => this.getShape(id)));
|
|
4012
|
+
const shapesToReparent = (0, import_utils.compact)(ids.map((id) => this.getShape(id))).sort(import_utils.sortByIndex);
|
|
4014
4013
|
this.run(
|
|
4015
4014
|
() => {
|
|
4016
4015
|
for (let i = 0; i < shapesToReparent.length; i++) {
|
|
@@ -5305,8 +5304,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5305
5304
|
resizeShape(shape, scale, opts = {}) {
|
|
5306
5305
|
const id = typeof shape === "string" ? shape : shape.id;
|
|
5307
5306
|
if (this.getIsReadonly()) return this;
|
|
5308
|
-
if (!
|
|
5309
|
-
if (!
|
|
5307
|
+
if (!Number.isFinite(scale.x)) scale = new import_Vec.Vec(1, scale.y);
|
|
5308
|
+
if (!Number.isFinite(scale.y)) scale = new import_Vec.Vec(scale.x, 1);
|
|
5310
5309
|
const initialShape = opts.initialShape ?? this.getShape(id);
|
|
5311
5310
|
if (!initialShape) return this;
|
|
5312
5311
|
const scaleOrigin = opts.scaleOrigin ?? this.getShapePageBounds(id)?.center;
|