Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/docs/content/releases/next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ This is useful for scripting, automation, agent workflows, and REPL-style intera

The tldraw UI now supports right-to-left languages like Arabic. A new `useDirection()` hook returns `'ltr'` or `'rtl'` from the current translation context, and all Radix UI components and CSS have been updated to respect text direction. The `dir` attribute is set on `.tl-container`, and CSS uses logical properties (`margin-inline-start`, `inset-inline-end`, etc.) instead of physical ones.

### @tldraw/mermaid ([#8194](https://github.com/tldraw/tldraw/pull/8194), [#8285](https://github.com/tldraw/tldraw/pull/8285))
### @tldraw/mermaid ([#8194](https://github.com/tldraw/tldraw/pull/8194), [#8285](https://github.com/tldraw/tldraw/pull/8285), [#8322](https://github.com/tldraw/tldraw/pull/8322))

A new `@tldraw/mermaid` package converts Mermaid diagram syntax into native tldraw shapes. Paste Mermaid text to create flowcharts, sequence diagrams, state diagrams, and mind maps as editable shapes on the canvas.

Expand All @@ -76,6 +76,8 @@ await createMermaidDiagram(editor, `

The package parses Mermaid syntax, extracts layout from the rendered SVG, and produces a diagram-agnostic blueprint that gets rendered into geo shapes, arrows, and groups.

Node creation is extensible: pass `mapNodeToRenderSpec` per diagram type to map diagram nodes to different shapes, or use `createShape` in `BlueprintRenderingOptions` to take full control of how nodes are created on the canvas.

### Clipboard hooks ([#8290](https://github.com/tldraw/tldraw/pull/8290))

New `TldrawOptions` hooks let you intercept and customize clipboard copy, cut, and paste. `onBeforeCopyToClipboard` filters or transforms serialized content before it hits the clipboard, `onBeforePasteFromClipboard` filters parsed paste payloads before shapes are created, and `onClipboardPasteRaw` handles raw clipboard data before tldraw's default paste pipeline.
Expand Down Expand Up @@ -144,6 +146,7 @@ New helpers `getOwnerDocument()` and `getOwnerWindow()` are exported from `@tldr
- Add `Vec.IsFinite()` static method. ([#8176](https://github.com/tldraw/tldraw/pull/8176))
- Change `Vec.PointsBetween()` to accept an optional `ease` parameter. ([#7977](https://github.com/tldraw/tldraw/pull/7977))
- Add `@tldraw/mermaid` package with `createMermaidDiagram()`, `renderBlueprint()`, and `MermaidDiagramError` for converting Mermaid syntax to tldraw shapes. ([#8194](https://github.com/tldraw/tldraw/pull/8194))
- Add `mapNodeToRenderSpec` per-diagram-type option and `createShape` override to `@tldraw/mermaid` for customizing how diagram nodes are rendered as shapes. ([#8322](https://github.com/tldraw/tldraw/pull/8322))
- Add `TextManager.measureHtmlBatch()` for batched DOM text measurement. ([#7949](https://github.com/tldraw/tldraw/pull/7949))
- Add `TLUserStore` interface with `getCurrentUser()` and `resolve()` for connecting tldraw to auth systems. Add unified `TLUser` record type, `UserRecordType`, `createUserId`, `isUserId`, `userIdValidator`, and `createUserRecordType()` for extensible user schemas. Add `user` parameter to `createTLSchema()`. Add `Editor.getAttributionUser()`, `Editor.getAttributionUserId()`, and `Editor.getAttributionDisplayName()`. Add `textFirstEditedBy` prop to `TLNoteShapeProps`. ([#8147](https://github.com/tldraw/tldraw/pull/8147))

Expand Down
1 change: 1 addition & 0 deletions apps/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"test-coverage": "yarn run -T vitest run --coverage --passWithNoTests"
},
"dependencies": {
"@dimforge/rapier2d-compat": "^0.19.3",
"@playwright/test": "^1.58.2",
"@tiptap/core": "^3.12.1",
"@tiptap/extension-font-family": "^3.12.1",
Expand Down
12 changes: 12 additions & 0 deletions apps/examples/src/examples/use-cases/xkcd-dependency/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Gravity sim (xkcd 2347)
component: ./XkcdDependencyExample.tsx
keywords: [physics, gravity, animation, fun, xkcd, rapier]
priority: 10
---

A recreation of the xkcd "Dependency" comic (#2347) using tldraw shapes and Rapier 2D physics.

---

The tower of blocks is held up by gravity from the start. Try pulling out a block and watch everything collapse — just like in the [original comic](https://xkcd.com/2347/).
Loading
Loading