Tldraw/packages/editor/src/lib/utils
alex f2d8fae6ea
hoist opacity out of props (#1526)
This change hoists opacity out of props and changes it to a number
instead of an enum.

The change to a number is to make tldraw more flexible for library
consumers who might want more expressivity with opacity than our 5
possible values allow. the tldraw editor will now happily respect any
opacity between 0 and 1. The limit to our supported values is enforced
only in the UI. I think this is limited enough that it's a reasonable
tradeoff between in-app simplicity and giving external developers the
flexibility they need.

There's a new `opacityForNextShape` property on the instance. This works
exactly the same way as propsForNextShape does, except... it's just for
opacity. With this, there should be no user-facing changes to how
opacity works in tldraw. There are also new `opacity`/`setOpacity` APIs
in the editor that work with it/selections similar to how props do.

@ds300 do you mind reviewing the migrations here?

### Change Type

- [x] `major` — Breaking Change

### Test Plan

- [x] Unit Tests
- [ ] Webdriver tests

### Release Notes

[internal only for now]
2023-06-06 16:15:12 +00:00
..
sync Independent instance state persistence (#1493) 2023-06-05 14:11:07 +00:00
WeakMapCache.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
assets.test.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
assets.ts hoist opacity out of props (#1526) 2023-06-06 16:15:12 +00:00
data.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
debug-flags.ts [3/3] Highlighter styling (#1490) 2023-06-01 15:34:59 +00:00
dom.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
embeds.test.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
embeds.ts Renaming types, shape utils, tools (#1513) 2023-06-04 10:38:53 +00:00
export.ts scale exported canvases when they reach the browsers max size (#1536) 2023-06-06 11:44:21 +00:00
getBrowserCanvasMaxSize.tsx scale exported canvases when they reach the browsers max size (#1536) 2023-06-06 11:44:21 +00:00
hard-reset.ts rename app to editor (#1503) 2023-06-02 15:21:45 +00:00
is-gif-animated.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
legacy.ts Add migration for horizontal alignment (#1443) 2023-05-24 11:34:13 +00:00
png.ts Added `pHYs` to import/export of png images (#1200) 2023-04-29 22:10:01 +00:00
props-for-next-shape.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
refresh-page.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
rotation.ts rename app folder to editor (#1528) 2023-06-06 16:01:54 +00:00
runtime.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
string.ts [fix] tabs in text exports (#1323) 2023-05-11 09:20:48 +00:00
svg.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
window-open.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00