@tldraw/editor 3.16.0-canary.f55016ece635 → 3.16.0-canary.f56a36d13420
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 +31 -0
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +11 -10
- package/dist-cjs/lib/editor/Editor.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/exports/getSvgJsx.js +34 -14
- package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +7 -5
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/primitives/Box.js +3 -0
- package/dist-cjs/lib/primitives/Box.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 +31 -0
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +11 -10
- package/dist-esm/lib/editor/Editor.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/exports/getSvgJsx.mjs +34 -14
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +7 -5
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/primitives/Box.mjs +4 -1
- package/dist-esm/lib/primitives/Box.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/lib/editor/Editor.ts +19 -21
- package/src/lib/editor/shapes/ShapeUtil.ts +35 -0
- package/src/lib/exports/getSvgJsx.test.ts +868 -0
- package/src/lib/exports/getSvgJsx.tsx +76 -19
- package/src/lib/hooks/useCanvasEvents.ts +6 -6
- package/src/lib/primitives/Box.test.ts +126 -0
- package/src/lib/primitives/Box.ts +10 -1
- package/src/version.ts +3 -3
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.f56a36d13420";
|
|
26
26
|
const publishDates = {
|
|
27
27
|
major: "2024-09-13T14:36:29.063Z",
|
|
28
|
-
minor: "2025-08-
|
|
29
|
-
patch: "2025-08-
|
|
28
|
+
minor: "2025-08-28T08:18:44.206Z",
|
|
29
|
+
patch: "2025-08-28T08:18:44.206Z"
|
|
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.f56a36d13420'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-08-28T08:18:44.206Z',\n\tpatch: '2025-08-28T08:18:44.206Z',\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
|
@@ -510,6 +510,7 @@ export declare class Box {
|
|
|
510
510
|
static ExpandBy(A: Box, n: number): Box;
|
|
511
511
|
static Collides(A: Box, B: Box): boolean;
|
|
512
512
|
static Contains(A: Box, B: Box): boolean;
|
|
513
|
+
static ContainsApproximately(A: Box, B: Box, precision?: number): boolean;
|
|
513
514
|
static Includes(A: Box, B: Box): boolean;
|
|
514
515
|
static ContainsPoint(A: Box, B: VecLike, margin?: number): boolean;
|
|
515
516
|
static Common(boxes: Box[]): Box;
|
|
@@ -5249,6 +5250,25 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5249
5250
|
*/
|
|
5250
5251
|
canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
|
|
5251
5252
|
/* Excluded from this release type: providesBackgroundForChildren */
|
|
5253
|
+
/**
|
|
5254
|
+
* Get the clip path to apply to this shape's children.
|
|
5255
|
+
*
|
|
5256
|
+
* @param shape - The shape to get the clip path for
|
|
5257
|
+
* @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
|
|
5258
|
+
* @public
|
|
5259
|
+
*/
|
|
5260
|
+
getClipPath?(shape: Shape): undefined | Vec[];
|
|
5261
|
+
/**
|
|
5262
|
+
* Whether a specific child shape should be clipped by this shape.
|
|
5263
|
+
* Only called if getClipPath returns a valid polygon.
|
|
5264
|
+
*
|
|
5265
|
+
* If not defined, the default behavior is to clip all children.
|
|
5266
|
+
*
|
|
5267
|
+
* @param child - The child shape to check
|
|
5268
|
+
* @returns boolean indicating if this child should be clipped
|
|
5269
|
+
* @public
|
|
5270
|
+
*/
|
|
5271
|
+
shouldClipChild?(child: TLShape): boolean;
|
|
5252
5272
|
/**
|
|
5253
5273
|
* Whether the shape should hide its resize handles when selected.
|
|
5254
5274
|
*
|
|
@@ -5279,6 +5299,17 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5279
5299
|
* @public
|
|
5280
5300
|
*/
|
|
5281
5301
|
isAspectRatioLocked(_shape: Shape): boolean;
|
|
5302
|
+
/**
|
|
5303
|
+
* By default, the bounds of an image export are the bounds of all the shapes it contains, plus
|
|
5304
|
+
* some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
|
|
5305
|
+
* padding is skipped _if the bounds of that shape contains all the other shapes_. This is
|
|
5306
|
+
* useful in cases like annotating on top of an image, where you usually want to avoid extra
|
|
5307
|
+
* padding around the image if you don't need it.
|
|
5308
|
+
*
|
|
5309
|
+
* @param _shape - The shape to check
|
|
5310
|
+
* @returns True if this shape should be treated as an export bounds container
|
|
5311
|
+
*/
|
|
5312
|
+
isExportBoundsContainer(_shape: Shape): boolean;
|
|
5282
5313
|
/* Excluded from this release type: backgroundComponent */
|
|
5283
5314
|
/**
|
|
5284
5315
|
* Get the interpolated props for an animating shape. This is an optional method.
|
package/dist-esm/index.mjs
CHANGED
|
@@ -3700,16 +3700,17 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
3700
3700
|
_getShapeMaskCache() {
|
|
3701
3701
|
return this.store.createComputedCache("pageMaskCache", (shape) => {
|
|
3702
3702
|
if (isPageId(shape.parentId)) return void 0;
|
|
3703
|
-
const
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
const pageTransform = this.getShapePageTransform(
|
|
3710
|
-
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3703
|
+
const clipPaths = [];
|
|
3704
|
+
for (const ancestor of this.getShapeAncestors(shape.id)) {
|
|
3705
|
+
const util = this.getShapeUtil(ancestor);
|
|
3706
|
+
const clipPath = util.getClipPath?.(ancestor);
|
|
3707
|
+
if (!clipPath) continue;
|
|
3708
|
+
if (util.shouldClipChild?.(shape) === false) continue;
|
|
3709
|
+
const pageTransform = this.getShapePageTransform(ancestor.id);
|
|
3710
|
+
clipPaths.push(pageTransform.applyToPoints(clipPath));
|
|
3711
|
+
}
|
|
3712
|
+
if (clipPaths.length === 0) return void 0;
|
|
3713
|
+
const pageMask = clipPaths.reduce((acc, b) => {
|
|
3713
3714
|
const intersection = intersectPolygonPolygon(acc, b);
|
|
3714
3715
|
if (intersection) {
|
|
3715
3716
|
return intersection.map(Vec.Cast);
|