tldraw 4.1.0-canary.2f8483de4802 → 4.1.0-canary.3134b1ea0e08

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 (35) hide show
  1. package/dist-cjs/index.d.ts +21 -0
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/lib/defaultEmbedDefinitions.js +24 -6
  4. package/dist-cjs/lib/defaultEmbedDefinitions.js.map +2 -2
  5. package/dist-cjs/lib/defaultExternalContentHandlers.js +1 -1
  6. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  7. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +3 -0
  8. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
  9. package/dist-cjs/lib/shapes/line/LineShapeUtil.js +3 -0
  10. package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
  11. package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js +5 -0
  12. package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js.map +2 -2
  13. package/dist-cjs/lib/ui/version.js +3 -3
  14. package/dist-cjs/lib/ui/version.js.map +1 -1
  15. package/dist-esm/index.d.mts +21 -0
  16. package/dist-esm/index.mjs +1 -1
  17. package/dist-esm/lib/defaultEmbedDefinitions.mjs +24 -6
  18. package/dist-esm/lib/defaultEmbedDefinitions.mjs.map +2 -2
  19. package/dist-esm/lib/defaultExternalContentHandlers.mjs +1 -1
  20. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  21. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +3 -0
  22. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
  23. package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +3 -0
  24. package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
  25. package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs +5 -0
  26. package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs.map +2 -2
  27. package/dist-esm/lib/ui/version.mjs +3 -3
  28. package/dist-esm/lib/ui/version.mjs.map +1 -1
  29. package/package.json +3 -3
  30. package/src/lib/defaultEmbedDefinitions.ts +19 -0
  31. package/src/lib/defaultExternalContentHandlers.ts +1 -1
  32. package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +3 -0
  33. package/src/lib/shapes/line/LineShapeUtil.tsx +3 -0
  34. package/src/lib/ui/components/Minimap/MinimapManager.ts +6 -0
  35. package/src/lib/ui/version.ts +3 -3
@@ -35,6 +35,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
35
35
  }
36
36
  return
37
37
  },
38
+ embedOnPaste: false,
38
39
  },
39
40
  {
40
41
  type: 'figma',
@@ -65,6 +66,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
65
66
  }
66
67
  return
67
68
  },
69
+ embedOnPaste: true,
68
70
  },
69
71
  {
70
72
  type: 'google_maps',
@@ -116,6 +118,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
116
118
  }
117
119
  return
118
120
  },
121
+ embedOnPaste: true,
119
122
  },
120
123
  {
121
124
  type: 'val_town',
@@ -144,6 +147,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
144
147
  }
145
148
  return
146
149
  },
150
+ embedOnPaste: true,
147
151
  },
148
152
  {
149
153
  type: 'codesandbox',
@@ -170,6 +174,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
170
174
  }
171
175
  return
172
176
  },
177
+ embedOnPaste: true,
173
178
  },
174
179
  {
175
180
  type: 'codepen',
@@ -198,6 +203,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
198
203
  }
199
204
  return
200
205
  },
206
+ embedOnPaste: true,
201
207
  },
202
208
  {
203
209
  type: 'scratch',
@@ -206,6 +212,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
206
212
  width: 520,
207
213
  height: 400,
208
214
  doesResize: false,
215
+ embedOnPaste: true,
209
216
  toEmbedUrl: (url) => {
210
217
  const SCRATCH_URL_REGEXP = /https?:\/\/scratch.mit.edu\/projects\/([^/]+)/
211
218
  const matches = url.match(SCRATCH_URL_REGEXP)
@@ -237,6 +244,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
237
244
  'allow-popups-to-escape-sandbox': true,
238
245
  },
239
246
  isAspectRatioLocked: true,
247
+ embedOnPaste: true,
240
248
  toEmbedUrl: (url) => {
241
249
  const urlObj = safeParseUrl(url)
242
250
  if (!urlObj) return
@@ -303,6 +311,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
303
311
  overridePermissions: {
304
312
  'allow-popups-to-escape-sandbox': true,
305
313
  },
314
+ embedOnPaste: true,
306
315
  toEmbedUrl: (url) => {
307
316
  const urlObj = safeParseUrl(url)
308
317
  const cidQs = urlObj?.searchParams.get('cid')
@@ -347,6 +356,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
347
356
  overridePermissions: {
348
357
  'allow-popups-to-escape-sandbox': true,
349
358
  },
359
+ embedOnPaste: true,
350
360
  toEmbedUrl: (url) => {
351
361
  const urlObj = safeParseUrl(url)
352
362
 
@@ -381,6 +391,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
381
391
  width: 720,
382
392
  height: 500,
383
393
  doesResize: true,
394
+ embedOnPaste: true,
384
395
  // Security warning:
385
396
  // Gists allow adding .json extensions to the URL which return JSONP.
386
397
  // Furthermore, the JSONP can include callbacks that execute arbitrary JavaScript.
@@ -413,6 +424,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
413
424
  width: 720,
414
425
  height: 500,
415
426
  doesResize: true,
427
+ embedOnPaste: true,
416
428
  toEmbedUrl: (url) => {
417
429
  const urlObj = safeParseUrl(url)
418
430
  if (urlObj && urlObj.pathname.match(/\/@([^/]+)\/([^/]+)/)) {
@@ -440,6 +452,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
440
452
  width: 720,
441
453
  height: 500,
442
454
  doesResize: true,
455
+ embedOnPaste: true,
443
456
  toEmbedUrl: (url) => {
444
457
  const urlObj = safeParseUrl(url)
445
458
  if (urlObj && urlObj.pathname.match(/^\/map\//)) {
@@ -465,6 +478,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
465
478
  minHeight: 500,
466
479
  overrideOutlineRadius: 12,
467
480
  doesResize: true,
481
+ embedOnPaste: true,
468
482
  toEmbedUrl: (url) => {
469
483
  const urlObj = safeParseUrl(url)
470
484
  if (urlObj && urlObj.pathname.match(/^\/(artist|album)\//)) {
@@ -488,6 +502,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
488
502
  height: 360,
489
503
  doesResize: true,
490
504
  isAspectRatioLocked: true,
505
+ embedOnPaste: true,
491
506
  toEmbedUrl: (url) => {
492
507
  const urlObj = safeParseUrl(url)
493
508
  if (urlObj && urlObj.hostname === 'vimeo.com') {
@@ -518,6 +533,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
518
533
  height: 500,
519
534
  doesResize: true,
520
535
  isAspectRatioLocked: true,
536
+ embedOnPaste: true,
521
537
  toEmbedUrl: (url) => {
522
538
  const urlObj = safeParseUrl(url)
523
539
  if (urlObj && urlObj.hash.match(/#room=/)) {
@@ -542,6 +558,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
542
558
  doesResize: true,
543
559
  isAspectRatioLocked: false,
544
560
  backgroundColor: '#fff',
561
+ embedOnPaste: true,
545
562
  toEmbedUrl: (url) => {
546
563
  const urlObj = safeParseUrl(url)
547
564
  if (urlObj && urlObj.pathname.match(/^\/@([^/]+)\/([^/]+)\/?$/)) {
@@ -573,6 +590,7 @@ export const DEFAULT_EMBED_DEFINITIONS = [
573
590
  width: 700,
574
591
  height: 450,
575
592
  doesResize: true,
593
+ embedOnPaste: true,
576
594
  toEmbedUrl: (url) => {
577
595
  const urlObj = safeParseUrl(url)
578
596
  if (
@@ -673,6 +691,7 @@ export interface EmbedDefinition {
673
691
  readonly overridePermissions?: TLEmbedShapePermissions
674
692
  readonly instructionLink?: string
675
693
  readonly backgroundColor?: string
694
+ readonly embedOnPaste?: boolean
676
695
  // TODO: FIXME this is ugly be required because some embeds have their own border radius for example spotify embeds
677
696
  readonly overrideOutlineRadius?: number
678
697
  // eslint-disable-next-line @typescript-eslint/method-signature-style
@@ -557,7 +557,7 @@ export async function defaultHandleExternalUrlContent(
557
557
  const embedUtil = editor.getShapeUtil('embed') as EmbedShapeUtil | undefined
558
558
  const embedInfo = embedUtil?.getEmbedDefinition(url)
559
559
 
560
- if (embedInfo) {
560
+ if (embedInfo && embedInfo.definition.embedOnPaste) {
561
561
  return editor.putExternalContent({
562
562
  type: 'embed',
563
563
  url: embedInfo.url,
@@ -144,6 +144,9 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
144
144
  override hideSelectionBoundsFg() {
145
145
  return true
146
146
  }
147
+ override hideInMinimap() {
148
+ return true
149
+ }
147
150
 
148
151
  override canBeLaidOut(shape: TLArrowShape, info: TLShapeUtilCanBeLaidOutOpts) {
149
152
  if (info.type === 'flip') {
@@ -48,6 +48,9 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
48
48
  override hideSelectionBoundsBg() {
49
49
  return true
50
50
  }
51
+ override hideInMinimap() {
52
+ return true
53
+ }
51
54
 
52
55
  override getDefaultProps(): TLLineShape['props'] {
53
56
  const [start, end] = getIndices(2)
@@ -249,6 +249,12 @@ export class MinimapManager {
249
249
 
250
250
  const len = geometry.length
251
251
 
252
+ const shape = this.editor.getShape(shapeId)
253
+ if (shape) {
254
+ const shapeUtil = this.editor.getShapeUtil(shape.type)
255
+ if (shapeUtil.hideInMinimap?.(shape)) continue
256
+ }
257
+
252
258
  if (selectedShapes.has(shapeId)) {
253
259
  appendVertices(this.gl.selectedShapes, selectedShapeOffset, geometry)
254
260
  selectedShapeOffset += len
@@ -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 = '4.1.0-canary.2f8483de4802'
4
+ export const version = '4.1.0-canary.3134b1ea0e08'
5
5
  export const publishDates = {
6
6
  major: '2025-09-18T14:39:22.803Z',
7
- minor: '2025-10-02T08:33:43.489Z',
8
- patch: '2025-10-02T08:33:43.489Z',
7
+ minor: '2025-10-02T13:32:16.492Z',
8
+ patch: '2025-10-02T13:32:16.492Z',
9
9
  }