@tldraw/editor 3.9.0-canary.d799df28e99e → 3.9.0-canary.ef20f7307209

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/index.d.ts +23 -6
  4. package/dist-cjs/index.js +1 -1
  5. package/dist-cjs/index.js.map +2 -2
  6. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
  7. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  8. package/dist-cjs/lib/editor/Editor.js +413 -237
  9. package/dist-cjs/lib/editor/Editor.js.map +3 -3
  10. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +7 -2
  11. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  12. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  13. package/dist-cjs/version.js +3 -3
  14. package/dist-cjs/version.js.map +1 -1
  15. package/dist-esm/index.d.mts +23 -6
  16. package/dist-esm/index.mjs +1 -1
  17. package/dist-esm/index.mjs.map +2 -2
  18. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
  19. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  20. package/dist-esm/lib/editor/Editor.mjs +409 -233
  21. package/dist-esm/lib/editor/Editor.mjs.map +3 -3
  22. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +7 -2
  23. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  24. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  25. package/dist-esm/version.mjs +3 -3
  26. package/dist-esm/version.mjs.map +1 -1
  27. package/package.json +7 -7
  28. package/src/index.ts +1 -0
  29. package/src/lib/components/default-components/DefaultErrorFallback.tsx +5 -3
  30. package/src/lib/editor/Editor.ts +540 -262
  31. package/src/lib/editor/shapes/ShapeUtil.ts +21 -5
  32. package/src/lib/exports/getSvgJsx.tsx +1 -0
  33. package/src/version.ts +3 -3
@@ -36,7 +36,7 @@ export interface TLShapeUtilConstructor<
36
36
  *
37
37
  * @public
38
38
  */
39
- export interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLShape> {
39
+ export interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLUnknownShape> {
40
40
  /** The type of shape referenced by the `fromId` of the binding. */
41
41
  fromShapeType: string
42
42
  /** The type of shape referenced by the `toId` of the binding. */
@@ -46,7 +46,18 @@ export interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLShape>
46
46
  }
47
47
 
48
48
  /**
49
- * Additional options for the {@link ShapeUtil.getGeometry} method.
49
+ * Options passed to {@link ShapeUtil.canBeLaidOut}.
50
+ *
51
+ * @public
52
+ */
53
+ export interface TLShapeUtilCanBeLaidOutOpts {
54
+ /** The type of action causing the layout. */
55
+ type?: 'align' | 'distribute' | 'pack' | 'stack' | 'flip' | 'stretch'
56
+ /** The other shapes being laid out */
57
+ shapes?: TLShape[]
58
+ }
59
+
60
+ /** Additional options for the {@link ShapeUtil.getGeometry} method.
50
61
  *
51
62
  * @public
52
63
  */
@@ -162,6 +173,7 @@ export abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
162
173
  /**
163
174
  * Whether the shape can be snapped to by another shape.
164
175
  *
176
+ * @param shape - The shape.
165
177
  * @public
166
178
  */
167
179
  canSnap(_shape: Shape): boolean {
@@ -182,7 +194,7 @@ export abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
182
194
  *
183
195
  * @public
184
196
  */
185
- canBind(_opts: TLShapeUtilCanBindOpts<Shape>): boolean {
197
+ canBind(_opts: TLShapeUtilCanBindOpts): boolean {
186
198
  return true
187
199
  }
188
200
 
@@ -223,11 +235,15 @@ export abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
223
235
  }
224
236
 
225
237
  /**
226
- * Whether the shape participates in stacking, aligning, and distributing.
238
+ * Whether the shape can participate in layout functions such as alignment or distribution.
239
+ *
240
+ * @param shape - The shape.
241
+ * @param info - Additional context information: the type of action causing the layout and the
242
+ * @public
227
243
  *
228
244
  * @public
229
245
  */
230
- canBeLaidOut(_shape: Shape): boolean {
246
+ canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean {
231
247
  return true
232
248
  }
233
249
 
@@ -205,6 +205,7 @@ function SvgExport({
205
205
  ;(async () => {
206
206
  const shapeDefs: Record<string, { pending: false; element: ReactElement }> = {}
207
207
 
208
+ // Then render everything. The shapes with assets should all hit the cache
208
209
  const unorderedShapeElementPromises = renderingShapes.map(
209
210
  async ({ id, opacity, index, backgroundIndex }) => {
210
211
  // Don't render the frame if we're only exporting a single frame and it's children
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.9.0-canary.d799df28e99e'
4
+ export const version = '3.9.0-canary.ef20f7307209'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-02-25T14:25:18.875Z',
8
- patch: '2025-02-25T14:25:18.875Z',
7
+ minor: '2025-02-27T14:57:10.316Z',
8
+ patch: '2025-02-27T14:57:10.316Z',
9
9
  }