EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
M0.37: migrate EffectCraft to egui 0.37
skylartaylor9ee853715d86
diff --cc ATTRIBUTION.mdindex be99cdce1,be99cdce1..c9faa57b1--- a/ATTRIBUTION.md+++ b/ATTRIBUTION.md@@@ -5,6 -5,6 +5,16 @@@ a `<file>.attribution` sidecar with fuliconography, images or other Adobe assets; open licences only; every asset attributed.`cargo xtask assets` checks that this index and the sidecars cover every asset in the repository.++## Bundled egui font icons++++These dependency fonts are embedded by the pinned egui font definitions; no font file is added++here. The subset uses default_fonts; the parent face uses monochrome_emoji_fonts.++++| Asset | Author | Source | Licence |++|---|---|---|---|++| `epaint_default_fonts/fonts/egui-icons.ttf` | John Slegers (emoji-icon-font) | https://github.com/storytold/egui/blob/173cc7375d35dc5fbc5b5d0994fdf787f547c5d1/crates/epaint_default_fonts/fonts/egui-icons.txt; original https://github.com/jslegers/emoji-icon-font | MIT (complete copyright and permission text in NOTICE) |++| `epaint_default_fonts/fonts/emoji-icon-font.ttf` | John Slegers | https://github.com/storytold/egui/blob/173cc7375d35dc5fbc5b5d0994fdf787f547c5d1/crates/epaint_default_fonts/fonts/emoji-icon-font-mit-license.txt; original https://github.com/jslegers/emoji-icon-font | MIT (complete copyright and permission text in NOTICE) |++## Asset files| Asset | Author | Source | Licence |@@@ -15,6 -15,6 +25,7 @@@| `assets/fonts/Inter-Bold.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) || `assets/fonts/Inter-Italic.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) || `assets/fonts/NotoSerif-Regular.ttf` | The Noto Project Authors | https://github.com/notofonts/latin-greek-cyrillic | OFL-1.1 (`assets/fonts/OFL-NotoSerif.txt`) |++| `assets/fonts/NotoSansSymbols2-Regular.ttf` | The Noto Project Authors | https://github.com/notofonts/symbols | OFL-1.1 (`assets/fonts/OFL-NotoSansSymbols2.txt`) || `assets/fonts/JetBrainsMono-Regular.ttf` | The JetBrains Mono Project Authors | https://github.com/JetBrains/JetBrainsMono | OFL-1.1 (`assets/fonts/OFL-JetBrainsMono.txt`) || `apps/effectcraft-web/web/favicon.svg` | EffectCraft contributors | Original work: web app icon, a copy of `assets/app-icon/effectcraft-small.svg` (the unicorn app icon) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) || `packaging/macos/dmg/background.svg` | @XusBadia | Original work: macOS DMG Finder window background, derived from the EffectCraft app icon (`assets/app-icon/effectcraft.svg`); rendered to a TIFF by `packaging/macos/package.sh` at package time | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) |diff --cc Cargo.lockindex 9bed551d4,f99e09a06..1509d171f--- a/Cargo.lock+++ b/Cargo.lock@@@ -4,66 -4,66 +4,60 @@@ version =[[package]]name = "accesskit"--version = "0.24.1"++version = "0.25.1"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320"++checksum = "ad442f58ee04714aaa0ba0a2768c1ea1935b29507bb22ddece8cbbc76db02932"dependencies = ["uuid",][[package]]name = "accesskit_atspi_common"--version = "0.18.1"++version = "0.21.0"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "1e8c61bee90b42a772d39d06a740207dc71a4e780004ace1db8d99fb1baaa954"++checksum = "52c182f9c282ac9c5638d876d551d15e5f7d397ec263349a0c6a2b61595dd5e4"dependencies = ["accesskit",-- "accesskit_consumer 0.36.0",++ "accesskit_consumer","atspi-common",-- "phf 0.13.1",++ "phf","serde","zvariant",][[package]]name = "accesskit_consumer"--version = "0.35.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "53cf47daed85312e763fbf85ceca136e0d7abc68e0a7e12abe11f48172bc3b10"-dependencies = [- "accesskit",- "hashbrown 0.16.1",-]--[[package]]-name = "accesskit_consumer"-version = "0.36.0"++version = "0.39.1"source = "registry+https://github.com/rust-lang/crates.io-index"- checksum = "53cf47daed85312e763fbf85ceca136e0d7abc68e0a7e12abe11f48172bc3b10"-checksum = "25e0d7e25d06f4dc21d1774d67146e9e80d6789216cbd4d1e88185b0095dba60"++checksum = "8a45e2bb300bea6d5f33a82c3e051c3ddc6f41c209750f68a0acbe991a284344"dependencies = ["accesskit",- "hashbrown 0.16.1",- ]-- [[package]]- name = "accesskit_consumer"- version = "0.36.0"- source = "registry+https://github.com/rust-lang/crates.io-index"- checksum = "25e0d7e25d06f4dc21d1774d67146e9e80d6789216cbd4d1e88185b0095dba60"- dependencies = [- "accesskit",-- "hashbrown 0.16.1",++ "hashbrown 0.17.1",][[package]]--name = "accesskit_consumer"--version = "0.38.0"++name = "accesskit_ios"++version = "0.2.1"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "5d10a236f96f87d70732e44520046785431ef01d5bcd6b041317bfadd2f88245"++checksum = "28e539d64b27fd4c14de8f78ada8f7c944c092f52f7e49fb63316507a57f6937"dependencies = ["accesskit",-- "hashbrown 0.16.1",++ "accesskit_consumer",++ "hashbrown 0.17.1",++ "objc2 0.5.2",++ "objc2-foundation 0.2.2",++ "objc2-ui-kit 0.2.2",][[package]]name = "accesskit_macos"--version = "0.26.3"++version = "0.27.1"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "ce02dc63b43f0c9296af9ac946312a2dc8814427d7a64d2d600971dac55b6076"++checksum = "5701624bf6a11efb6d4c8e922bf44126ed96250e5faa9a7a0468c979635839a4"dependencies = ["accesskit",-- "accesskit_consumer 0.38.0",-- "hashbrown 0.16.1",++ "accesskit_consumer",++ "hashbrown 0.17.1","objc2 0.5.2","objc2-app-kit 0.2.2","objc2-foundation 0.2.2",@@@ -71,9 -71,9 +65,9 @@@[[package]]name = "accesskit_unix"--version = "0.21.1"++version = "0.24.0"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "b016ca8db0ea0ea2ceff29a9d6240391492d960716aa471967c00e8cc8cb197c"++checksum = "202f24df034a7476d07b7f74284de84f6d62aabd858dbe7ee9cad3b7ad6f8f9d"dependencies = ["accesskit","accesskit_atspi_common",@@@ -89,13 -89,13 +83,13 @@@[[package]]name = "accesskit_windows"--version = "0.32.1"++version = "0.35.1"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "eff7009f1a532e917d66970a1e80c965140c6cfbbabbdde3d64e5431e6c78e21"++checksum = "ce63f35d6bdcf59f26b76b3379063f738e6412cef46999cc772d46aa3de35adb"dependencies = ["accesskit",-- "accesskit_consumer 0.35.0",-- "hashbrown 0.16.1",++ "accesskit_consumer",++ "hashbrown 0.17.1","static_assertions","windows 0.62.2","windows-core 0.62.2",@@@ -103,11 -103,11 +97,12 @@@[[package]]name = "accesskit_winit"--version = "0.32.2"++version = "0.34.1"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "1fe9a94394896352cc4660ca2288bd4ef883d83238853c038b44070c8f134313"++checksum = "ee96dd150375c05912d8a473f98c2fb155fb3234fac88292d396548a2460fa77"dependencies = ["accesskit",++ "accesskit_ios","accesskit_macos","accesskit_unix","accesskit_windows",@@@ -222,6 -222,6 +217,7 @@@ dependencies ="parking_lot","percent-encoding","windows-sys 0.60.2",++ "wl-clipboard-rs","x11rb",]@@@ -607,7 -607,7 +603,7 @@@ dependencies ="hashbrown 0.17.1","indexmap","once_cell",-- "phf 0.14.0",++ "phf","rustc-hash 2.1.3","static_assertions",]@@@ -994,7 -994,7 +990,7 @@@ dependencies =[[package]]name = "craft-ui"version = "0.1.0"--source = "git+https://github.com/storytold/craft-libs?rev=5c874d51eeb3de70e735c8ce87a59a7dedd47675#5c874d51eeb3de70e735c8ce87a59a7dedd47675"++source = "git+https://github.com/storytold/craft-libs?rev=25da1314d443171b4adeaad2cd9454b273f35c6f#25da1314d443171b4adeaad2cd9454b273f35c6f"dependencies = ["egui","serde",@@@ -1162,9 -1162,9 +1158,8 @@@ dependencies =[[package]]name = "ecolor"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "0656a7530b9e2841ee7a5f983965bdd9840c32f4012f759cfd44b912cced6b34"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["bytemuck","emath",@@@ -1720,9 -1721,9 +1716,8 @@@ dependencies =[[package]]name = "eframe"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "55ad41fac6e3149abb4866e93df37dbd33baa95db525c3368c944584e95a5dc2"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["ahash","bytemuck",@@@ -1744,6 -1745,6 +1739,7 @@@"pollster 1.0.1","profiling","raw-window-handle",++ "send_wrapper","static_assertions","wasm-bindgen","web-sys",@@@ -1755,9 -1756,9 +1751,8 @@@[[package]]name = "egui"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "dc938cc27cd911415e1e4d151bc56ff9df063d8db081374e87aeb805ea74b2ba"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["accesskit","ahash",@@@ -1775,9 -1776,9 +1770,8 @@@[[package]]name = "egui-wgpu"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "5cef1f6d1bba40b09a4d0d62cb822b81030922cfbf65c5373398c3a3caafc5bd"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["ahash","bytemuck",@@@ -1795,31 -1796,31 +1789,34 @@@[[package]]name = "egui-winit"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "98466000559d66ba4db786a30448b01483946add4188e7f10f522a27b4fb89cc"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["accesskit_winit","arboard",++ "block2 0.6.2","bytemuck","egui",++ "image","log","objc2 0.6.4",++ "objc2-app-kit 0.3.2","objc2-foundation 0.3.2","objc2-ui-kit 0.3.2",++ "parking_lot","profiling","raw-window-handle","smithay-clipboard","web-time","webbrowser",++ "windows-sys 0.61.2","winit",][[package]]name = "egui_glow"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "606ed4167daf341e5753d703285c4c1d562324b2c07aa8f405cd7d066fe58f3b"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["bytemuck","egui",@@@ -1831,9 -1832,9 +1828,8 @@@[[package]]name = "egui_kittest"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "5eb3f3effb2726fee23449293e67acbf6cc6ce35525b1722bd5743bb348114d5"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["eframe","egui",@@@ -1855,9 -1856,9 +1851,8 @@@ checksum = "252afb9ae5eaa683babdc6a068b[[package]]name = "emath"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "52c8d4141cf0f60fb2f7aefaf352d3ffa5171ef0ab09731c64391801e95e48f1"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["bytemuck",]@@@ -1905,9 -1906,9 +1900,8 @@@ dependencies =[[package]]name = "epaint"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "a0ec0308dc23130fc1a7d4623a8534c2ed069c6dc84e258ee4f3de99615aa1a3"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"dependencies = ["ahash","bytemuck",@@@ -1923,16 -1924,16 +1917,17 @@@"self_cell","skrifa","smallvec",++ "unicode-bidi","unicode-general-category",++ "unicode-properties","unicode-segmentation","vello_cpu",][[package]]name = "epaint_default_fonts"--version = "0.36.2"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "773fa9c96dd0dbef887e39d0ed6177f141cce4d68e6041df77570aa3702dfa13"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"[[package]]name = "equator"@@@ -2540,9 -2541,9 +2535,9 @@@ dependencies =[[package]]name = "glifo"--version = "0.2.0"++version = "0.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "ed4a1bb24121291d27230c1b1b44e07d6a9b28cefdb32fe1581dfb84e14f940a"++checksum = "282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be"dependencies = ["bytemuck","foldhash 0.2.0",@@@ -3059,12 -3059,12 +3053,12 @@@ checksum = "e2db585e1d738fc771bf08a1514[[package]]name = "kittest"--version = "0.4.0"++version = "0.5.0"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "90ceaa75eb0036a32b6b9833962eb18137449e9817e2e586006471925b727fd5"++checksum = "0bb81a721ba76aa095b7f45deb180504f786904e56ca4b8e141f66eb89a78b75"dependencies = ["accesskit",-- "accesskit_consumer 0.35.0",++ "accesskit_consumer",][[package]]@@@ -3393,6 -3393,6 +3387,15 @@@ version = "0.2.0source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"++[[package]]++name = "nom"++version = "8.0.0"++source = "registry+https://github.com/rust-lang/crates.io-index"++checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"++dependencies = [++ "memchr",++]++[[package]]name = "nu-ansi-term"version = "0.50.3"@@@ -3885,6 -3885,6 +3888,16 @@@ dependencies ="pin-project-lite",]++[[package]]++name = "os_pipe"++version = "1.2.3"++source = "registry+https://github.com/rust-lang/crates.io-index"++checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"++dependencies = [++ "libc",++ "windows-sys 0.61.2",++]++[[package]]name = "parking"version = "2.2.1"@@@ -3946,14 -3946,14 +3959,14 @@@ source = "registry+https://github.com/rchecksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"[[package]]--name = "phf"--version = "0.13.1"++name = "petgraph"++version = "0.8.3"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"++checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"dependencies = [-- "phf_macros 0.13.1",-- "phf_shared 0.13.1",-- "serde",++ "fixedbitset",++ "hashbrown 0.15.5",++ "indexmap",][[package]]@@@ -3962,18 -3962,18 +3975,9 @@@ version = "0.14.0source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6"dependencies = [-- "phf_macros 0.14.0",-- "phf_shared 0.14.0",--]----[[package]]--name = "phf_generator"--version = "0.13.1"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"--dependencies = [-- "fastrand",-- "phf_shared 0.13.1",++ "phf_macros",++ "phf_shared",++ "serde",][[package]]@@@ -3983,20 -3983,20 +3987,7 @@@ source = "registry+https://github.com/rchecksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100"dependencies = ["fastrand",-- "phf_shared 0.14.0",--]----[[package]]--name = "phf_macros"--version = "0.13.1"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef"--dependencies = [-- "phf_generator 0.13.1",-- "phf_shared 0.13.1",-- "proc-macro2",-- "quote",-- "syn 2.0.119",++ "phf_shared",][[package]]@@@ -4005,22 -4005,22 +3996,13 @@@ version = "0.14.0source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085"dependencies = [-- "phf_generator 0.14.0",-- "phf_shared 0.14.0",++ "phf_generator",++ "phf_shared","proc-macro2","quote","syn 2.0.119",]--[[package]]--name = "phf_shared"--version = "0.13.1"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"--dependencies = [-- "siphasher",--]--[[package]]name = "phf_shared"version = "0.14.0"@@@ -4605,6 -4605,6 +4587,12 @@@ version = "1.0.28source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"++[[package]]++name = "send_wrapper"++version = "0.6.0"++source = "registry+https://github.com/rust-lang/crates.io-index"++checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73"++[[package]]name = "serde"version = "1.0.229"@@@ -5362,6 -5372,6 +5360,17 @@@ dependencies ="once_cell",]++[[package]]++name = "tree_magic_mini"++version = "3.2.2"++source = "registry+https://github.com/rust-lang/crates.io-index"++checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6"++dependencies = [++ "memchr",++ "nom",++ "petgraph",++]++[[package]]name = "type-map"version = "0.5.1"@@@ -5476,9 -5486,9 +5485,9 @@@ dependencies =[[package]]name = "vello_common"--version = "0.1.0"++version = "0.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "b2e9aed918117e8152c9eddfd8362d73c465c23f26c44786aa331707b8a64fa2"++checksum = "bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd"dependencies = ["bytemuck","fearless_simd",@@@ -5491,9 -5501,9 +5500,9 @@@[[package]]name = "vello_cpu"--version = "0.1.0"++version = "0.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "ac7349e1f55f6b801c7c277958df4ea53e7f20f21e8014910ad888b2ecda93ea"++checksum = "ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9"dependencies = ["bytemuck","glifo",@@@ -6487,8 -6497,8 +6496,7 @@@ checksum = "d6bbff5f0aada427a1e5a6da5f1[[package]]name = "winit"version = "0.30.13"--source = "registry+https://github.com/rust-lang/crates.io-index"--checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d"++source = "git+https://github.com/storytold/winit.git?rev=a517b3846ee8457d84ee4975110bfda6797c44dc#a517b3846ee8457d84ee4975110bfda6797c44dc"dependencies = ["ahash","android-activity",@@@ -6560,6 -6570,6 +6568,24 @@@ version = "0.57.1source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"++[[package]]++name = "wl-clipboard-rs"++version = "0.9.4"++source = "registry+https://github.com/rust-lang/crates.io-index"++checksum = "4d7888ccd4896447b2d14d3a9350a85df2aeb6f181e2e7a31349d104ac46cac1"++dependencies = [++ "libc",++ "log",++ "os_pipe",++ "rustix 1.1.5",++ "thiserror 2.0.21",++ "tree_magic_mini",++ "wayland-backend",++ "wayland-client",++ "wayland-protocols",++ "wayland-protocols-wlr",++]++[[package]]name = "write16"version = "1.0.0"@@@ -6923,3 -6933,3 +6949,23 @@@ dependencies ="syn 3.0.6","winnow",]++++[[patch.unused]]++name = "egui_demo_lib"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"++++[[patch.unused]]++name = "egui_extras"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"++++[[patch.unused]]++name = "egui_inspection"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"++++[[patch.unused]]++name = "egui_system_font_provider"++version = "0.37.0"++source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"diff --cc Cargo.tomlindex d71d29337,a3935f047..2f4049685--- a/Cargo.toml+++ b/Cargo.toml@@@ -106,10 -106,10 +106,13 @@@ pollster = "0.4# ui# Shared frontend components; keep this dependency above the engine boundary.--craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5c874d51eeb3de70e735c8ce87a59a7dedd47675", features = ["serde"] }--egui = "0.36"--eframe = { version = "0.36", default-features = false }--egui_kittest = "0.36"++# Shared UI and the complete egui family select reviewed immutable commits below.++craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "25da1314d443171b4adeaad2cd9454b273f35c6f", features = ["serde"] }++# `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()`++# and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate.++egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] }++eframe = { version = "0.37", default-features = false }++egui_kittest = "0.37"rfd = "0.17"cpal = "0.16"# The operating system's interface language (MIT/Apache-2.0, no dependencies on desktop).@@@ -216,4 -216,5 +219,20 @@@ lto = "thincodegen-units = 1[patch.crates-io]- hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "ca50d63b773c99f96e75c77ce5a1d21e7c9cda0d", version = "=0.7.2" }+ hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "9f75d3dc19b4b514c4f3d4847ed1ec1b0e86b4ef", version = "=0.7.2" }+ hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "9f75d3dc19b4b514c4f3d4847ed1ec1b0e86b4ef", version = "=0.3.0" }++ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui-winit = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }++winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" }diff --cc NOTICEindex 43bd2e2a9,43bd2e2a9..61d96e48e--- a/NOTICE+++ b/NOTICE@@@ -20,3 -20,3 +20,21 @@@ The optional PDF document reader uses cThe shared patched syntax source is centralized in storytold/craft-libs, transferred fromPdfCraft revision 9ed3abe4907a127d36b12fbfeee71d7e26248da1. This parser-only use embeds noHayro fonts, CMaps or image codecs; EffectCraft keeps its existing fonts and drawing filters.++++Bundled egui font icons++++The pinned egui dependency includes egui-icons.ttf, a small subset of John Slegers'++emoji-icon-font, through default_fonts. The parent emoji-icon-font.ttf face is++included through monochrome_emoji_fonts. Their upstream project is++https://github.com/jslegers/emoji-icon-font; both use the same exact copyright++and permission notice below.++++MIT License++++Copyright (c) 2014 John Slegers++++Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:++++The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.++++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.diff --cc apps/effectcraft-web/src/app.rsindex 3f462bd2a,3f462bd2a..f09bf28a1--- a/apps/effectcraft-web/src/app.rs+++ b/apps/effectcraft-web/src/app.rs@@@ -87,6 -87,6 +87,17 @@@ pub struct WebAppimpl eframe::App for WebApp {fn raw_input_hook(&mut self, ctx: &egui::Context, raw_input: &mut egui::RawInput) {++ // Files dropped on the page are input: read them here, where the browser's drop event is++ // still the current pass's, not from a later (possibly logic-only) tick.++ //++ // The list is *taken* out of the raw input: a hidden tab runs `logic` and eframe appends++ // the same prepared raw input back for the next pass, so leaving the files there would++ // import them again on every hidden logic tick.++ let dropped_files = std::mem::take(&mut raw_input.dropped_files);++ let dropped: Vec<web_sys::File> = dropped_files.iter().filter_map(|f| f.web_file().cloned()).collect();++ if !dropped.is_empty() {++ files::read_files(dropped, |paths| post(move |app| open_or_import(app, paths)));++ }self.app.raw_input_hook(ctx, raw_input);}@@@ -95,18 -95,18 +106,14 @@@for f in actions {f(&mut self.app);}-- // Files dropped on the page: read them, then open/import.-- let dropped: Vec<web_sys::File> = ctx.input(|i| i.raw.dropped_files.iter().filter_map(|f| f.web_file().cloned()).collect());-- if !dropped.is_empty() {-- files::read_files(dropped, |paths| post(move |app| open_or_import(app, paths)));-- }-- self.app.logic(ctx, frame);++ self.app.tick(ctx, frame);api::poll_replies();// Render Queue outputs written this frame (here or by a worker) → downloads.files::flush_downloads();// What a reload comes back to.if self.persist {-- persist::snapshot(&self.app.session, ctx.input(|i| i.time), 1.0);++ // The app's monotonic clock: `ctx.input(|i| i.time)` is stale in a logic-only tick.++ persist::snapshot(&self.app.session, self.app.now(), 1.0);}api::set_info("gpu", json!({"compositor": self.app.gpu_adapter(), "viewerOnGpu": self.app.viewer_on_gpu()}));api::set_info("frameWorkers", frames::stats());@@@ -114,6 -114,6 +121,7 @@@let d = &self.app.session.prefs.disk;diskcache::configure(d.disk_cache_enabled, d.disk_cache_max_gb, storage::quota());api::set_info("diskCache", diskcache::stats());++ self.app.finish_ime_logic(ctx);}fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) {@@@ -195,7 -195,7 +203,9 @@@ pub async fn start(canvas_id: String) -let home = query_flag("home");// Browser storage: settings, recent projects, imported media, saved projects, auto-saves and// the last session come back.-- let t0 = js_sys::Date::now();++ // Monotonic (performance.now) rather than the wall clock: a system-time jump must not turn++ // the storage-load report negative or huge.++ let t0 = web_time::Instant::now();let stored = match persist::load(&query_value("storage").unwrap_or_default()).await {Ok(n) => n,Err(e) => {@@@ -203,7 -203,7 +213,7 @@@0}};-- api::set_info("storage", json!({"backend": persist::backend(), "entries": stored, "loadMs": js_sys::Date::now() - t0}));++ api::set_info("storage", json!({"backend": persist::backend(), "entries": stored, "loadMs": t0.elapsed().as_secs_f64() * 1000.0}));audio::install_unlock();browse::restore();diskcache::init();@@@ -214,6 -214,6 +224,7 @@@canvas,eframe::WebOptions::default(),Box::new(move |cc| {++ EffectcraftApp::install_ime_reset_hooks(&cc.egui_ctx);CTX.with(|c| *c.borrow_mut() = Some(cc.egui_ctx.clone()));// The page owns this shared presentation device; worker devices retain their// separate owned-device handlers. No browser error-scope future is blocked on.diff --cc apps/effectcraft/Cargo.tomlindex 5ad6c80d1,5ad6c80d1..8a1ea3ae3--- a/apps/effectcraft/Cargo.toml+++ b/apps/effectcraft/Cargo.toml@@@ -15,7 -15,7 +15,7 @@@ effectcraft-host = { workspace = trueeffectcraft-ui-egui = { workspace = true }egui = { workspace = true }# `links`: links (Help menu, Discord, Settings) open in the system browser.--eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "links", "wayland", "x11"] }++eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "clipboard", "links", "wayland", "x11"] }serde = { workspace = true }serde_json = { workspace = true }# The window's monitors, size and position (src/window.rs), and macOS event-loop options (no appdiff --cc apps/effectcraft/src/main.rsindex a1fb6e4a5,2bc3265dd..a95e79a49--- a/apps/effectcraft/src/main.rs+++ b/apps/effectcraft/src/main.rs@@@ -203,6 -203,6 +203,7 @@@ fn main() -> eframe::Result"EffectCraft",options,Box::new(move |cc| {++ EffectcraftApp::install_ime_reset_hooks(&cc.egui_ctx);match &cc.wgpu_render_state {Some(rs) => log::info!("graphics: {:?}", rs.adapter.get_info()),None => log::info!("graphics: no wgpu device"),@@@ -427,7 -434,7 +435,8 @@@ impl eframe::App for Desktopfn logic(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {#[cfg(target_os = "macos")]self.menu.update(&mut self.app, ctx);-- self.app.logic(ctx, frame);++ self.app.tick(ctx, frame);++ self.app.finish_ime_logic(ctx);}fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) {diff --cc assets/fonts/NotoSansSymbols2-Regular.ttfindex 000000000,000000000..caf89dd0enew file mode 100644Binary files differdiff --cc assets/fonts/NotoSansSymbols2-Regular.ttf.attributionindex 000000000,000000000..4d6d416benew file mode 100644--- /dev/null+++ b/assets/fonts/NotoSansSymbols2-Regular.ttf.attribution@@@ -1,0 -1,0 +1,8 @@@++asset: NotoSansSymbols2-Regular.ttf++title: Noto Sans Symbols 2 Regular (chrome symbols such as ✔ and ▣)++author: The Noto Project Authors++source: https://github.com/notofonts/symbols (Google Fonts commit 47d54ca1ebb14fd864695f1d39dc734f39017c33, file ofl/notosanssymbols2/NotoSansSymbols2-Regular.ttf)++license: OFL-1.1++license-file: assets/fonts/OFL-NotoSansSymbols2.txt++added: 2026-10-24 by @skylartaylor++notes: Unmodified font file, sha256 7d5fb73b7ca67a6798101741f5d280a3d016a56a197afcd4199dbb57b4b82a21. Embedded with include_bytes! in crates/ui-egui/src/theme.rs as the last UI fallback so every family can draw the chrome symbols (U+2714 ✔, U+25A3 ▣) that Inter, Inter Medium, Inter SemiBold and JetBrains Mono lack.diff --cc assets/fonts/OFL-NotoSansSymbols2.txtindex 000000000,000000000..7c95767f5new file mode 100644--- /dev/null+++ b/assets/fonts/OFL-NotoSansSymbols2.txt@@@ -1,0 -1,0 +1,93 @@@++Copyright 2022 The Noto Project Authors (https://github.com/notofonts/symbols)++++This Font Software is licensed under the SIL Open Font License, Version 1.1.++This license is copied below, and is also available with a FAQ at:++https://scripts.sil.org/OFL++++++-----------------------------------------------------------++SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007++-----------------------------------------------------------++++PREAMBLE++The goals of the Open Font License (OFL) are to stimulate worldwide++development of collaborative font projects, to support the font creation++efforts of academic and linguistic communities, and to provide a free and++open framework in which fonts may be shared and improved in partnership++with others.++++The OFL allows the licensed fonts to be used, studied, modified and++redistributed freely as long as they are not sold by themselves. The++fonts, including any derivative works, can be bundled, embedded,++redistributed and/or sold with any software provided that any reserved++names are not used by derivative works. The fonts and derivatives,++however, cannot be released under any other type of license. The++requirement for fonts to remain under this license does not apply++to any document created using the fonts or their derivatives.++++DEFINITIONS++"Font Software" refers to the set of files released by the Copyright++Holder(s) under this license and clearly marked as such. This may++include source files, build scripts and documentation.++++"Reserved Font Name" refers to any names specified as such after the++copyright statement(s).++++"Original Version" refers to the collection of Font Software components as++distributed by the Copyright Holder(s).++++"Modified Version" refers to any derivative made by adding to, deleting,++or substituting -- in part or in whole -- any of the components of the++Original Version, by changing formats or by porting the Font Software to a++new environment.++++"Author" refers to any designer, engineer, programmer, technical++writer or other person who contributed to the Font Software.++++PERMISSION & CONDITIONS++Permission is hereby granted, free of charge, to any person obtaining++a copy of the Font Software, to use, study, copy, merge, embed, modify,++redistribute, and sell modified and unmodified copies of the Font++Software, subject to the following conditions:++++1) Neither the Font Software nor any of its individual components,++in Original or Modified Versions, may be sold by itself.++++2) Original or Modified Versions of the Font Software may be bundled,++redistributed and/or sold with any software, provided that each copy++contains the above copyright notice and this license. These can be++included either as stand-alone text files, human-readable headers or++in the appropriate machine-readable metadata fields within text or++binary files as long as those fields can be easily viewed by the user.++++3) No Modified Version of the Font Software may use the Reserved Font++Name(s) unless explicit written permission is granted by the corresponding++Copyright Holder. This restriction only applies to the primary font name as++presented to the users.++++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font++Software shall not be used to promote, endorse or advertise any++Modified Version, except to acknowledge the contribution(s) of the++Copyright Holder(s) and the Author(s) or with their explicit written++permission.++++5) The Font Software, modified or unmodified, in part or in whole,++must be distributed entirely under this license, and must not be++distributed under any other license. The requirement for fonts to++remain under this license does not apply to any document created++using the Font Software.++++TERMINATION++This license becomes null and void if any of the above conditions are++not met.++++DISCLAIMER++THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,++EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF++MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT++OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE++COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,++INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL++DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING++FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM++OTHER DEALINGS IN THE FONT SOFTWARE.diff --cc crates/engine/src/commands/edit.rsindex 019d56d1d,3630efeee..cde77b1e8--- a/crates/engine/src/commands/edit.rs+++ b/crates/engine/src/commands/edit.rs@@@ -207,6 -227,6 +227,9 @@@ fn delete(s: &mut Session, p: &Value) -st.selected_keys.clear();Ok(())})?;++ // A removed layer may have been the edited one (possibly with the same id restored by an++ // immediate undo): end or re-epoch that session before another command can reuse it.++ s.sanitize_state();Ok(json!(ids.len()))}diff --cc crates/engine/src/commands/layer.rsindex 13037c88a,13037c88a..e220e7d93--- a/crates/engine/src/commands/layer.rs+++ b/crates/engine/src/commands/layer.rs@@@ -200,7 -200,7 +200,14 @@@ fn new_text(s: &mut Session, p: &Valuelet n = doc.char_len();let id = insert_layer(proj, st, cid, l)?;if edit {-- st.text_edit = Some(super::text_edit::TextEdit { layer: id, anchor: 0, caret: n, created: true, ..Default::default() });++ st.text_edit = Some(super::text_edit::TextEdit {++ layer: id,++ anchor: 0,++ caret: n,++ created: true,++ session: super::text_edit::next_edit_session(),++ ..Default::default()++ });}Ok(id)})?;@@@ -1474,6 -1474,6 +1481,7 @@@ fn set_text(s: &mut Session, p: &Value}s.bump();}++ let replacing_text = p.get("text").is_some() && s.state.text_edit.as_ref().is_some_and(|e| e.layer == lid);s.edit("Edit Text", merge_p(p), |proj, _| {let l = layer_mut(proj, cid, lid)?;let lt = l.layer_time(t);@@@ -1494,6 -1494,6 +1502,9 @@@}Ok(())})?;++ if replacing_text {++ super::text_edit::invalidate_session(s);++ }Ok(Value::Null)}diff --cc crates/engine/src/commands/text_edit.rsindex 5dcb6d09a,9d12e458c..4f47d3bad--- a/crates/engine/src/commands/text_edit.rs+++ b/crates/engine/src/commands/text_edit.rs@@@ -10,11 -10,11 +10,19 @@@ use effectcraft_project::{LayerId, Layeuse serde::{Deserialize, Serialize};use serde_json::{Value, json};++/// Session tokens for the on-canvas editor, unique across the process (so a recreated session++/// never reuses a live IME context). Exhaustion wraps; it cannot panic.++static NEXT_EDIT_SESSION: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1);++++pub(super) fn next_edit_session() -> u64 {++ NEXT_EDIT_SESSION.fetch_add(1, std::sync::atomic::Ordering::Relaxed)++}++use super::{CommandSpec, b_p, bad, comp_id, layer_mut, resolve_layer, str_p};use crate::{EditorState, EngineError, Result, Session, cmd};/// An on-canvas text editing session.--#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]++#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]pub struct TextEdit {pub layer: LayerId,pub anchor: usize,@@@ -28,6 -28,6 +36,21 @@@/// Line position kept by repeated up / down moves (layout space).#[serde(default)]pub goal_x: Option<f64>,++ /// This editing session's identity.++ ///++ /// It changes when the editor is started, its layer/document is replaced (including by++ /// undo/redo), or the editor is restored from another state. It is deliberately not++ /// serialized: a saved token belongs to a previous process and cannot identify a new++ /// target. The IME owner uses it as its replacement epoch, so an old composition is never++ /// inherited by a recreated layer or a replaced document.++ #[serde(skip, default = "next_edit_session")]++ pub session: u64,++}++++impl Default for TextEdit {++ fn default() -> Self {++ Self { layer: LayerId(0), anchor: 0, caret: 0, pending: None, created: false, goal_x: None, session: next_edit_session() }++ }}impl TextEdit {@@@ -49,6 -49,6 +72,130 @@@ pub fn layer_doc(s: &Session, lid: Laye}}++/// The largest committed-text window an IME observation copies.++///++/// This mirrors `egui::output::MAX_IME_SURROUNDING_TEXT_BYTES`: a selection wider than this is++/// reported as unavailable rather than silently truncated.++pub const MAX_IME_TEXT_BYTES: usize = 4000;++++/// Bounded committed text around an IME selection, with UTF-8 byte offsets.++///++/// The Type tool keeps the input method's pre-edit in egui's temporary data, never in the++/// layer's [`TextDoc`], so [`Self::text`] is committed text only.++#[derive(Clone, Debug, PartialEq, Eq)]++pub struct ImeSurrounding {++ /// At most [`MAX_IME_TEXT_BYTES`] bytes of the edited layer's text.++ pub text: String,++ /// The caret (primary selection end) as a UTF-8 byte offset in [`Self::text`].++ pub cursor: usize,++ /// The other selection end; larger than `cursor` for a reversed selection.++ pub anchor: usize,++}++++impl ImeSurrounding {++ /// A bounded window of `text` around the selection `cursor`/`anchor`.++ ///++ /// Returns `None` when an offset is past the text or inside a character, or when the++ /// selection itself is wider than [`MAX_IME_TEXT_BYTES`]: the caller then reports++ /// surrounding text as unavailable instead of sending a truncated selection.++ pub fn from_text(text: &str, cursor: usize, anchor: usize) -> Option<Self> {++ if cursor > text.len() || anchor > text.len() || !text.is_char_boundary(cursor) || !text.is_char_boundary(anchor) {++ return None;++ }++ let (start, end) = (cursor.min(anchor), cursor.max(anchor));++ let selection = end - start;++ if selection > MAX_IME_TEXT_BYTES {++ return None;++ }++ // Spend the remaining budget on both sides of the selection, giving unused room on one++ // side to the other. Only this bounded window is copied.++ let budget = MAX_IME_TEXT_BYTES - selection;++ let mut before = (budget / 2).min(start);++ let mut after = (budget - before).min(text.len() - end);++ before = (budget - after).min(start);++ after = (budget - before).min(text.len() - end);++ let mut window_start = start - before;++ let mut window_end = end + after;++ // Byte budgets can land inside a multi-byte character: shrink the window so it never++ // splits one and the selection stays inside it.++ while window_start < start && !text.is_char_boundary(window_start) {++ window_start += 1;++ }++ while end < window_end && !text.is_char_boundary(window_end) {++ window_end -= 1;++ }++ Some(Self {++ text: text.get(window_start..window_end)?.to_owned(),++ cursor: cursor.checked_sub(window_start)?,++ anchor: anchor.checked_sub(window_start)?,++ })++ }++}++++/// The edited layer's committed text around its selection, or `None` when there is no edit++/// session, the layer is gone, or the selection is wider than [`MAX_IME_TEXT_BYTES`].++///++/// The caret and the anchor are converted to UTF-8 byte offsets separately, so a reversed++/// selection stays reversed. A valid empty document is `Some` with empty text, never `None`.++pub fn ime_surrounding(s: &Session) -> Option<ImeSurrounding> {++ let e = s.state.text_edit.as_ref()?;++ let comp = s.active_comp()?;++ let layer = comp.layer(e.layer)?;++ let prop = layer.props.prop("text/sourceText")?;++ // A static Source Text (the normal case) is borrowed in place; only an animated one has to++ // be evaluated into a temporary. Either way only the bounded window is copied.++ if !prop.is_animated() {++ return match &prop.value {++ KV::Text(doc) => {++ let (caret, anchor) = doc_bytes(doc, e.caret, e.anchor);++ ImeSurrounding::from_text(&doc.text, caret, anchor)++ }++ KV::Str(text) => {++ let (caret, anchor) = char_bytes(text, e.caret, e.anchor);++ ImeSurrounding::from_text(text, caret, anchor)++ }++ _ => None,++ };++ }++ match prop.value_at(layer.layer_time(s.time())) {++ KV::Text(doc) => {++ let (caret, anchor) = doc_bytes(&doc, e.caret, e.anchor);++ ImeSurrounding::from_text(&doc.text, caret, anchor)++ }++ KV::Str(text) => {++ let (caret, anchor) = char_bytes(&text, e.caret, e.anchor);++ ImeSurrounding::from_text(&text, caret, anchor)++ }++ _ => None,++ }++}++++/// Byte offsets of two character positions in `text` (clamped to its end), scanning once.++///++/// The second position may be before the first; the returned pair keeps the caller's order.++fn char_bytes(text: &str, first: usize, second: usize) -> (usize, usize) {++ let (lo, hi) = if first <= second { (first, second) } else { (second, first) };++ let mut lo_byte = if lo == 0 { 0 } else { text.len() };++ let mut hi_byte = if hi == 0 { 0 } else { text.len() };++ if hi != 0 {++ for (i, (b, _)) in text.char_indices().enumerate() {++ if i == lo {++ lo_byte = b;++ }++ if i == hi {++ hi_byte = b;++ break;++ }++ }++ }++ if first <= second { (lo_byte, hi_byte) } else { (hi_byte, lo_byte) }++}++++/// Byte offsets of the editor's caret and anchor in a document, in that order.++fn doc_bytes(doc: &TextDoc, caret: usize, anchor: usize) -> (usize, usize) {++ char_bytes(&doc.text, caret, anchor)++}++/// The text layer a text command targets: `layer`, the edited layer, or the selected text layer.fn target(s: &Session, p: &Value, cmd: &str) -> Result<LayerId> {let cid = comp_id(s, p)?;@@@ -78,7 -78,7 +225,7 @@@ fn session_on(s: &mut Session, lid: LaySome(e) if e.layer == lid => e.clone(),_ => {let n = layer_doc(s, lid).map_or(0, |d| d.char_len());-- let e = TextEdit { layer: lid, anchor: n, caret: n, ..Default::default() };++ let e = TextEdit { layer: lid, anchor: n, caret: n, session: next_edit_session(), ..Default::default() };s.state.selected_layers = vec![lid];s.state.text_edit = Some(e.clone());e@@@ -153,7 -153,7 +300,7 @@@ fn edit(s: &mut Session, p: &Value) ->};let created = b_p(p, "created").unwrap_or(false);s.state.selected_layers = vec![lid];-- s.state.text_edit = Some(TextEdit { layer: lid, anchor, caret, created, ..Default::default() });++ s.state.text_edit = Some(TextEdit { layer: lid, anchor, caret, created, session: next_edit_session(), ..Default::default() });s.bump();Ok(state_json(s))}@@@ -314,6 -314,6 +461,78 @@@ fn delete(s: &mut Session, p: &Value) -Ok(state_json(s))}++/// How many whole characters `before_bytes` / `after_bytes` cover around `r`.++///++/// This is the input method's own byte count, as winit reports it: a count that ends inside a++/// UTF-8 character leaves that whole character (stock egui's `surrounding_bytes_to_chars`), so a++/// malformed or platform-specific offset never splits or corrupts the document.++fn surrounding_bytes_as_chars(text: &str, n: usize, r: std::ops::Range<usize>, before_bytes: usize, after_bytes: usize) -> (usize, usize) {++ let r = r.start.min(n)..r.end.min(n);++ let (start_byte, end_byte) = char_bytes(text, r.start, r.end);++ let from = start_byte.saturating_sub(before_bytes);++ let before = text.get(..start_byte).map_or(0, |head| head.char_indices().rev().take_while(|(i, _)| *i >= from).count());++ let after = text.get(end_byte..).map_or(0, |tail| tail.char_indices().take_while(|(i, c)| i.saturating_add(c.len_utf8()) <= after_bytes).count());++ (before.min(r.start), after.min(n.saturating_sub(r.end)))++}++++/// Delete the text an input method marks for replacement around the selection++/// (`DeleteSurrounding`, `DeleteSurroundingBytes`).++///++/// Unlike [`delete`] with an explicit range, the **selection stays**: the characters before its++/// start and after its end are removed in two separate ranges, and the following `Commit`++/// replaces the selected text. `bytes` counts UTF-8 bytes (`before`/`after` are characters++/// otherwise); a count that ends inside a character leaves that character.++///++/// The counts are computed from the one document `edit_doc` already evaluated, so an animated++/// Source Text and a large static document are not copied or evaluated again just to decide what++/// the input method asked to replace.++fn delete_surrounding(s: &mut Session, p: &Value) -> Result<Value> {++ let lid = target(s, p, "text.deleteSurrounding")?;++ // Only an open edit session has a selection to keep: without one there is nothing an input++ // method could be replacing.++ let e = match &s.state.text_edit {++ Some(e) if e.layer == lid => e.clone(),++ _ => return Err(bad("text.deleteSurrounding", "not editing this text layer")),++ };++ let count = |k: &str| p.get(k).and_then(Value::as_u64).map_or(0, |v| usize::try_from(v).unwrap_or(usize::MAX));++ let (before_count, after_count) = (count("before"), count("after"));++ let bytes = b_p(p, "bytes").unwrap_or(false);++ let merge = str_p(p, "merge").map(str::to_string);++ edit_doc(s, "Edit Text", merge.as_deref(), lid, |doc, st| {++ let n = doc.char_len();++ let r = e.range().start.min(n)..e.range().end.min(n);++ let (before, after) = if bytes {++ surrounding_bytes_as_chars(&doc.text, n, r.clone(), before_count, after_count)++ } else {++ (before_count.min(r.start), after_count.min(n.saturating_sub(r.end)))++ };++ let start = r.start.saturating_sub(before);++ let end = r.end.saturating_add(after).min(n);++ if start == r.start && end == r.end {++ // Deletion-only batches with an empty count, or a document with nothing around the++ // selection: no empty undo step.++ return Ok(());++ }++ // The selection keeps its text: remove after it first, then before it, so the two ranges++ // stay valid and the caret/selection shift by the characters before it.++ if end > r.end {++ doc.replace_range(r.end..end, "", None);++ }++ if r.start > start {++ doc.replace_range(start..r.start, "", None);++ }++ if let Some(ed) = st.text_edit.as_mut().filter(|ed| ed.layer == lid) {++ let shift = r.start.saturating_sub(start);++ ed.anchor = ed.anchor.saturating_sub(shift);++ ed.caret = ed.caret.saturating_sub(shift);++ ed.pending = None;++ ed.goal_x = None;++ }++ Ok(())++ })?;++ Ok(state_json(s))++}++/// Selected text (plain) of the session, and its formatted fragment.fn selection_doc(s: &Session) -> Option<TextDoc> {let e = s.state.text_edit.as_ref()?;@@@ -448,18 -448,18 +667,28 @@@ fn paste_formatting(s: &mut Session, pOk(state_json(s))}++/// Give the current editor a fresh replacement epoch after its document/layer was replaced.++pub(crate) fn invalidate_session(s: &mut Session) {++ if let Some(e) = s.state.text_edit.as_mut() {++ e.session = next_edit_session();++ }++}++/// Keep the session valid after undo / external edits: clamp the selection, drop it when the/// layer is gone or not in the active comp.++///++/// Any call to this function follows an undo/redo, a project-level deletion or a rolled-back++/// batch. The document may have been replaced even when the same layer id exists again, so the++/// composition epoch is advanced before the session is kept.pub(crate) fn sanitize(s: &mut Session) {let Some(e) = s.state.text_edit.clone() else { return };match layer_doc(s, e.layer) {Some(d) => {let n = d.char_len();-- if (e.anchor > n || e.caret > n)-- && let Some(ed) = s.state.text_edit.as_mut()-- {++ if let Some(ed) = s.state.text_edit.as_mut() {ed.anchor = ed.anchor.min(n);ed.caret = ed.caret.min(n);++ ed.session = next_edit_session();}}None => s.state.text_edit = None,@@@ -594,6 -594,6 +823,15 @@@ pub fn specs() -> Vec<CommandSpec>editing_or_text_layer,delete),++ cmd!(++ "text.deleteSurrounding",++ "Delete Text Around Selection",++ [],++ None,++ "{layer?, before?, after?, bytes?, merge?} (input-method replacement: the characters before and after the selection are deleted, the selection stays; bytes counts UTF-8 bytes)",++ editing_or_text_layer,++ delete_surrounding++ ),cmd!("edit.pasteTextMatchFormatting","Paste Text and Match Formatting",diff --cc crates/engine/src/lib.rsindex 96b3bf67d,382534a44..d6be19fd8--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@@ -924,6 -957,6 +957,9 @@@ impl Sessionself.state.active_comp = Some(id);self.recall_selection(id);self.state.current_track = None;++ // A text-edit session belongs to the comp that owned it. Switching comps ends it; even++ // a same-numbered layer in the new comp must not inherit the old IME composition.++ self.state.text_edit = None;}/// Leave no comp active, keeping the one that was active in [`EditorState::comp_selections`].@@@ -932,6 -965,6 +968,7 @@@self.state.active_comp = None;self.clear_live_selection();self.state.current_track = None;++ self.state.text_edit = None;}fn remember_selection(&mut self) {diff --cc crates/engine/src/tests_text_edit.rsindex 243a9c676,b4d2ff8c0..a664ca369--- a/crates/engine/src/tests_text_edit.rs+++ b/crates/engine/src/tests_text_edit.rs@@@ -6,7 -6,7 +6,7 @@@ use effectcraft_keyframe::{BaselineOptiuse serde_json::json;use crate::Session;--use crate::commands::text_edit::layer_doc;++use crate::commands::text_edit::{MAX_IME_TEXT_BYTES, ime_surrounding, layer_doc};fn session(text: &str) -> (Session, u64) {let mut s = Session::default();@@@ -200,7 -200,7 +200,48 @@@ fn edit_state_round_trips_through_serdes.execute("text.edit", json!({"layer": t, "select": [1, 2]})).unwrap();let j = serde_json::to_value(&s.state).unwrap();let back: crate::EditorState = serde_json::from_value(j).unwrap();-- assert_eq!(back.text_edit, s.state.text_edit);++ let before = s.state.text_edit.clone().expect("editing");++ let after = back.text_edit.clone().expect("editing");++ assert_eq!((after.layer, after.anchor, after.caret), (before.layer, before.anchor, before.caret));++ assert_ne!(after.session, before.session, "a restored editor gets a process-unique replacement epoch");++ assert_ne!(after.session, 0, "the restored epoch is always a real session token");++}++++#[test]++fn ime_session_epoch_tracks_replaced_text_and_layer_restoration() {++ let (mut s, t) = session("abc");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ let first = s.state.text_edit.as_ref().unwrap().session;++++ // Replacing Source Text is a new document even though the layer id stays.++ s.execute("layer.setText", json!({"layer": t, "text": "replaced"})).unwrap();++ let replaced = s.state.text_edit.as_ref().unwrap().session;++ assert_ne!(replaced, first, "layer.setText starts a new IME epoch");++++ // Undo restores another document: it must not revive the token from before either edit.++ s.execute("edit.undo", json!({})).unwrap();++ let undone = s.state.text_edit.as_ref().unwrap().session;++ assert_ne!(undone, replaced);++ assert_ne!(undone, first);++++ // Clear + immediate undo in the same command sequence: the layer is gone long enough to++ // end the session, and the restored layer cannot inherit a composition.++ s.execute("text.edit", json!({"layer": t})).unwrap();++ s.execute("edit.clear", json!({"layers": [t]})).unwrap();++ assert!(s.state.text_edit.is_none(), "clearing the edited layer ends the session");++ s.execute("edit.undo", json!({})).unwrap();++ assert!(s.state.text_edit.is_none(), "undo does not recreate the old composition session");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ assert_ne!(s.state.text_edit.as_ref().unwrap().session, first);++}++++#[test]++fn ime_session_does_not_cross_a_composition_switch() {++ let (mut s, t) = session("abc");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ let other = s.execute("comp.new", json!({"name": "Other", "width": 320, "height": 180, "duration": 2})).unwrap()["comp"].as_u64().unwrap();++ s.execute("comp.open", json!({"comp": other})).unwrap();++ assert!(s.state.text_edit.is_none(), "the old comp's editor is not reused in another comp");}#[test]@@@ -392,3 -392,38 +433,161 @@@ fn set_text_schema_accepts_every_opentys.execute_checked("layer.setText", json!({"layer": t, "discretionaryLigatures": true, "ss02": true, "ss20": true})).unwrap();assert!(doc(&s, t).style_at(0).opentype.stylistic_set(20));}+++/// Incoming IME replacement (stock `DeleteSurrounding` / the fork's `DeleteSurroundingBytes`):++/// the characters around the selection go, the selected text stays for the following commit, and++/// a byte count that ends inside a UTF-8 character leaves that character.++#[test]++fn ime_replacement_keeps_the_selection_and_never_splits_a_character() {++ let (mut s, t) = session("abcdef");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ s.execute("text.setSelection", json!({"start": 1, "end": 4})).unwrap();++ // One character before "bcd" and everything after it: the selection survives for the commit.++ s.execute("text.deleteSurrounding", json!({"before": 1, "after": 99, "merge": "typing-0"})).unwrap();++ assert_eq!(doc(&s, t).text, "bcd");++ assert_eq!(sel(&s), (0, 3), "the selection is kept for the commit that follows");++ s.execute("text.insert", json!({"text": "X", "merge": "typing-0"})).unwrap();++ assert_eq!(doc(&s, t).text, "X");++ assert_eq!(sel(&s), (1, 1));++ s.execute("edit.undo", json!({})).unwrap();++ assert_eq!(doc(&s, t).text, "abcdef", "the surrounding delete and its commit are one undo step");++ // An empty count is a no-op (deletion-only batches, empty commits), never an undo step.++ s.execute("edit.redo", json!({})).unwrap();++ s.execute("text.setSelection", json!({"start": 0, "end": 1})).unwrap();++ s.execute("text.deleteSurrounding", json!({"before": 0, "after": 0})).unwrap();++ assert_eq!(doc(&s, t).text, "X");++++ // Byte counts end inside a character: it stays whole (never a split UTF-8 sequence).++ let (mut s, t) = session("A😀B");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ s.execute("text.setSelection", json!({"start": 3, "end": 3})).unwrap();++ s.execute("text.deleteSurrounding", json!({"before": 2, "after": 0, "bytes": true})).unwrap();++ assert_eq!(doc(&s, t).text, "A😀", "B is whole, the emoji only partly covered, so both are not one range");++ s.execute("text.setSelection", json!({"start": 2, "end": 2})).unwrap();++ s.execute("text.deleteSurrounding", json!({"before": 4, "after": 0, "bytes": true})).unwrap();++ assert_eq!(doc(&s, t).text, "A", "four bytes cover the whole emoji");++++ // A combining mark is one character of two bytes: one byte of it removes nothing.++ let (mut s, t) = session("e\u{301}");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ s.execute("text.setSelection", json!({"start": 2, "end": 2})).unwrap();++ s.execute("text.deleteSurrounding", json!({"before": 1, "after": 0, "bytes": true})).unwrap();++ assert_eq!(doc(&s, t).text, "e\u{301}", "a partial combining mark stays");++ s.execute("text.deleteSurrounding", json!({"before": 2, "after": 0, "bytes": true})).unwrap();++ assert_eq!(doc(&s, t).text, "e", "the whole combining mark is one character");++}++++/// The outgoing IME query: logical committed text (the pre-edit never enters the model), UTF-8++/// byte offsets in either selection direction, a bounded window, and an explicit unavailable++/// answer for a selection that cannot be represented.++#[test]++fn ime_surrounding_maps_characters_to_bytes_and_preserves_direction() {++ let (mut s, t) = session("café😀");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ s.execute("text.setSelection", json!({"anchor": 2, "caret": 5})).unwrap();++ let w = ime_surrounding(&s).expect("an available document");++ assert_eq!(w.text, "café😀");++ assert_eq!((w.cursor, w.anchor), (9, 2), "the caret is six characters in, after the emoji; the anchor stays at byte 2");++ assert_eq!(&w.text[w.cursor..], "");++ assert_eq!(&w.text[..w.anchor], "ca");++++ // Reversed: the caret stays the primary end and the anchor the other one.++ s.execute("text.setSelection", json!({"anchor": 5, "caret": 2})).unwrap();++ let reversed = ime_surrounding(&s).expect("an available document");++ assert_eq!((reversed.cursor, reversed.anchor), (2, 9), "cursor > anchor is preserved after the conversion");++ assert_eq!(&reversed.text[reversed.cursor..reversed.anchor], "fé😀");++++ // An available empty document is not the unavailable state.++ let (mut s, t) = session("");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ let empty = ime_surrounding(&s).expect("empty text is available");++ assert_eq!((empty.text.as_str(), empty.cursor, empty.anchor), ("", 0, 0));++++ // No edit session: unavailable, not an empty document.++ let (s, _) = session("text");++ assert!(ime_surrounding(&s).is_none());++}++++#[test]++fn ime_surrounding_is_bounded_and_refuses_a_too_wide_selection() {++ // A long line: the query copies only a window around the caret, never the document.++ let text = "a".repeat(20_000);++ let (mut s, t) = session(&text);++ s.execute("text.edit", json!({"layer": t, "caret": 10_000})).unwrap();++ let w = ime_surrounding(&s).expect("a collapsed caret fits");++ assert!(w.text.len() <= MAX_IME_TEXT_BYTES, "the payload is bounded");++ assert!(w.text.len() > 1000, "the caret keeps a useful amount of context");++ assert!(w.text.is_char_boundary(w.cursor) && w.text.is_char_boundary(w.anchor));++ assert_eq!(w.cursor, w.anchor);++++ // A selection wider than the protocol limit is unavailable, not a truncated one.++ s.execute("text.setSelection", json!({"start": 0, "end": 20_000})).unwrap();++ assert!(ime_surrounding(&s).is_none(), "a too-wide selection is unavailable");++++ // Multi-byte text at the window boundary is never split, and offsets stay on boundaries.++ let text = "é".repeat(5_000);++ let (mut s, t) = session(&text);++ s.execute("text.edit", json!({"layer": t, "caret": 2_500})).unwrap();++ let w = ime_surrounding(&s).expect("a collapsed caret fits");++ assert!(w.text.len() <= MAX_IME_TEXT_BYTES);++ assert!(w.text.is_char_boundary(w.cursor));++ assert_eq!(&w.text[w.cursor..w.cursor + "é".len()], "é");++}++++/// A reversed selection survives a byte-count deletion: both endpoints shift by the removed++/// characters before the selection, its direction stays reversed, and partial characters on++/// either side stay whole.++#[test]++fn ime_byte_deletion_keeps_a_reversed_selection_direction() {++ let (mut s, t) = session("😀ab😀");++ s.execute("text.edit", json!({"layer": t})).unwrap();++ s.execute("text.setSelection", json!({"anchor": 3, "caret": 1})).unwrap();++ let (anchor, caret) = sel(&s);++ assert_eq!((anchor, caret), (3, 1), "reversed before the replacement");++++ // Three bytes cover only part of either four-byte emoji: neither is split or removed.++ s.execute("text.deleteSurrounding", json!({"before": 3, "after": 3, "bytes": true})).unwrap();++ assert_eq!(doc(&s, t).text, "😀ab😀");++++ // Four bytes cover each whole emoji: the selection text stays, shifted, still reversed.++ s.execute("text.deleteSurrounding", json!({"before": 4, "after": 4, "bytes": true})).unwrap();++ assert_eq!(doc(&s, t).text, "ab");++ assert_eq!(sel(&s), (2, 0), "the anchor stays after the caret");++ let w = ime_surrounding(&s).expect("available");++ assert_eq!((w.text.as_str(), w.cursor, w.anchor), ("ab", 0, 2), "the outgoing offsets keep the direction");++}+++ #[test]+ fn deselect_all_ends_the_open_edit() {+ let (mut s, t) = session("Hello");+ s.execute("text.edit", json!({"layer": t, "caret": 5})).unwrap();+ s.execute("text.insert", json!({"text": "!"})).unwrap();+ assert_eq!(doc(&s, t).text, "Hello!");+ s.execute("edit.deselectAll", json!({})).unwrap();+ assert!(s.state.text_edit.is_none(), "Deselect All ends the open text edit on every route");+ assert!(s.state.selected_layers.is_empty(), "and leaves nothing selected");+ assert_eq!(doc(&s, t).text, "Hello!", "the text stays committed");+ // Ending an edit is no undoable step of its own (as with text.endEdit): undo takes+ // the typed text, it does not reopen the edit.+ s.execute("edit.undo", json!({})).unwrap();+ assert_eq!(doc(&s, t).text, "Hello", "undo reverts the typed text, not the deselection");+ assert!(s.state.text_edit.is_none(), "undo does not reopen the edit");+ }++ #[test]+ fn deselect_all_discards_an_empty_type_tool_layer() {+ let (mut s, _keep) = session("Hello");+ let new = s.execute("layer.newText", json!({"text": "", "position": [80.0, 80.0], "edit": true})).unwrap()["layer"].as_u64().unwrap();+ assert!(+ s.state.text_edit.as_ref().is_some_and(|e| e.created && e.layer == effectcraft_project::LayerId(new)),+ "the Type tool opens the edit on its new, empty layer"+ );+ let count = |s: &Session| s.active_comp().map_or(0, |c| c.layers.len());+ let before = count(&s);+ s.execute("edit.deselectAll", json!({})).unwrap();+ assert!(s.state.text_edit.is_none());+ assert!(s.state.selected_layers.is_empty());+ assert_eq!(count(&s), before - 1, "a Type-tool layer left empty is removed, as text.endEdit does");+ s.execute("edit.undo", json!({})).unwrap();+ assert_eq!(count(&s), before, "that removal is one undo step of its own, as on text.endEdit");+ }diff --cc crates/ui-egui/Cargo.tomlindex 549e3ecbc,549e3ecbc..009a2c6e6--- a/crates/ui-egui/Cargo.toml+++ b/crates/ui-egui/Cargo.toml@@@ -22,7 -22,7 +22,7 @@@ effectcraft-render = { workspace = trueffectcraft-engine = { workspace = true }effectcraft-gpu = { workspace = true }egui = { workspace = true }--eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] }++eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "clipboard"] }serde = { workspace = true }serde_json = { workspace = true }log = { workspace = true }@@@ -36,6 -36,6 +36,9 @@@ image = { workspace = truesys-locale = { workspace = true }[dev-dependencies]++# Fonts for kittest: the workspace `egui` features are what test roots resolve, but stating them++# here documents the requirement (kittest's own dev-dependencies do not propagate to consumers).++egui = { workspace = true, features = ["default_fonts", "monochrome_emoji_fonts"] }egui_kittest = { workspace = true, features = ["eframe", "wgpu"] }pollster = "0.4"effectcraft-host = { workspace = true }diff --cc crates/ui-egui/src/color_picker.rsindex efaae6d7f,efaae6d7f..847e1e541--- a/crates/ui-egui/src/color_picker.rs+++ b/crates/ui-egui/src/color_picker.rs@@@ -16,7 -16,7 +16,7 @@@ use crate::widgets::{open_popup, popup_/// user picks a colour.pub fn srgb_color_button(ui: &mut Ui, c: &mut [f32; 3]) -> Response {let (rect, mut resp) = ui.allocate_exact_size(ui.spacing().interact_size, Sense::click());-- resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::ColorButton, ui.is_enabled(), srgb_hex(*c)));++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::ColorWell, ui.is_enabled(), srgb_hex(*c)));let stroke = if resp.hovered() { ui.visuals().widgets.hovered.fg_stroke } else { ui.visuals().widgets.inactive.bg_stroke };ui.painter().rect_filled(rect, 2.0, srgb32(*c));ui.painter().rect_stroke(rect, 2.0, stroke, StrokeKind::Inside);@@@ -78,7 -78,7 +78,7 @@@ pub fn color_popup(ui: &mut Ui, id: egu}fn open_pass_id() -> egui::Id {-- egui::Id::new("color-picker-open-pass")++ egui::Id::unique("color-picker-open-pass")}/// A colour picker is open: it was drawn, and stayed open, in this pass or the last one (so one@@@ -183,7 -183,7 +183,7 @@@ fn color_picker(ui: &mut Ui, id: egui::None => Pick { hsv: rgb_to_hsv(*c), rgb: *c },};// The slider's channel is remembered between pickers, as After Effects does.-- let chan_id = egui::Id::new("color-picker-channel");++ let chan_id = egui::Id::unique("color-picker-channel");let mut chan = ui.data(|d| d.get_temp::<usize>(chan_id)).and_then(|i| CHANS.get(i).map(|c| c.0)).unwrap_or(Chan::H);let before = pick;let mut out = Outcome::default();@@@ -268,7 -268,7 +268,7 @@@ const CHANS: [(Chan, &str); 6] = [(Chan/// Drag or click on the square to set its two channels.fn square(ui: &mut Ui, chan: Chan, pick: &mut Pick) {let (rect, resp) = ui.allocate_exact_size(vec2(SQUARE, SQUARE), Sense::click_and_drag());-- resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Slider, true, "Color field"));++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Slider, true, "Color field"));let (x, y) = chan.square();if let Some(p) = resp.interact_pointer_pos().filter(|_| resp.is_pointer_button_down_on()) {*pick = pick.at(chan, (p.x - rect.min.x) / rect.width(), 1.0 - (p.y - rect.min.y) / rect.height());@@@ -297,7 -297,7 +297,7 @@@/// Drag or click on the slider to set `chan`; arrows on both sides mark its value.fn slider(ui: &mut Ui, chan: Chan, pick: &mut Pick) {let (outer, resp) = ui.allocate_exact_size(vec2(SLIDER_W + 12.0, SQUARE), Sense::click_and_drag());-- resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Slider, true, "Color slider"));++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Slider, true, "Color slider"));let bar = Rect::from_center_size(outer.center(), vec2(SLIDER_W, SQUARE));if let Some(p) = resp.interact_pointer_pos().filter(|_| resp.is_pointer_button_down_on()) {*pick = pick.set(chan, 1.0 - (p.y - bar.min.y) / bar.height());@@@ -332,10 -332,10 +332,10 @@@fn swatches(ui: &mut Ui, new: [f32; 3], original: [f32; 3]) -> bool {let (rect, _) = ui.allocate_exact_size(vec2(64.0, 64.0), Sense::hover());let (top, bottom) = rect.split_top_bottom_at_fraction(0.5);-- let new_resp = ui.interact(top, ui.id().with("new-swatch"), Sense::hover());-- new_resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Other, true, "New color"));-- let old = ui.interact(bottom, ui.id().with("original-swatch"), Sense::click()).on_hover_text(tr("Original color: click to go back to it"));-- old.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, "Original color"));++ let new_resp = ui.interact(top, ui.scope_id().with("new-swatch"), Sense::hover());++ new_resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Unknown, true, "New color"));++ let old = ui.interact(bottom, ui.scope_id().with("original-swatch"), Sense::click()).on_hover_text(tr("Original color: click to go back to it"));++ old.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, "Original color"));ui.painter().rect_filled(top, 0.0, srgb32(new));ui.painter().rect_filled(bottom, 0.0, srgb32(original));ui.painter().rect_stroke(rect, 0.0, ui.visuals().widgets.inactive.bg_stroke, StrokeKind::Outside);diff --cc crates/ui-egui/src/control.rsindex 7fe382a5d,7fe382a5d..fa31886cc--- a/crates/ui-egui/src/control.rs+++ b/crates/ui-egui/src/control.rs@@@ -15,7 -15,7 +15,7 @@@//! - `ui.viewer.locate {x, y}`: screen point of a comp pixel; `ui.viewer.hit {x, y}`: comp pixel at a screen point//! - `ui.timeline.locate {layer, time?}`: screen point of a layer bar (at a comp time)//! - `ui.playback {action: play|stop|toggle}`--//! - `ui.screenshot {path?, panel?, id?}`: PNG of the window (or one panel / element)++//! - `ui.screenshot {path?, panel?, id?}`: PNG of the window (or one panel / element, resolved when the capture is issued)//! - `render.frame {comp?, time?, max_side?, path?, base64?}`: PNG of a comp frame rendered by the session//! - `ui.resize {width, height}` / `ui.focus` / `app.quit {force?}` (a modified project asks to save first unless `force`)//!@@@ -53,7 -53,7 +53,8 @@@ pub enum OutcomeAfterInput,Screenshot {path: Option<String>,-- crop: Option<[f32; 4]>,++ /// The panel/element identity to capture, resolved again when the capture is issued.++ target: crate::ShotTarget,},/// Reply once background jobs end (a `wait: true` command whose job runs in a worker).AwaitJobs(JobWaiter),@@@ -169,7 -169,7 +170,7 @@@ fn point(app: &EffectcraftApp, p: &ValuOk(egui::pos2(x as f32, y as f32))}--pub fn handle(app: &mut EffectcraftApp, ctx: &egui::Context, req: &ControlRequest) -> Outcome {++pub fn handle(app: &mut EffectcraftApp, ctx: &egui::Context, req: &ControlRequest, now: f64) -> Outcome {let p = &req.params;let s = |k: &str| p.get(k).and_then(Value::as_str);match req.method.as_str() {@@@ -402,6 -402,6 +403,7 @@@delta: egui::vec2(dx, dy),modifiers: modifiers(p),phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,});app.synthetic.push(egui::Event::PointerButton {pos: egui::pos2(-100.0, -100.0),@@@ -454,7 -454,7 +456,6 @@@}}"ui.playback" => {-- let now = ctx.input(|i| i.time);match s("action").unwrap_or("toggle") {"play" => app.play(now),"stop" => app.stop(),@@@ -466,11 -466,11 +467,33 @@@)}"ui.screenshot" => {-- let crop = s("panel").and_then(PanelKind::from_name).and_then(|pk| app.auto.find(&format!("panel.{}", pk.id())).map(|e| e.rect));-- let crop = crop.or_else(|| s("id").and_then(|id| app.auto.find(id).map(|e| e.rect)));++ // The panel/element is an identity, not a rectangle: it is resolved when the capture++ // is issued (after the UI settles), so a panel that moves meanwhile is not cropped++ // with its old rectangle.++ let target = match s("panel") {++ Some(name) => match PanelKind::from_name(name) {++ Some(pk) => crate::ShotTarget::Panel(pk),++ None => return err(format!("unknown panel `{name}`")),++ },++ None => s("id").map_or(crate::ShotTarget::Window, |id| crate::ShotTarget::Id(id.to_string())),++ };++ // Asking for one element and silently capturing the whole window would hide a missing++ // panel: wait for it like any other not-yet-laid-out control.++ let missing = match &target {++ crate::ShotTarget::Panel(pk) => app.auto.find(&format!("panel.{}", pk.id())).is_none(),++ crate::ShotTarget::Id(id) => app.auto.find(id).is_none(),++ crate::ShotTarget::Window | crate::ShotTarget::Rect(_) => false,++ };++ if missing {++ return Outcome::Retry(match &target {++ crate::ShotTarget::Panel(pk) => format!("the {} panel is not on screen", pk.title()),++ crate::ShotTarget::Id(id) => format!("no element `{id}` is on screen"),++ crate::ShotTarget::Window | crate::ShotTarget::Rect(_) => "the element is not on screen".into(),++ });++ }// Bring the window on screen so a frame is presented, without taking keyboard focus.app.raise_for_control(ctx);-- Outcome::Screenshot { path: s("path").map(str::to_string), crop }++ Outcome::Screenshot { path: s("path").map(str::to_string), target }}"render.frame" => render_frame(app, p),"ui.resize" => {@@@ -555,7 -555,7 +578,8 @@@ pub fn base64(data: &[u8]) -> String}pub fn inspect(app: &EffectcraftApp, ctx: &egui::Context) -> Value {-- let size = ctx.content_rect().size();++ // A logic-only tick refreshes the viewport information but not `InputState`'s screen rect.++ let size = ctx.input(|i| i.viewport().inner_rect).map_or_else(|| ctx.content_rect().size(), |r| r.size());let keyboard_focus = ctx.memory(|m| m.focused()).map(|id| {let response = ctx.read_response(id);let rect = response.as_ref().map(|r| [r.rect.min.x, r.rect.min.y, r.rect.width(), r.rect.height()]);@@@ -588,7 -588,7 +612,9 @@@"selectedKeys": app.session.state.selected_keys.len(),"elements": app.auto.previous.len(),"keyboardFocus": keyboard_focus,-- "windowFocused": ctx.input(|i| i.focused),++ // Fresh viewport focus only: in a logic-only tick `InputState::focused` still holds the++ // previous full pass's value, and the app field is that same fresh value.++ "windowFocused": ctx.input(|i| i.viewport().focused).unwrap_or(app.focused),"workspaceStorageError": app.workspace_store.error,"dialog": app.dialog.map(|d| format!("{d:?}")),"renderMs": app.frames.last_ms.lock().map(|v| *v).unwrap_or(0.0),@@@ -596,21 -596,21 +622,37 @@@}/// Save a screenshot (optionally cropped to a rect in points) as PNG; returns the reply JSON.--pub fn save_screenshot(ctx: &egui::Context, image: &egui::ColorImage, path: Option<&str>, crop: Option<[f32; 4]>) -> Value {-- let ppp = ctx.pixels_per_point();++///++/// `crop` is relative to the image's own origin (the issued surface's top-left corner), and++/// `scale` is the returned image's pixels per point in x and y, derived from the image size and++/// the issued rect. The image can be smaller than requested when the adapter-limit fit (E2)++/// applies, so its own scale — never the issued or current pixels-per-point — cuts the crop:++/// any other scale reads a shifted or rescaled region.++pub fn save_screenshot(image: &egui::ColorImage, path: Option<&str>, crop: Option<[f32; 4]>, scale: [f64; 2]) -> Value {let [w, h] = image.size;++ let [sx, sy] = scale;++ if w == 0 || h == 0 || !sx.is_finite() || sx <= 0.0 || !sy.is_finite() || sy <= 0.0 {++ return json!({"ok": false, "error": "the screenshot has no pixels to save"});++ }++ if image.pixels.len() != w.saturating_mul(h) {++ return json!({"ok": false, "error": "the screenshot's pixels do not match its dimensions"});++ }++ let px = |v: f64, s: f64| (v * s).max(0.0) as usize;let (x0, y0, cw, ch) = match crop {-- Some([x, y, cw, ch]) => {-- let x0 = ((x * ppp) as usize).min(w);-- let y0 = ((y * ppp) as usize).min(h);-- (x0, y0, ((cw * ppp) as usize).min(w - x0), ((ch * ppp) as usize).min(h - y0))++ Some([x, y, cw, ch]) if [x, y, cw, ch].iter().all(|v| v.is_finite()) => {++ let x0 = px(x as f64, sx).min(w);++ let y0 = px(y as f64, sy).min(h);++ (x0, y0, px(cw as f64, sx).min(w - x0), px(ch as f64, sy).min(h - y0))}++ Some(_) => return json!({"ok": false, "error": "the screenshot crop is not a finite rectangle"}),None => (0, 0, w, h),};-- let mut rgba = Vec::with_capacity(cw * ch * 4);++ let mut rgba = Vec::with_capacity(cw.saturating_mul(ch).saturating_mul(4));for y in y0..y0 + ch {for x in x0..x0 + cw {-- let c = image.pixels[y * w + x];++ let Some(c) = image.pixels.get(y * w + x) else {++ return json!({"ok": false, "error": "the screenshot's pixels do not match its dimensions"});++ };rgba.extend_from_slice(&[c.r(), c.g(), c.b(), 255]);}}diff --cc crates/ui-egui/src/credits.rsindex 77357e876,77357e876..e69c99ce3--- a/crates/ui-egui/src/credits.rs+++ b/crates/ui-egui/src/credits.rs@@@ -241,7 -241,7 +241,7 @@@ impl Default for View/// About ▸ Contributors: a name toggle, a sort, and the list as a grab bag or a table. Every/// control registers an automation id under `about.credits.`.pub fn contributors_ui(ui: &mut egui::Ui, auto: &mut Registry) {-- let id = egui::Id::new("credits_view");++ let id = egui::Id::unique("credits_view");let mut v = ui.data_mut(|d| d.get_temp::<View>(id)).unwrap_or_default();ui.horizontal_wrapped(|ui| {ui.label(tr("Show"));diff --cc crates/ui-egui/src/dock.rsindex ae66eaebe,ae66eaebe..3dbc83714--- a/crates/ui-egui/src/dock.rs+++ b/crates/ui-egui/src/dock.rs@@@ -1057,7 -1057,7 +1057,7 @@@ fn resize_handle(gap: Rect, vertical: blet axis = if vertical { SplitAxis::Vertical } else { SplitAxis::Horizontal };let style = ResizeHandleStyle { hovered: t.focus.gamma_multiply(0.4), dragged: t.focus.gamma_multiply(0.9), focused: t.focus };let label = if vertical { crate::i18n::tr("Height:") } else { crate::i18n::tr("Width:") };-- ResizeHandle::new(egui::Id::new(("dock-gutter", path.to_string())), axis, gap, label, style)++ ResizeHandle::new(egui::Id::unique(("dock-gutter", path.to_string())), axis, gap, label, style)}/// The least body height of an open stacked panel (when the stack has room for it).@@@ -1224,7 -1224,7 +1224,7 @@@ pub fn draw_group_chrome(ui: &mut egui:let w = galley.size().x + 16.0 + menu_w + deco_w;if x + w > strip.max.x - 20.0 && k > ai {let r = Rect::from_min_size(pos2(strip.max.x - 22.0, strip.min.y + 6.0), vec2(18.0, 20.0));-- let resp = ui.interact(r, egui::Id::new(("tab-overflow", g.path.clone())), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("tab-overflow", g.path.clone())), Sense::click());icons::paint(&painter, r.shrink(4.0).translate(vec2(-2.0, 0.0)), Icon::ChevronRight, t.tab_text);icons::paint(&painter, r.shrink(4.0).translate(vec2(2.0, 0.0)), Icon::ChevronRight, t.tab_text);crate::widgets::focus_outline(ui, &resp, t);@@@ -1241,7 -1241,7 +1241,7 @@@Some((_, r)) => *r = r.union(tab),None => out.tabs.push((*p, tab)),}-- let resp = ui.interact(tab, egui::Id::new(("tab", g.path.clone(), k)), Sense::click_and_drag());++ let resp = ui.interact(tab, egui::Id::unique(("tab", g.path.clone(), k)), Sense::click_and_drag());if resp.drag_started() {out.actions.push(DockAction::BeginDrag(*p));}@@@ -1259,7 -1259,7 +1259,7 @@@let mut dx = tab.min.x + 6.0;if is_active && d.viewer {let cr = Rect::from_center_size(pos2(dx + 5.0, text_y), vec2(10.0, 10.0));-- let cresp = ui.interact(cr.expand(2.0), egui::Id::new(("tab-close", g.path.clone(), k)), Sense::click());++ let cresp = ui.interact(cr.expand(2.0), egui::Id::unique(("tab-close", g.path.clone(), k)), Sense::click());let cc = if cresp.hovered() { t.tab_text_active } else { t.tab_text };let kk = 3.5;painter.line_segment([cr.center() + vec2(-kk, -kk), cr.center() + vec2(kk, kk)], Stroke::new(1.2, cc));@@@ -1277,7 -1277,7 +1277,7 @@@label_x = dx;if lock {let lr = Rect::from_center_size(pos2(dx + 6.0, text_y), vec2(12.0, 12.0));-- let lresp = ui.interact(lr.expand(2.0), egui::Id::new(("tab-lock", g.path.clone(), k)), Sense::click());++ let lresp = ui.interact(lr.expand(2.0), egui::Id::unique(("tab-lock", g.path.clone(), k)), Sense::click());let lc = if d.locked {t.tab_text_active} else if lresp.hovered() {@@@ -1299,7 -1299,7 +1299,7 @@@painter.galley_with_override_text_color(pos2(label_x, text_y - galley.size().y / 2.0), galley, col);if is_active {let mr = Rect::from_center_size(pos2(label_x + label_w + 12.0, text_y), vec2(12.0, 10.0));-- let mresp = ui.interact(mr.expand(3.0), egui::Id::new(("tab-menu", g.path.clone())), Sense::click());++ let mresp = ui.interact(mr.expand(3.0), egui::Id::unique(("tab-menu", g.path.clone())), Sense::click());reg.add_response(&format!("panel.menu.{}", p.id()), &mresp, "panel menu");let mc = if mresp.hovered() { t.tab_text_active } else { t.tab_text };for dy in [-3.5, 0.0, 3.5] {@@@ -1335,7 -1335,7 +1335,7 @@@{let rest = Rect::from_min_max(pos2((x - 8.0).max(strip.min.x), strip.min.y), strip.max);if rest.width() > 0.0 {-- let resp = ui.interact(rest, egui::Id::new(("tab-rest", g.path.clone())), Sense::click());++ let resp = ui.interact(rest, egui::Id::unique(("tab-rest", g.path.clone())), Sense::click());reg.add(&format!("panel.header.{}", e.panel.id()), rest, &e.label);if resp.clicked() {out.actions.push(DockAction::ToggleStacked(e.panel));diff --cc crates/ui-egui/src/dock_ui.rsindex ba9e9e6b9,ba9e9e6b9..559cb2191--- a/crates/ui-egui/src/dock_ui.rs+++ b/crates/ui-egui/src/dock_ui.rs@@@ -13,7 -13,7 +13,7 @@@ use crate::{EffectcraftApp, panels}use craft_ui::docking::{Action, DropTarget, resolve_drop};fn drag_id() -> egui::Id {-- egui::Id::new("dock-tab-drag")++ egui::Id::unique("dock-tab-drag")}impl EffectcraftApp {@@@ -183,6 -183,6 +183,51 @@@}}++ /// Apply one action after the panel bodies have drawn. A panel-window pass runs this at++ /// its own pass end so the final IME descriptor sees the post-action state.++ fn handle_dock_action(&mut self, ctx: &egui::Context, action: DockAction) {++ match action {++ DockAction::Activate(p) => {++ let _ = self.dock_command(ctx, Action::Activate { panel: p });++ }++ DockAction::ToggleStacked(p) => {++ let _ = self.dock_command(ctx, Action::SetStackOpen { panel: p, open: !self.ui.dock.is_visible(p) });++ }++ DockAction::Focus(p) => {++ self.ui.focused = p;++ panels::viewer_text::panel_clicked(self, ctx, p);++ // A click in (or on the tab of) another Composition viewer makes it active.++ if let Some(id) = panels::viewers::id_of(p) {++ panels::viewers::activate(self, ctx, id);++ }++ }++ DockAction::Close(p) => {++ let _ = self.dock_command(ctx, Action::Close { panel: p });++ }++ DockAction::PanelMenu(p, pos) => {++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("panel-menu"), (p, pos)));++ }++ DockAction::BeginDrag(p) => ctx.data_mut(|d| {++ d.insert_temp(drag_id(), p);++ }),++ DockAction::ToggleLock(p) => {++ if !self.ui.locked_tabs.remove(&p.id()) {++ self.ui.locked_tabs.insert(p.id().to_string());++ }++ }++ // The Timeline's comp tabs: show that comp / close its Timeline.++ DockAction::ActivateDoc(p, id) => {++ let _ = self.dock_command(ctx, Action::Activate { panel: p });++ if self.session.state.active_comp.map(|c| c.0) != Some(id) {++ let _ = crate::menus::invoke(self, ctx, "comp.open", serde_json::json!({"comp": id}));++ }++ }++ DockAction::CloseDoc(_, id) => {++ let _ = crate::menus::invoke(self, ctx, "comp.close", serde_json::json!({"comp": id}));++ }++ }++ }++pub(crate) fn dock_area(&mut self, ui: &mut egui::Ui, body: Rect) {let t = self.tokens;let ctx = ui.ctx().clone();@@@ -244,18 -244,18 +289,28 @@@.get(*index).and_then(|group| group.panels.first()).and_then(|panel| {-- let id = egui::Id::new(("floating-panel", panel.id()));++ let id = egui::Id::unique(("floating-panel", panel.id()));layers.iter().position(|layer| layer.id == id)}).unwrap_or(usize::MAX)});-- // A native window is kept only for a panel that still floats.++ // A native window is kept only for a panel that still floats. A native viewport that++ // goes away releases its IME context: its composition must not reappear elsewhere.let ui_state = &mut self.ui;++ let gone: Vec<egui::ViewportId> = ui_state++ .panel_windows++ .iter()++ .filter(|w| !ui_state.floating.iter().any(|group| group.panels.contains(&w.panel)))++ .map(|w| panel_window_id(w.panel))++ .collect();ui_state.panel_windows.retain(|w| ui_state.floating.iter().any(|group| group.panels.contains(&w.panel)));++ for viewport in gone {++ panels::viewer_text::end_viewport(self, &ctx, viewport);++ }for i in floating_order {// Groups in their own native window take no tab drops from the main window.if let Some(window) = self.ui.floating.get(i).and_then(|group| self.panel_window_of(&group.panels)) {-- self.panel_window(&ctx, i, window, &info, &mut actions);++ self.panel_window(&ctx, i, window, &info);continue;}if let Some((g, tabs)) = self.floating_window(&ctx, i, &info, &mut actions) {@@@ -267,46 -267,46 +322,7 @@@let _ = self.dock_command(&ctx, action);}for a in actions {-- match a {-- DockAction::Activate(p) => {-- let _ = self.dock_command(&ctx, Action::Activate { panel: p });-- }-- DockAction::ToggleStacked(p) => {-- let _ = self.dock_command(&ctx, Action::SetStackOpen { panel: p, open: !self.ui.dock.is_visible(p) });-- }-- DockAction::Focus(p) => {-- self.ui.focused = p;-- panels::viewer_text::panel_clicked(self, &ctx, p);-- // A click in (or on the tab of) another Composition viewer makes it active.-- if let Some(id) = panels::viewers::id_of(p) {-- panels::viewers::activate(self, &ctx, id);-- }-- }-- DockAction::Close(p) => {-- let _ = self.dock_command(&ctx, Action::Close { panel: p });-- }-- DockAction::PanelMenu(p, pos) => {-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("panel-menu"), (p, pos)));-- }-- DockAction::BeginDrag(p) => ctx.data_mut(|d| {-- d.insert_temp(drag_id(), p);-- }),-- DockAction::ToggleLock(p) => {-- if !self.ui.locked_tabs.remove(&p.id()) {-- self.ui.locked_tabs.insert(p.id().to_string());-- }-- }-- // The Timeline's comp tabs: show that comp / close its Timeline.-- DockAction::ActivateDoc(p, id) => {-- let _ = self.dock_command(&ctx, Action::Activate { panel: p });-- if self.session.state.active_comp.map(|c| c.0) != Some(id) {-- let _ = crate::menus::invoke(self, &ctx, "comp.open", serde_json::json!({"comp": id}));-- }-- }-- DockAction::CloseDoc(_, id) => {-- let _ = crate::menus::invoke(self, &ctx, "comp.close", serde_json::json!({"comp": id}));-- }-- }++ self.handle_dock_action(&ctx, a);}self.tab_drag(&ctx, &groups, &float_groups, &tab_rects);panels::panel_menu_popup(self, ui);@@@ -330,7 -330,7 +346,7 @@@(screen.min.x - rect.min.x).max(0.0) + (screen.max.x - 40.0 - rect.min.x).min(0.0),(screen.min.y - rect.min.y).max(0.0) + (screen.max.y - 30.0 - rect.min.y).min(0.0),));-- let id = egui::Id::new(("floating-panel", f.panels.first().map(|p| p.id()).unwrap_or_default()));++ let id = egui::Id::unique(("floating-panel", f.panels.first().map(|p| p.id()).unwrap_or_default()));let mut group = None;// Not constrained to the window: the group is drawn where its rect says (the clamp above// keeps its strip reachable), so it follows the pointer past the window's edges.@@@ -366,7 -366,7 +382,7 @@@// Resize from the corner.let grip = Rect::from_min_max(r.max - vec2(14.0, 14.0), r.max);let rs = ui.interact(grip, id.with("resize"), Sense::click_and_drag());-- rs.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, rs.enabled(), crate::i18n::tr("Resize floating panel")));++ rs.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Splitter, rs.enabled(), crate::i18n::tr("Resize floating panel")));self.auto.add_response(&format!("panel.float.{i}.resize"), &rs, "Resize floating panel");for k in 0..3 {let o = 4.0 + k as f32 * 4.0;@@@ -456,7 -456,7 +472,7 @@@/// One floating group in its own native window: the group's tab strip and active panel fill/// the window. Closing the window brings the group back into the main window.-- fn panel_window(&mut self, ctx: &egui::Context, i: usize, window: PanelWindow, info: &dock::TabInfo, actions: &mut Vec<DockAction>) {++ fn panel_window(&mut self, ctx: &egui::Context, i: usize, window: PanelWindow, info: &dock::TabInfo) {let t = self.tokens;let Some(f) = self.ui.floating.get(i).cloned() else { return };let active = f.active.min(f.panels.len().saturating_sub(1));@@@ -472,8 -472,8 +488,14 @@@.with_min_inner_size(dock::PANEL_WINDOW_MIN);let mut closed = false;let mut placed = None;++ let mut pass_viewport = None;++ let mut actions = Vec::new();ctx.show_viewport_immediate(panel_window_id(window.panel), builder, |ui, class| {++ pass_viewport = Some(ui.ctx().viewport_id());let native = matches!(class, egui::ViewportClass::Immediate | egui::ViewportClass::Deferred);++ if native {++ panels::viewer_text::begin_ui(ui.ctx());++ }egui::CentralPanel::default().frame(egui::Frame::NONE.fill(t.panel_bg)).show(ui, |ui| {let r = ui.max_rect();let g = Group {@@@ -495,6 -495,6 +517,12 @@@panels::panel_menu_popup(self, ui);}});++ // Apply this window's panel/tab actions before publishing its IME descriptor: a++ // click-away or close in the floating panel must own the pass's final output.++ for action in actions.drain(..) {++ self.handle_dock_action(ui.ctx(), action);++ }++ panels::viewer_text::finish_ime(self, ui);// An embedded window (no native windows on this platform) reads the main window's// input: its close request and place aren't this window's.if native {@@@ -509,6 -509,6 +537,10 @@@});if closed {self.ui.panel_windows.retain(|w| !f.panels.contains(&w.panel));++ if let Some(viewport) = pass_viewport {++ panels::viewer_text::end_viewport(self, ctx, viewport);++ }++ panels::viewer_text::end_viewport(self, ctx, panel_window_id(window.panel));ctx.data_mut(|d| d.remove::<[f32; 4]>(spawn_id));return;}@@@ -562,7 -562,7 +594,7 @@@let over_group = targets.iter().any(|target| target.rect.contains(pos));let float_drop = ctx.input(|i| i.modifiers.command);let plan = (!float_drop).then(|| resolve_drop(&p, pos, &targets)).flatten();-- let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::new("dock-drop")));++ let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::unique("dock-drop")));if let Some(proposal) = &plan {let preview = proposal.preview.shrink(2.0);painter.rect_filled(preview, t.radius, t.focus.gamma_multiply(0.18));@@@ -612,7 -612,7 +644,7 @@@ pub fn panel_window_id(panel: PanelKind/// Where a native panel window was told to open (kept for as long as it stays open).fn panel_window_spawn_id(panel: PanelKind) -> egui::Id {-- egui::Id::new(("panel-window-spawn", panel.id()))++ egui::Id::unique(("panel-window-spawn", panel.id()))}/// A new floating group's default rect near the centre of `screen`.diff --cc crates/ui-egui/src/header.rsindex c1272c41d,c1272c41d..2ad3dd20f--- a/crates/ui-egui/src/header.rs+++ b/crates/ui-egui/src/header.rs@@@ -26,7 -26,7 +26,7 @@@ pub fn show(app: &mut EffectcraftApp, u// Brand mark.let brand = Rect::from_min_size(pos2(x, cy - 12.0), vec2(24.0, 24.0));paint_logo(&p, brand);-- let bresp = ui.interact(brand, egui::Id::new("brand"), Sense::click());++ let bresp = ui.interact(brand, egui::Id::unique("brand"), Sense::click());app.auto.add_response("header.about", &bresp, "About EffectCraft");widgets::focus_outline(ui, &bresp, &t);if bresp.on_hover_text(tr("About EffectCraft")).clicked() {@@@ -36,7 -36,7 +36,7 @@@// Home.let home = Rect::from_min_size(pos2(x, cy - 13.0), vec2(26.0, 26.0));-- let home_response = widgets::icon_button(ui, home, Icon::Home, app.ui.start_screen, &t, egui::Id::new("tool-home")).on_hover_text(tr("Home"));++ let home_response = widgets::icon_button(ui, home, Icon::Home, app.ui.start_screen, &t, egui::Id::unique("tool-home")).on_hover_text(tr("Home"));app.auto.add_response("header.home", &home_response, "Home");if home_response.clicked() {app.ui.start_screen = !app.ui.start_screen;@@@ -46,7 -46,7 +46,7 @@@x += 6.0;// Tool slots (with group separators after camera tools and pan-behind).-- let held_id = egui::Id::new("tool-slot-held");++ let held_id = egui::Id::unique("tool-slot-held");if ui.input(|i| i.pointer.any_pressed()) {ui.data_mut(|d| d.remove::<egui::Id>(held_id));}@@@ -54,7 -54,7 +54,7 @@@let cur = app.ui.slot_tools.get(si).copied().unwrap_or(slot[0]);let r = Rect::from_min_size(pos2(x, cy - 13.0), vec2(26.0, 26.0));let active = slot.contains(&app.ui.tool);-- let id = egui::Id::new(("tool-slot", si));++ let id = egui::Id::unique(("tool-slot", si));let resp = widgets::icon_button(ui, r, cur.icon(), active, &t, id);if slot.len() > 1 {// Flyout corner triangle.@@@ -174,7 -174,7 +174,7 @@@let snap = Rect::from_min_size(pos2(x, cy - 10.0), vec2(20.0, 20.0));// The engine owns snapping (View ▸ Snapping); the checkbox mirrors it.app.ui.snapping = app.session.state.snapping;-- if widgets::checkbox(ui, snap, app.ui.snapping, &t, egui::Id::new("snapping")).clicked() {++ if widgets::checkbox(ui, snap, app.ui.snapping, &t, egui::Id::unique("snapping")).clicked() {let _ = app.session.execute("view.snapping", serde_json::json!({}));app.ui.snapping = app.session.state.snapping;}@@@ -188,7 -188,7 +188,7 @@@// text at its left, which left a wide gap on the right (#581).let label = p.layout_no_wrap(tr("Discord").to_string(), Tokens::semibold(12.0), Color32::WHITE);let discord = Rect::from_min_max(pos2(rx - (10.0 + 14.0 + 6.0 + label.size().x + 12.0), cy - 13.0), pos2(rx, cy + 13.0));-- let dresp = ui.interact(discord, egui::Id::new("hdr-discord"), Sense::click());++ let dresp = ui.interact(discord, egui::Id::unique("hdr-discord"), Sense::click());let dc = Color32::from_rgb(0x58, 0x65, 0xf2);p.rect_filled(discord, 13.0, if dresp.hovered() { dc.gamma_multiply(1.2) } else { dc });icons::paint(&p, Rect::from_center_size(pos2(discord.min.x + 17.0, cy), vec2(14.0, 14.0)), Icon::Chat, Color32::WHITE);@@@ -202,7 -202,7 +202,7 @@@[("hdr-github", Icon::Code, "EffectCraft on GitHub", "help.github"), ("hdr-web", Icon::Globe, "EffectCraft on getartcraft.com", "help.appPage")]{let r = Rect::from_min_max(pos2(rx - 26.0, cy - 13.0), pos2(rx, cy + 13.0));-- if widgets::icon_button(ui, r, icon, false, &t, egui::Id::new(id)).on_hover_text(tip).clicked() {++ if widgets::icon_button(ui, r, icon, false, &t, egui::Id::unique(id)).on_hover_text(tip).clicked() {let _ = app.session.execute(cmd, json!({}));}app.auto.add(&format!("header.{}", &id[4..]), r, tip);@@@ -216,7 -216,7 +216,7 @@@};let tip = tr_args("Appearance Mode: {}", &[&mode]);let r = Rect::from_min_max(pos2(rx - 26.0, cy - 13.0), pos2(rx, cy + 13.0));-- let response = widgets::icon_button(ui, r, icon, false, &t, egui::Id::new("hdr-appearance")).on_hover_text(&tip);++ let response = widgets::icon_button(ui, r, icon, false, &t, egui::Id::unique("hdr-appearance")).on_hover_text(&tip);if response.clicked() {app.cycle_appearance(ui.ctx());}@@@ -252,17 -252,17 +252,17 @@@rx -= 10.0;// Workspace tabs (right to left), with a » menu of all.let more = Rect::from_min_max(pos2(rx - 20.0, cy - 11.0), pos2(rx, cy + 11.0));-- let mresp = ui.interact(more, egui::Id::new("ws-more"), Sense::click());++ let mresp = ui.interact(more, egui::Id::unique("ws-more"), Sense::click());p.text(more.center(), Align2::CENTER_CENTER, "»", Tokens::ui(15.0), if mresp.hovered() { t.text } else { t.text_dim });app.auto.add("header.workspaces", more, "Workspaces");crate::widgets::context_menu(&mresp, |ui| ws_menu(app, ui));if mresp.clicked() {-- widgets::open_popup(ui, egui::Id::new("ws-pop"));++ widgets::open_popup(ui, egui::Id::unique("ws-pop"));}let names: Vec<String> = crate::dock::WORKSPACES.iter().map(|s| crate::i18n::command_label("window.workspace", s).to_string()).collect();if let Some(i) = widgets::popup_menu(ui,-- egui::Id::new("ws-pop"),++ egui::Id::unique("ws-pop"),more.left_bottom() - vec2(140.0, 0.0),&names,crate::dock::WORKSPACES.iter().position(|w| *w == app.ui.workspace),@@@ -281,7 -281,7 +281,7 @@@break;}let active = app.ui.workspace == name;-- let resp = ui.interact(r, egui::Id::new(("ws", name)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("ws", name)), Sense::click());let col = if active {t.hot_text} else if resp.hovered() {@@@ -305,8 -305,8 +305,8 @@@/// Features in Collapsed Compositions and Text Layers (`view.snappingOptions`).fn snapping_options(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect) {let t = app.tokens;-- let pop = egui::Id::new("snap-options");-- if widgets::icon_button(ui, r, Icon::ChevronDown, false, &t, egui::Id::new("snap-options-button")).on_hover_text(tr("Snapping options")).clicked() {++ let pop = egui::Id::unique("snap-options");++ if widgets::icon_button(ui, r, Icon::ChevronDown, false, &t, egui::Id::unique("snap-options-button")).on_hover_text(tr("Snapping options")).clicked() {widgets::open_popup(ui, pop);}app.auto.add("header.snappingOptions", r, "Snapping options");@@@ -349,7 -349,7 +349,7 @@@ fn gradient_colors(app: &EffectcraftApp/// The colour picker of the Fill or Stroke swatch.fn picker_id(key: &str) -> egui::Id {-- egui::Id::new(("tool-pick", key))++ egui::Id::unique(("tool-pick", key))}/// Tool Creates Shape / Tool Creates Mask: with a shape layer selected, whether the shape tools@@@ -359,7 -359,7 +359,7 @@@ fn creates_buttons(app: &mut Effectcraffor (mask, icon, tip, key) in [(false, Icon::ShapeLayer, "Tool Creates Shape", "createsShape"), (true, Icon::MaskVis, "Tool Creates Mask", "createsMask")] {let r = Rect::from_min_size(pos2(x, cy - 13.0), vec2(26.0, 26.0));let on = app.session.state.shape_tool.creates_mask == mask;-- if widgets::icon_button(ui, r, icon, on, &t, egui::Id::new(("tool-creates", key))).on_hover_text(tip).clicked() {++ if widgets::icon_button(ui, r, icon, on, &t, egui::Id::unique(("tool-creates", key))).on_hover_text(tip).clicked() {tool_options(app, json!({"createsMask": mask}));}app.auto.add(&format!("header.{key}"), r, tip);@@@ -388,14 -388,14 +388,14 @@@ fn fill_stroke_options(app: &mut Effectlet options = format!("{title} Options");let g = p.layout_no_wrap(format!("{title}:"), Tokens::ui(12.0), t.text_dim);let wr = Rect::from_min_size(pos2(x, cy - g.size().y / 2.0), g.size());-- let wresp = ui.interact(wr, egui::Id::new(("tool-paint-word", key)), Sense::click()).on_hover_text(&options);++ let wresp = ui.interact(wr, egui::Id::unique(("tool-paint-word", key)), Sense::click()).on_hover_text(&options);let col = if wresp.hovered() { t.text } else { t.text_dim };if wresp.hovered() {p.line_segment([pos2(wr.min.x, wr.max.y), pos2(wr.max.x - 3.0, wr.max.y)], Stroke::new(1.0, col));}p.galley_with_override_text_color(wr.min, g, col);app.auto.add(&format!("header.{key}Options"), wr, &options);-- let opts = egui::Id::new(("tool-paint-options", key));++ let opts = egui::Id::unique(("tool-paint-options", key));if wresp.clicked() {widgets::open_popup(ui, opts);}@@@ -403,7 -403,7 +403,7 @@@// the Gradient Editor (the selected shape layer's Gradient Fill / Gradient Stroke), and// opens the options otherwise; Alt-click steps through the kinds (as in After Effects).let sr = Rect::from_min_size(pos2(wr.max.x + 6.0, cy - 8.0), vec2(20.0, 16.0));-- let sresp = ui.interact(sr, egui::Id::new(("tool-paint-swatch", key)), Sense::click()).on_hover_text(format!("{title}: {}", tp.kind.label()));++ let sresp = ui.interact(sr, egui::Id::unique(("tool-paint-swatch", key)), Sense::click()).on_hover_text(format!("{title}: {}", tp.kind.label()));paint_swatch(p, sr, &tp, sresp.hovered(), &t);app.auto.add(&format!("header.{key}"), sr, &format!("{title} Color"));if sresp.clicked() {@@@ -435,7 -435,7 +435,7 @@@x = sr.max.x + 12.0;}let width = app.session.state.shape_tool.stroke_width;-- let (r, v, _) = widgets::hot_number_at(ui, pos2(x - 6.0, cy - 9.0), egui::Id::new("tool-stroke-w"), width, 0.2, (0.0, 1000.0), 0, " px", &t);++ let (r, v, _) = widgets::hot_number_at(ui, pos2(x - 6.0, cy - 9.0), egui::Id::unique("tool-stroke-w"), width, 0.2, (0.0, 1000.0), 0, " px", &t);if let Some(v) = v {tool_options(app, json!({"strokeWidth": v}));paint(app, "strokeWidth", json!(v));@@@ -466,7 -466,7 +466,7 @@@ fn paint_kind(app: &mut EffectcraftApp/// Fill Options / Stroke Options: None, Solid Color, Linear Gradient or Radial Gradient, and the/// blend mode and opacity new shapes get (After Effects' dialogs, applied as they change).fn paint_options_popup(app: &mut EffectcraftApp, ui: &mut egui::Ui, shape_layers: &[u64], key: &str, title: &str, pos: egui::Pos2) {-- let id = egui::Id::new(("tool-paint-options", key));++ let id = egui::Id::unique(("tool-paint-options", key));if !widgets::popup_is_open(ui, id) {return;}@@@ -573,7 -573,7 +573,7 @@@ fn roto_options(app: &mut EffectcraftAplet label = tr("Diameter:");let lr = p.text(pos2(x, cy), Align2::LEFT_CENTER, label, Tokens::ui(12.0), t.text_dim);x = lr.max.x + 6.0;-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(x, cy - 9.0), egui::Id::new(("roto-opt", key)), v, 0.5, (1.0, 5000.0), 0, " px", &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(x, cy - 9.0), egui::Id::unique(("roto-opt", key)), v, 0.5, (1.0, 5000.0), 0, " px", &t);app.auto.add("header.roto.diameter", r, label);if let Some(nv) = nv&& let Err(e) = app.session.execute("roto.options", json!({key: nv}))@@@ -591,7 -591,7 +591,7 @@@ fn puppet_options(app: &mut Effectcraftp.text(pos2(x, cy), Align2::LEFT_CENTER, tr("Mesh:"), Tokens::ui(12.0), t.text_dim);x += 40.0;let show = Rect::from_min_size(pos2(x, cy - 10.0), vec2(20.0, 20.0));-- if widgets::checkbox(ui, show, o.show_mesh, &t, egui::Id::new("puppet-show-mesh")).clicked() {++ if widgets::checkbox(ui, show, o.show_mesh, &t, egui::Id::unique("puppet-show-mesh")).clicked() {let _ = app.session.execute("puppet.mesh", json!({"showMesh": !o.show_mesh}));}app.auto.add("header.puppet.showMesh", show, "Show mesh");@@@ -600,7 -600,7 +600,7 @@@for (label, key, v, range) in [("Expansion:", "expansion", o.expansion, (-100.0, 200.0)), ("Density:", "density", o.density, (0.0, 100.0))] {p.text(pos2(x, cy), Align2::LEFT_CENTER, label, Tokens::ui(12.0), t.text_dim);x += if key == "expansion" { 64.0 } else { 52.0 };-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(x, cy - 9.0), egui::Id::new(("puppet-opt", key)), v, 0.2, range, 0, "", &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(x, cy - 9.0), egui::Id::unique(("puppet-opt", key)), v, 0.2, range, 0, "", &t);app.auto.add(&format!("header.puppet.{key}"), r, label);if let Some(nv) = nv {let _ = app.session.execute("puppet.mesh", json!({key: nv, "merge": format!("puppet-opt-{key}")}));@@@ -611,7 -611,7 +611,7 @@@let label = "Record Options...";let w = 104.0;let r = Rect::from_min_size(pos2(x, cy - 10.0), vec2(w, 20.0));-- let resp = ui.interact(r, egui::Id::new("puppet-record-options"), egui::Sense::click()).on_hover_text(tr("⌘/Ctrl-drag a pin to record its motion"));++ let resp = ui.interact(r, egui::Id::unique("puppet-record-options"), egui::Sense::click()).on_hover_text(tr("⌘/Ctrl-drag a pin to record its motion"));p.rect_stroke(r, 3.0, egui::Stroke::new(1.0, if resp.hovered() { t.accent } else { t.field_border }), egui::StrokeKind::Inside);p.text(r.center(), Align2::CENTER_CENTER, label, Tokens::ui(11.5), t.text);app.auto.add("header.puppet.recordOptions", r, label);@@@ -625,7 -625,7 +625,7 @@@let label = "Follow-Through...";let r = Rect::from_min_size(pos2(r.max.x + 8.0, cy - 10.0), vec2(w, 20.0));let resp = ui-- .interact(r, egui::Id::new("puppet-follow"), egui::Sense::click())++ .interact(r, egui::Id::unique("puppet-follow"), egui::Sense::click()).on_hover_text(tr("Select the leader pin, then Shift-click the pins that should trail it (hair, cloth, tails)"));p.rect_stroke(r, 3.0, egui::Stroke::new(1.0, if resp.hovered() { t.accent } else { t.field_border }), egui::StrokeKind::Inside);p.text(r.center(), Align2::CENTER_CENTER, label, Tokens::ui(11.5), t.text);@@@ -668,7 -668,7 +668,7 @@@ static ARTCRAFT_MARK: &[u8] = include_b/// 24 px Tools bar to the About dialog). Nothing is drawn if it can't be decoded.pub fn paint_logo(p: &egui::Painter, r: Rect) {let ctx = p.ctx();-- let id = egui::Id::new("artcraft-mark");++ let id = egui::Id::unique("artcraft-mark");let tex = ctx.data(|d| d.get_temp::<Option<egui::TextureHandle>>(id)).unwrap_or_else(|| {let tex = image::load_from_memory_with_format(ARTCRAFT_MARK, image::ImageFormat::Png).ok().map(|img| {let img = img.to_rgba8();diff --cc crates/ui-egui/src/lib.rsindex 2762188a0,5a1552344..531d7dd6e--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@@ -47,11 -47,11 +47,147 @@@ use serde_json::jsonuse state::UiState;use theme::Tokens;--const SCREENSHOT_TIMEOUT_S: f64 = 4.0;++/// How long a screenshot request waits for a frame, from admission (app clock seconds).++const SCREENSHOT_TIMEOUT_S: f64 = 8.0;++/// Seconds between a screenshot's admission and the earliest capture: the UI settles first.++const SCREENSHOT_SETTLE_S: f64 = 0.35;++/// Final (non-discarded) UI passes a screenshot waits for after admission before it is issued.++const SCREENSHOT_SETTLE_PASSES: u64 = 3;++/// Geometry changes a queued screenshot may retry before it reports an error.++const SCREENSHOT_MAX_RETRIES: u32 = 4;++/// Outstanding screenshot requests (queued or waiting for their pixels).++const MAX_PENDING_SHOTS: usize = 4;++/// One capture's pixels: 128 MiB.++const MAX_SHOT_BYTES: usize = 128 * 1024 * 1024;++/// Every pending capture's reserved pixels together: 256 MiB.++const MAX_SHOT_TOTAL_BYTES: usize = 256 * 1024 * 1024;/// Seconds without a project change before paused prefetch resumes (see/// [`EffectcraftApp::editing`]).const EDIT_QUIET: f64 = 0.3;++/// The application's monotonic clock, in seconds.++///++/// Neither `ctx.input(|i| i.time)` nor `RawInput::time` is valid in a logic-only tick:++/// `Context::run_logic` copies only the viewport information, so both are the previous full++/// pass's values. Playback, auto-save, screenshot deadlines and the control channel measure time++/// with this clock instead. Native and web use the same [`web_time::Instant`] source; tests++/// inject [`AppClock::manual`] and advance it.++#[derive(Clone, Debug)]++pub struct AppClock {++ origin: web_time::Instant,++ manual: Option<f64>,++}++++impl AppClock {++ /// The host's monotonic clock.++ pub fn real() -> Self {++ Self { origin: web_time::Instant::now(), manual: None }++ }++++ /// A clock tests advance explicitly with [`AppClock::advance`].++ pub fn manual() -> Self {++ Self { origin: web_time::Instant::now(), manual: Some(0.0) }++ }++++ /// Seconds since the clock started (monotonic on native and in the browser).++ pub fn now(&self) -> f64 {++ match self.manual {++ Some(t) => t,++ None => self.origin.elapsed().as_secs_f64(),++ }++ }++++ /// Move a manual clock forward; a real clock ignores this.++ pub fn advance(&mut self, seconds: f64) {++ if let Some(t) = &mut self.manual {++ *t = (*t + seconds.max(0.0)).max(0.0);++ }++ }++++ /// Whether the clock is test-driven.++ pub fn is_manual(&self) -> bool {++ self.manual.is_some()++ }++}++++impl Default for AppClock {++ fn default() -> Self {++ Self::real()++ }++}++++/// The root surface geometry of the last completed (non-discarded) UI pass.++///++/// The window position is deliberately excluded: moving the window does not change the pixels++/// a screenshot captures. Size and scale-factor changes advance [`Self::epoch`].++#[derive(Clone, Copy, Debug, PartialEq)]++pub struct DrawGeometry {++ pub rect: egui::Rect,++ pub ppp: f32,++ /// Bumped whenever `rect.size()` or `ppp` differs from the previous recorded pass.++ pub epoch: u64,++}++++/// Whether a captured image's dimensions match `rect` at `ppp`.++///++/// The surface may be smaller than requested when the adapter-limit fit (fork E2) applies, but a++/// different aspect ratio means the pixels came from another layout than the one issued.++fn shot_image_matches(image: &egui::ColorImage, rect: egui::Rect, ppp: f32) -> bool {++ let [w, h] = image.size;++ if w == 0 || h == 0 || !ppp.is_finite() || ppp <= 0.0 {++ return false;++ }++ let ew = (rect.width() as f64 * ppp as f64).max(1.0);++ let eh = (rect.height() as f64 * ppp as f64).max(1.0);++ let want = ew / eh;++ let got = w as f64 / h as f64;++ (got - want).abs() <= 0.02 * want.max(1.0)++}++++/// What a `ui.screenshot` captures.++///++/// A panel or element is an identity, not a rectangle: it is resolved again when the capture is++/// issued, after the settle passes, so a panel that moved or resized while the UI settled is++/// captured where it is now (never with the rectangle from request admission).++#[derive(Clone, Debug, PartialEq)]++pub enum ShotTarget {++ /// The whole root surface.++ Window,++ /// A fixed rectangle in logical points, relative to the root surface's top-left corner.++ Rect([f32; 4]),++ /// One dock panel's automation rectangle (`panel.<id>`).++ Panel(PanelKind),++ /// One automation element id's rectangle.++ Id(String),++}++++/// One `ui.screenshot` request: its reply, its admission reservation and its completion slot.++struct PendingShot {++ path: Option<String>,++ /// What to capture; resolved afresh at every issuance.++ target: ShotTarget,++ /// The crop resolved at issuance, **relative to the issued rect's origin** (the image's++ /// origin); `None` captures the whole surface.++ crop: Option<[f32; 4]>,++ reply: Sender<serde_json::Value>,++ /// App-clock instant after which the request fails instead of waiting.++ deadline: f64,++ /// App-clock instant before which the UI must have settled.++ settle_at: f64,++ /// Root geometry and geometry epoch the reservation was admitted against.++ admitted: DrawGeometry,++ /// Final UI passes completed when the request was admitted.++ admitted_pass: u64,++ /// The geometry epoch bound to the issued capture command, if it was issued.++ issued: Option<DrawGeometry>,++ /// The shared completion slot; dropping it cancels a late callback.++ slot: Option<craft_ui::capture::CaptureSlot>,++ /// Bytes reserved against [`EffectcraftApp::shot_bytes`].++ reserved_bytes: usize,++ /// Geometry retries used.++ attempts: u32,++}++/// Modal dialogs.#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum Dialog {@@@ -270,21 -271,21 +407,45 @@@ pub struct EffectcraftApppub dialog: Option<Dialog>,pub hooks: Hooks,pub fps: f32,++ /// The app clock and the value it had at the last [`EffectcraftApp::tick`].++ clock: AppClock,++ now: f64,last_time: f64,styled: bool,fonts_ready: bool,/// The interface language the fonts were installed for; `""` until the first frame.styled_language: &'static str,++ /// The root viewport's focus, from the viewport information a logic tick refreshes.++ focused: bool,++ /// Whether the last UI pass saw events or a moving/held pointer.++ input_active: bool,++ /// The pointer was down in the last UI pass (workspace auto-save waits for it to lift).++ last_pointer_down: bool,++ /// Geometry of the last completed, non-discarded UI pass.++ draw_geom: Option<DrawGeometry>,++ /// Bumped when the root surface size or pixels-per-point changes.++ geometry_epoch: u64,++ /// Per-viewport IME owner, generation and change-cause state for the on-canvas text editor.++ pub(crate) ime_tracker: egui::ImeContextTracker,++ /// Completed, non-discarded UI passes since launch.++ ui_pass_seq: u64,++ /// A hidden window must run a UI pass (queued input, screenshots, playback children, …).++ want_paint: bool,++ /// The synthetic batch moved into raw input has not been applied by a UI pass yet.++ synthetic_in_flight: bool,++ /// The events of that batch while egui applies them (never fed to a second pass).++ synthetic_in_flight_events: Vec<egui::Event>,++ /// The viewer scale the last UI pass drew at: playback prefetches without a viewer pass.++ last_viewer_scale: Option<f64>,pub(crate) control_rx: Option<Receiver<ControlRequest>>,pub(crate) deferred: Vec<(ControlRequest, f64)>,pub(crate) synthetic: Vec<egui::Event>,pub(crate) input_waiters: Vec<Sender<serde_json::Value>>,/// Control requests waiting for an offloaded job (`wait: true` in the browser).pub(crate) job_waiters: Vec<(control::JobWaiter, Sender<serde_json::Value>)>,-- queued_screenshots: Vec<(u64, f64, u32)>,-- pending_screenshots: Vec<(u64, Option<String>, Option<[f32; 4]>, Sender<serde_json::Value>, f64)>,-- next_token: u64,-- pub(crate) last_ui_time: f64,++ pending_screenshots: Vec<PendingShot>,++ /// Pixels reserved by queued and in-flight screenshot requests.++ shot_bytes: usize,/// When the user last did something (input or an edit): Cache Frames When Idle waits for/// a second of quiet. (time, project revision then)last_activity: (f64, u64),@@@ -380,19 -381,19 +541,30 @@@ impl EffectcraftAppdialog: None,hooks: Hooks::default(),fps: 60.0,++ clock: AppClock::default(),++ now: 0.0,last_time: 0.0,styled: false,fonts_ready: false,styled_language: "",++ focused: true,++ input_active: false,++ last_pointer_down: false,++ draw_geom: None,++ geometry_epoch: 0,++ ime_tracker: egui::ImeContextTracker::new(),++ ui_pass_seq: 0,++ want_paint: false,++ synthetic_in_flight: false,++ synthetic_in_flight_events: vec![],++ last_viewer_scale: None,control_rx: None,deferred: vec![],synthetic: vec![],input_waiters: vec![],job_waiters: vec![],-- queued_screenshots: vec![],pending_screenshots: vec![],-- next_token: 1,-- last_ui_time: 0.0,++ shot_bytes: 0,last_activity: (0.0, 0),last_edit: (0.0, 0),toast: None,@@@ -575,20 -576,20 +747,76 @@@/// Feed this frame's share of the queued synthetic input (control channel `ui.click`,/// `ui.drag`…) into `raw_input`. Pointer events go one per frame so egui sees press → moves/// → release as a real gesture.++ ///++ /// Only one batch is ever moved out at a time, even when the host prepares several hidden++ /// logic-only iterations before the forced UI pass: eframe keeps the last prepared raw input++ /// and would otherwise apply a whole drag or click as one burst. A batch is released by the++ /// first UI pass that applies it ([`Self::mark_synthetic_applied`]). Callers must not feed a++ /// pass that cannot draw (fonts still installing): egui applies what it receives, so putting++ /// an applied batch back would apply its pointer/key state twice.pub fn feed_synthetic(&mut self, raw_input: &mut egui::RawInput) {-- if !self.synthetic.is_empty() {-- // Pointer events go one per frame so egui sees press → moves → release as a real drag.-- let pointer = |e: &egui::Event| matches!(e, egui::Event::PointerMoved(_) | egui::Event::PointerButton { .. } | egui::Event::MouseWheel { .. });-- let n = if pointer(&self.synthetic[0]) {-- 1-- } else {-- self.synthetic-- .iter()-- .position(|e| pointer(e) || matches!(e, egui::Event::Key { pressed: false, .. }))-- .map_or(self.synthetic.len(), |i| if pointer(&self.synthetic[i]) { i.max(1) } else { i + 1 })-- };-- raw_input.events.extend(self.synthetic.drain(..n));++ if self.synthetic_in_flight || self.synthetic.is_empty() {++ return;}++ // Pointer events go one per frame so egui sees press → moves → release as a real drag.++ let pointer = |e: &egui::Event| matches!(e, egui::Event::PointerMoved(_) | egui::Event::PointerButton { .. } | egui::Event::MouseWheel { .. });++ let n = if pointer(&self.synthetic[0]) {++ 1++ } else {++ self.synthetic++ .iter()++ .position(|e| pointer(e) || matches!(e, egui::Event::Key { pressed: false, .. }))++ .map_or(self.synthetic.len(), |i| if pointer(&self.synthetic[i]) { i.max(1) } else { i + 1 })++ };++ let batch: Vec<egui::Event> = self.synthetic.drain(..n).collect();++ raw_input.events.extend(batch.iter().cloned());++ self.synthetic_in_flight_events.extend(batch);++ self.synthetic_in_flight = true;++ }++++ /// Clear the single-pending-batch guard: a UI pass has applied the injected batch.++ ///++ /// [`EffectcraftApp::draw`] calls this itself; harnesses that feed synthetic input++ /// themselves (the headless kittest tests) call it after each pass they ran.++ pub fn mark_synthetic_applied(&mut self) {++ self.synthetic_in_flight_events.clear();++ self.synthetic_in_flight = false;++ }++++ /// The events of the injected batch that no UI pass has applied yet.++ pub fn pending_synthetic_events(&self) -> &[egui::Event] {++ &self.synthetic_in_flight_events++ }++++ /// Whether a synthetic batch is waiting for its UI pass.++ pub fn synthetic_in_flight(&self) -> bool {++ self.synthetic_in_flight++ }++++ /// The app clock's value at the last tick.++ pub fn now(&self) -> f64 {++ self.now++ }++++ /// The clock itself (tests advance a manual clock).++ pub fn clock_mut(&mut self) -> &mut AppClock {++ &mut self.clock++ }++++ /// Use a test-driven clock from now on.++ pub fn use_manual_clock(&mut self) {++ self.clock = AppClock::manual();++ self.now = 0.0;++ }++++ /// Completed, non-discarded UI passes since launch.++ pub fn ui_passes(&self) -> u64 {++ self.ui_pass_seq++ }++++ /// The geometry of the last completed UI pass, if one ran.++ pub fn draw_geometry(&self) -> Option<DrawGeometry> {++ self.draw_geom}/// Show panel `p` (opening it in its usual place if it is closed), bring it to the front and@@@ -1162,10 -1163,10 +1390,8 @@@/// RAM preview: advance at the preview's frame rate when frames are cached; otherwise hold/// and keep rendering ahead (the green cache bar fills, then playback runs in real time).-- fn advance_playback(&mut self, ctx: &egui::Context, scale: f64) {-- let Some(cid) = self.session.active_comp_id() else { return };++ fn advance_playback(&mut self, ctx: &egui::Context, scale: f64, now: f64, input_active: bool, cid: ItemId) {let Some(c) = self.session.project.comp_arc(cid) else { return };-- let now = ctx.input(|i| i.time);let fr = c.frame_rate;let plan = self.playback.plan.filter(|_| self.playback.playing);let (wa, wb) = match plan {@@@ -1286,7 -1287,7 +1512,7 @@@ctx.request_repaint();}if !self.playback.playing {-- self.cache_when_idle(ctx, &c, &series, now, (wa, wb));++ self.cache_when_idle(ctx, &c, &series, now, input_active, (wa, wb));return;}let snap = |f: i64| wa + (f - wa).div_euclid(step) * step;@@@ -1337,7 -1338,7 +1563,11 @@@return;}let elapsed = now - self.playback.start_wall;-- let n = ((elapsed * self.playback.fps) / step as f64).floor() as i64;++ // The plan carries the rate the preview was started with (and `play_with` copies it to++ // `Playback::fps`). Deriving the frame from the plan keeps a logic-only tick correct even++ // when a host/test supplies only the plan; a stale duplicate cannot hold playback open.++ let fps = plan.map_or(self.playback.fps, |p| p.fps);++ let n = ((elapsed * fps) / step as f64).floor() as i64;let target = match plan {Some(p) => p.frame_after(self.playback.start_frame, n),None => {@@@ -1398,8 -1399,8 +1628,16 @@@/// Composition ▸ Preview ▸ Cache Frames When Idle: after a second without input or edits,/// render the work area's frames (from the current time on, then from its start) in the/// background, a few at a time, until it is cached or the RAM preview budget is full.-- fn cache_when_idle(&mut self, ctx: &egui::Context, comp: &effectcraft_engine::project::Comp, series: &FrameKey, now: f64, (wa, wb): (i64, i64)) {-- let active = ctx.input(|i| !i.events.is_empty() || i.pointer.any_down() || i.pointer.is_moving());++ fn cache_when_idle(++ &mut self,++ ctx: &egui::Context,++ comp: &effectcraft_engine::project::Comp,++ series: &FrameKey,++ now: f64,++ input_active: bool,++ (wa, wb): (i64, i64),++ ) {++ let active = input_active;if active || self.last_activity.1 != self.session.revision {self.last_activity = (now, self.session.revision);}@@@ -1469,16 -1470,16 +1707,15 @@@ctx.request_repaint();}-- fn drain_control(&mut self, ctx: &egui::Context) {++ fn drain_control(&mut self, ctx: &egui::Context, now: f64) {let Some(rx) = self.control_rx.take() else { return };-- let now = ctx.input(|i| i.time);let mut reqs: Vec<(ControlRequest, f64)> = std::mem::take(&mut self.deferred);while let Ok(req) = rx.try_recv() {reqs.push((req, now + 3.0));}for (req, deadline) in reqs {let reply = req.reply.clone();-- match control::handle(self, ctx, &req) {++ match control::handle(self, ctx, &req, now) {control::Outcome::Done(v) => {let _ = reply.send(v);}@@@ -1490,23 -1491,23 +1727,26 @@@let _ = reply.send(json!({"ok": false, "error": msg}));}}-- control::Outcome::AfterInput => self.input_waiters.push(reply),++ control::Outcome::AfterInput => {++ self.input_waiters.push(reply);++ // The reply waits for a real UI pass: a hidden window must run one.++ self.want_paint = true;++ }control::Outcome::AwaitJobs(w) => {self.job_waiters.push((w, reply));ctx.request_repaint();}-- control::Outcome::Screenshot { path, crop } => {++ control::Outcome::Screenshot { path, target } => {// A covered or minimized window presents no frames (macOS skips its redraws), so-- // a screenshot would never arrive and nothing would tick its timeout.++ // a screenshot would never arrive and nothing would tick its timeout. The++ // hidden-window capture path (a pending screenshot forces a pass in 0.37) needs++ // a native platform run before this gate is removed; the web build never paints++ // a hidden tab.if ctx.input(|i| i.viewport().occluded == Some(true) || i.viewport().minimized == Some(true)) {let _ = reply.send(json!({"ok": false, "error": "window is covered or minimized: call ui.focus first (render.frame renders comp pixels without the window)"}));continue;}-- let token = self.next_token;-- self.next_token += 1;-- let settle = now + 0.35;-- self.queued_screenshots.push((token, settle, 0));-- self.pending_screenshots.push((token, path, crop, reply, settle + SCREENSHOT_TIMEOUT_S));++ self.admit_screenshot(ctx, path, target, reply);}}}@@@ -1535,59 -1536,59 +1775,276 @@@}}-- fn issue_screenshots(&mut self, ctx: &egui::Context) {-- let now = ctx.input(|i| i.time);-- let mut any = false;-- let busy = self.frames.inflight() > 0;-- self.queued_screenshots.retain_mut(|(token, at, frames)| {-- *frames += 1;-- any = true;-- // Wait for the viewer's frame to finish rendering (bounded by the timeout below).-- if now >= *at && *frames >= 3 && (!busy || now > *at + 2.5) {-- ctx.send_viewport_cmd(egui::ViewportCommand::Screenshot(egui::UserData::new(*token)));-- false-- } else {-- true++ // ---------------------------------------------------------------- screenshots++++ /// The root surface geometry a screenshot is admitted against.++ ///++ /// The last completed pass's geometry is authoritative. Before any pass, only the viewport's++ /// `inner_rect` (the client surface a capture returns) is accepted: `outer_rect` also covers++ /// the title bar and window frame, so a capture issued against it would be cropped and++ /// validated against a different rectangle than the callback delivers. A request that arrives++ /// before the geometry is known is refused with an actionable error, and the pass that would++ /// establish it is requested.++ fn current_geometry(&self, ctx: &egui::Context) -> Option<DrawGeometry> {++ if let Some(g) = self.draw_geom {++ return Some(g);++ }++ let rect = ctx.input(|i| i.viewport().inner_rect)?;++ (rect.width() > 0.0 && rect.height() > 0.0).then_some(DrawGeometry { rect, ppp: ctx.pixels_per_point(), epoch: self.geometry_epoch })++ }++++ /// The point rectangle a request captures: its crop, clamped to the window, or all of it.++ fn shot_target_rect(geom: &DrawGeometry, crop: Option<[f32; 4]>) -> Option<egui::Rect> {++ let r = match crop {++ Some([x, y, w, h]) if [x, y, w, h].iter().all(|v| v.is_finite()) => {++ egui::Rect::from_min_size(geom.rect.min + egui::vec2(x, y), egui::vec2(w.max(0.0), h.max(0.0))).intersect(geom.rect)}-- });-- self.pending_screenshots.retain(|(.., reply, deadline)| {-- if now > *deadline {-- let _ = reply.send(json!({"ok": false, "error": "no frame was presented (window hidden or display asleep)"}));-- false-- } else {-- true++ Some(_) => return None,++ None => geom.rect,++ };++ (r.width() > 0.0 && r.height() > 0.0).then_some(r)++ }++++ /// The screen-point crop `target` names right now (a panel's or element's current rectangle),++ /// or an actionable error when it is not on screen. Resolved at issuance, never stored from++ /// admission: the UI may move while it settles.++ fn shot_crop(&self, target: &ShotTarget, geom: &DrawGeometry) -> Result<Option<egui::Rect>, String> {++ let crop = match target {++ ShotTarget::Window => None,++ ShotTarget::Rect(r) => Some(*r),++ ShotTarget::Panel(p) => {++ let id = format!("panel.{}", p.id());++ let found = self.auto.find(&id).ok_or_else(|| format!("the {} panel is not on screen", p.title()))?;++ Some(found.rect)}-- });-- if any {-- ctx.request_repaint();-- } else if !self.pending_screenshots.is_empty() {-- ctx.request_repaint_after(std::time::Duration::from_millis(16));++ ShotTarget::Id(id) => Some(self.auto.find(id).ok_or_else(|| format!("no element `{id}` is on screen"))?.rect),++ };++ Self::shot_target_rect(geom, crop).map(Some).ok_or_else(|| "the screenshot area is empty or not a finite rectangle".to_string())++ }++++ /// `target` as a crop relative to `geom`'s origin: what the image's own pixels are cut with.++ fn shot_relative_crop(&self, target: &ShotTarget, geom: &DrawGeometry) -> Result<Option<[f32; 4]>, String> {++ let Some(r) = self.shot_crop(target, geom)? else { return Ok(None) };++ Ok(Some([r.min.x - geom.rect.min.x, r.min.y - geom.rect.min.y, r.width(), r.height()]))++ }++++ /// Pixel bytes `rect` takes at `ppp`, checked (`width * height * 4`).++ fn shot_pixel_bytes(rect: egui::Rect, ppp: f32) -> Option<usize> {++ if !ppp.is_finite() || ppp <= 0.0 {++ return None;}++ let w = (rect.width() as f64 * ppp as f64).ceil().max(1.0) as usize;++ let h = (rect.height() as f64 * ppp as f64).ceil().max(1.0) as usize;++ w.checked_mul(h)?.checked_mul(4)}-- fn collect_screenshots(&mut self, ctx: &egui::Context) {-- if self.pending_screenshots.is_empty() {++ /// Reserve and queue one `ui.screenshot`, or reply with an actionable error.++ fn admit_screenshot(&mut self, ctx: &egui::Context, path: Option<String>, target: ShotTarget, reply: Sender<serde_json::Value>) {++ let Some(geom) = self.current_geometry(ctx) else {++ let _ = reply.send(++ json!({"ok": false, "error": "the window geometry is not known yet (it is recorded by a completed UI pass; retry after the next frame)"}),++ );++ // Ask for the pass that records it.++ self.want_paint = true;++ ctx.request_repaint();++ return;++ };++ if self.pending_screenshots.len() >= MAX_PENDING_SHOTS {++ let _ = reply.send(json!({"ok": false, "error": format!("too many screenshots are pending (at most {MAX_PENDING_SHOTS})")}));return;}-- let events: Vec<_> = ctx.input(|i| {-- i.raw-- .events-- .iter()-- .filter_map(|e| match e {-- egui::Event::Screenshot { user_data, image, .. } => {-- let token = user_data.data.as_ref().and_then(|d| d.downcast_ref::<u64>()).copied()?;-- Some((token, image.clone()))-- }-- _ => None,-- })-- .collect()++ if let Err(e) = self.shot_crop(&target, &geom) {++ let _ = reply.send(json!({"ok": false, "error": e}));++ return;++ }++ // The capture is always the whole surface (the crop is applied when the PNG is written),++ // so the reservation and the per-image bound follow the surface's actual dimensions.++ let Some(bytes) = Self::shot_pixel_bytes(geom.rect, geom.ppp) else {++ let _ = reply.send(json!({"ok": false, "error": "the screenshot area is too large to reserve"}));++ return;++ };++ if bytes > MAX_SHOT_BYTES {++ let _ = reply++ .send(json!({"ok": false, "error": format!("the screenshot would need about {bytes} bytes, over the {MAX_SHOT_BYTES}-byte per-image limit")}));++ return;++ }++ if self.shot_bytes.checked_add(bytes).is_none_or(|n| n > MAX_SHOT_TOTAL_BYTES) {++ let _ = reply.send(json!({"ok": false, "error": format!("the screenshot would exceed the {MAX_SHOT_TOTAL_BYTES}-byte pending-image budget")}));++ return;++ }++ self.shot_bytes += bytes;++ self.pending_screenshots.push(PendingShot {++ path,++ target,++ crop: None,++ reply,++ deadline: self.now + SCREENSHOT_TIMEOUT_S,++ settle_at: self.now + SCREENSHOT_SETTLE_S,++ admitted: geom,++ admitted_pass: self.ui_pass_seq,++ issued: None,++ slot: None,++ reserved_bytes: bytes,++ attempts: 0,});-- for (token, image) in events {-- if let Some(i) = self.pending_screenshots.iter().position(|(t, ..)| *t == token) {-- let (_, path, crop, reply, _) = self.pending_screenshots.remove(i);-- let r = control::save_screenshot(ctx, &image, path.as_deref(), crop);-- let _ = reply.send(r);++ // A queued capture needs a settled UI pass before it can be issued.++ self.want_paint = true;++ }++++ /// Re-reserve request `i` against `geom` after a surface change; false when it no longer fits.++ fn refresh_shot_reservation(&mut self, i: usize, geom: &DrawGeometry) -> bool {++ let Some(bytes) = Self::shot_pixel_bytes(geom.rect, geom.ppp) else { return false };++ if bytes > MAX_SHOT_BYTES {++ return false;++ }++ let released = self.shot_bytes.saturating_sub(self.pending_screenshots[i].reserved_bytes);++ if released.checked_add(bytes).is_none_or(|n| n > MAX_SHOT_TOTAL_BYTES) {++ return false;++ }++ self.shot_bytes = released + bytes;++ self.pending_screenshots[i].reserved_bytes = bytes;++ true++ }++++ /// Reply with an error to request `i` and release its reservation.++ fn fail_shot(&mut self, i: usize, message: impl Into<String>) {++ let shot = self.pending_screenshots.remove(i);++ self.shot_bytes = self.shot_bytes.saturating_sub(shot.reserved_bytes);++ let _ = shot.reply.send(json!({"ok": false, "error": message.into()}));++ }++++ /// Collect completed captures, enforce timeouts and issue every settled request.++ ///++ /// Runs from [`Self::tick`] only: the callback stores pixels in its slot and wakes the++ /// viewport, and everything that can write a file or reply happens here, on the app thread.++ fn tick_screenshots(&mut self, ctx: &egui::Context) {++ let Some(geom) = self.current_geometry(ctx) else { return };++ // 1. Drain completed slots. A completion whose surface epoch changed since issuance is++ // discarded even if the geometry changed back: it was cropped with another frame's++ // pixels-per-point.++ let mut i = 0;++ while i < self.pending_screenshots.len() {++ let taken = self.pending_screenshots.get(i).and_then(|s| s.slot.as_ref()).and_then(craft_ui::capture::CaptureSlot::take);++ let Some(result) = taken else {++ i += 1;++ continue;++ };++ let issued = self.pending_screenshots[i].issued;++ match result {++ Ok(image) => {++ if issued.is_none_or(|g| g.epoch != geom.epoch) {++ self.pending_screenshots[i].slot = None;++ self.pending_screenshots[i].issued = None;++ if self.pending_screenshots[i].attempts >= SCREENSHOT_MAX_RETRIES {++ self.fail_shot(i, "the window resized while the screenshot was being taken");++ } else if !self.refresh_shot_reservation(i, &geom) {++ self.fail_shot(i, "the resized window is too large to capture within the screenshot budget");++ } else {++ let settle_at = self.now + SCREENSHOT_SETTLE_S;++ let passes = self.ui_pass_seq;++ let s = &mut self.pending_screenshots[i];++ s.attempts += 1;++ s.admitted = geom;++ s.admitted_pass = passes;++ s.settle_at = settle_at;++ i += 1;++ }++ continue;++ }++ let Some(issued) = issued else {++ i += 1;++ continue;++ };++ if !shot_image_matches(&image, issued.rect, issued.ppp) {++ self.fail_shot(i, "the screenshot's pixels do not match the window it was taken from");++ continue;++ }++ // The returned image can be smaller than requested (the E2 adapter-limit fit),++ // so the crop uses the image's own scale, never the issued ppp.++ let [iw, ih] = image.size;++ let (sx, sy) = (iw as f64 / issued.rect.width() as f64, ih as f64 / issued.rect.height() as f64);++ if !(sx.is_finite() && sx > 0.0 && sy.is_finite() && sy > 0.0) {++ self.fail_shot(i, "the screenshot's size does not describe the window it was taken from");++ continue;++ }++ let shot = self.pending_screenshots.remove(i);++ self.shot_bytes = self.shot_bytes.saturating_sub(shot.reserved_bytes);++ let r = control::save_screenshot(&image, shot.path.as_deref(), shot.crop, [sx, sy]);++ let _ = shot.reply.send(r);++ }++ Err(e) => {++ self.fail_shot(i, e.to_string());++ }++ }++ }++ // 2. Timeouts: a late callback finds its slot cancelled and writes nothing.++ let mut i = 0;++ while i < self.pending_screenshots.len() {++ if self.now > self.pending_screenshots[i].deadline {++ self.fail_shot(i, "no frame was presented (window hidden or display asleep)");++ } else {++ i += 1;++ }++ }++ // 3. Issue settled requests. The command itself requests the paint; a request still++ // waiting for its passes needs `want_paint` so a hidden window keeps painting.++ let mut i = 0;++ while i < self.pending_screenshots.len() {++ if self.pending_screenshots[i].slot.is_some() {++ i += 1;++ continue;}++ if geom.epoch != self.pending_screenshots[i].admitted.epoch {++ if self.pending_screenshots[i].attempts >= SCREENSHOT_MAX_RETRIES {++ self.fail_shot(i, "the window kept resizing before the screenshot could be taken");++ continue;++ }++ if !self.refresh_shot_reservation(i, &geom) {++ self.fail_shot(i, "the resized window is too large to capture within the screenshot budget");++ continue;++ }++ let (now, passes) = (self.now, self.ui_pass_seq);++ let s = &mut self.pending_screenshots[i];++ s.attempts += 1;++ s.admitted = geom;++ s.admitted_pass = passes;++ s.settle_at = now + SCREENSHOT_SETTLE_S;++ self.want_paint = true;++ i += 1;++ continue;++ }++ let settled = self.ui_pass_seq >= self.pending_screenshots[i].admitted_pass.saturating_add(SCREENSHOT_SETTLE_PASSES)++ && self.now >= self.pending_screenshots[i].settle_at;++ if !settled {++ self.want_paint = true;++ i += 1;++ continue;++ }++ // Resolve the crop now, against the settled UI: an element that moved since admission++ // is captured where it is, and its rectangle is relative to this issued surface.++ let target = self.pending_screenshots[i].target.clone();++ let crop = match self.shot_relative_crop(&target, &geom) {++ Ok(c) => c,++ Err(e) => {++ self.fail_shot(i, e);++ continue;++ }++ };++ let (slot, callback) = craft_ui::capture::CaptureSlot::new(ctx, egui::ViewportId::ROOT, MAX_SHOT_BYTES);++ ctx.send_viewport_cmd(egui::ViewportCommand::Screenshot(callback));++ let s = &mut self.pending_screenshots[i];++ s.slot = Some(slot);++ s.issued = Some(geom);++ s.crop = crop;++ i += 1;++ }++ // 4. Wake up for the earliest deadline even when no further pass is otherwise needed: an++ // issued capture whose callback never arrives (hidden window, display asleep, renderer++ // failure) would otherwise never reach its timeout. This is a timer, not a paint++ // request: the issued screenshot command already forces the frame it needs.++ if let Some(next) = self.pending_screenshots.iter().map(|s| s.deadline).reduce(f64::min) {++ let wait = (next - self.now).max(0.001);++ ctx.request_repaint_after(std::time::Duration::from_secs_f64(wait));}}@@@ -1600,7 -1601,7 +2057,7 @@@panels::viewers::on_open_comp(self, c);self.ui.timeline.pps = None;}-- effectcraft_engine::Event::Toast { message, .. } => self.toast = Some((message, ctx.input(|i| i.time))),++ effectcraft_engine::Event::Toast { message, .. } => self.toast = Some((message, self.now)),effectcraft_engine::Event::OpenUrl(url) => ctx.open_url(egui::OpenUrl::new_tab(url)),// Frames are keyed by content: an edit keeps those of comps it doesn't touch.effectcraft_engine::Event::ProjectChanged { .. } => {}@@@ -1619,12 -1620,12 +2076,36 @@@}}-- fn frame(&mut self, ui: &mut egui::Ui) {-- let ctx = ui.ctx().clone();-- self.apply_gpu_failure(&ctx);-- self.run_dialog_answers();-- self.auto.begin_frame();-- self.frames.set_context(&ctx);++ /// The app's only non-paint entry: one tick of background work.++ ///++ /// This runs for every eframe logic callback, including the logic-only ticks of a hidden++ /// window (which never reach [`Self::draw`]). It must therefore do no input handling, no++ /// layout and no presentation: engine/job queues, autosave, playback, audio, the control++ /// channel, screenshots and the close guard. Everything here is idempotent for a pass that++ /// `Context::request_discard` replays.++ pub fn tick(&mut self, ctx: &egui::Context, frame: &eframe::Frame) {++ self.now = self.clock.now();++ // The compositor exists before the first paint and while hidden (device-loss handling++ // must run there too).++ self.init_gpu(frame);++ self.apply_gpu_failure(ctx);++ if self.gpu_failure_applied == Some(true) {++ self.close_after_device_loss(ctx);++ return;++ }++ // Focus comes from the fresh viewport copy; a full pass's `InputState::focused` is only a++ // fallback (a logic-only tick leaves it at the previous pass's value).++ let focused = ctx.input(|i| i.viewport().focused.or(Some(i.focused)));++ self.focused = focused.unwrap_or(self.focused);++ // The interface language's fallback fonts are installed in `draw` (fonts need a pass), but++ // commands handled here use the right catalog already.++ let language = crate::i18n::language(self);++ crate::i18n::set_current(language);++ if self.styled_language != language {++ self.want_paint = true;++ }++ // Frames and worker completions wake the app even while it is hidden.++ self.frames.set_context(ctx);if self.session.render_job.is_some() {self.session.poll_render();ctx.request_repaint_after(std::time::Duration::from_millis(100));@@@ -1664,25 -1665,25 +2145,186 @@@self.session.poll_camera(true);ctx.request_repaint_after(std::time::Duration::from_millis(100));}-- self.run_script_tasks(&ctx);-- self.apply_prefs(&ctx);-- self.handle_events(&ctx);-- panels::unsaved::on_close_requested(self, &ctx);-- let title = panels::unsaved::window_title(self);-- if title != self.window_title {-- ctx.send_viewport_cmd(egui::ViewportCommand::Title(title.clone()));-- self.window_title = title;-- }-- self.tick_autosave(&ctx);-- prefs_live::frame(self, &ctx);++ self.run_script_tasks(ctx);++ self.run_dialog_answers();++ self.handle_events(ctx);if let Some(rx) = self.command_inbox.take() {while let Ok(id) = rx.try_recv() {-- if let Err(e) = menus::invoke(self, &ctx, &id, json!({})) {++ if let Err(e) = menus::invoke(self, ctx, &id, json!({})) {self.ui.status = e;}}self.command_inbox = Some(rx);}++ // A close request (the window's button, Quit, `app.quit`) must be answered while hidden.++ panels::unsaved::on_close_requested(self, ctx);++ let title = panels::unsaved::window_title(self);++ if title != self.window_title {++ ctx.send_viewport_cmd(egui::ViewportCommand::Title(title.clone()));++ self.window_title = title;++ }++ self.tick_autosave(ctx);++ self.tick_workspace_autosave(ctx);++ let now = self.now;++ prefs_live::tick(self, ctx, now);++ // Playback advances without a paint (its frames and the audio clock are background work).++ // Idle prefetch keeps its old condition: it only runs once a viewer has drawn.++ if (self.playback.playing || self.last_viewer_scale.is_some())++ && let Some(cid) = self.session.active_comp_id()++ {++ let (scale, active) = (self.last_viewer_scale.unwrap_or(1.0), self.input_active);++ self.advance_playback(ctx, scale, now, active, cid);++ }++ self.drain_control(ctx, now);++ // Screenshot completion, deadlines and issuance are app-side work: the callback only++ // stores pixels and wakes this viewport.++ self.tick_screenshots(ctx);++ // Time-based FPS readout over UI passes (a hidden logic-only tick is not a frame).++ let dt = (now - self.last_time) as f32;++ if dt > 0.0 && dt < 2.0 {++ self.fps = self.fps * 0.9 + (1.0 / dt).min(480.0) * 0.1;++ }++ self.last_time = now;++ // A hidden window paints when work needs a UI pass: queued input and waits, a settled++ // screenshot, or playback into a child viewport.++ let focused = self.focused;++ let child_viewports = !self.ui.floating.is_empty() || prefs_live::video_preview_active(self, focused);++ let paint = self.want_paint++ || !self.synthetic.is_empty()++ || !self.input_waiters.is_empty()++ || self.pending_screenshots.iter().any(|s| s.slot.is_none())++ || (self.playback.playing && child_viewports);++ if paint {++ self.request_hidden_paint(ctx);++ }++ }++++ /// Ask the host for a UI pass even when the window is minimized or occluded.++ ///++ /// Native eframe honours `RequestPaintWhileHidden`; the shared web backend does not carry it++ /// yet (a browser does not paint a hidden tab), so the web build only requests a normal++ /// repaint and hidden web screenshots/input remain unqualified.++ fn request_hidden_paint(&mut self, ctx: &egui::Context) {++ self.want_paint = false;++ #[cfg(not(target_arch = "wasm32"))]++ ctx.send_viewport_cmd(egui::ViewportCommand::RequestPaintWhileHidden);++ ctx.request_repaint();++ }++++ /// Install the theme and fonts for the current language. Fonts need a real pass: the pass++ /// that installs them draws nothing, and the next pass draws with them (the two-pass warm-up++ /// the app has always had). Never call this from a logic-only tick.++ fn ui_setup(&mut self, ctx: &egui::Context) {++ panels::viewer_text::install_hooks(ctx);++ let language = crate::i18n::language(self);++ crate::i18n::set_current(language);++ if (!self.styled || self.styled_language != language) && self.synthetic_in_flight {++ // The install needs a pass that draws nothing, but this pass has already applied a++ // synthetic batch: defer the theme/font install by one pass instead of dropping the++ // input (feeds are only put into a pass that can draw).++ ctx.request_repaint();++ return;++ }++ if !self.styled || self.styled_language != language {++ theme::install(ctx, &self.tokens, language);++ self.styled_language = language;++ if !self.styled {++ fit_window(ctx);++ self.styled = true;++ }++ self.fonts_ready = false;++ ctx.request_repaint();++ } else if !self.fonts_ready {++ // The pass after the install draws: egui has the new font definitions by now.++ self.fonts_ready = true;++ ctx.request_repaint();++ }++ }++++ /// One UI pass: setup, input-driven shortcuts, layout and painting. Called from++ /// `eframe::App::ui` and by tests with the root `Ui`.++ pub fn draw(&mut self, ui: &mut egui::Ui, frame: &eframe::Frame) {++ panels::viewer_text::begin_ui(ui.ctx());++ self.draw_inner(ui, frame);++ // All exits, including fonts/device loss, observe this pass's real custom availability.++ panels::viewer_text::finish_ime(self, ui);++ }++++ /// Context creators install these hooks before the first full pass.++ pub fn install_ime_reset_hooks(ctx: &egui::Context) {++ panels::viewer_text::install_hooks(ctx);++ }++++ /// Host wrappers call this after their last logic mutation, without replaying UI events.++ pub fn finish_ime_logic(&self, ctx: &egui::Context) {++ panels::viewer_text::finish_logic(self, ctx);++ }++++ fn draw_inner(&mut self, ui: &mut egui::Ui, frame: &eframe::Frame) {++ let ctx = ui.ctx().clone();++ if self.gpu_failure_applied == Some(true) {++ self.close_after_device_loss(&ctx);++ return;++ }++ self.ui_setup(&ctx);++ if !self.fonts_ready {++ // A pass that installs fonts draws nothing. No synthetic batch is in flight here (the++ // hook feeds input only to a ready app), and events egui already applied are never++ // fed again: that would double the pointer/key state of one click.++ ctx.request_repaint();++ return;++ }++ self.frame(ui);++ #[cfg(not(target_arch = "wasm32"))]++ pointer_wrap::finish_native(&ctx, frame);++ // wasm32: no frame threads; render queued frames now, between UI frames.++ if cfg!(target_arch = "wasm32") && self.frames.pump(std::time::Duration::from_millis(if self.playback.playing { 24 } else { 40 })) {++ ctx.request_repaint();++ }++ // Input belongs to this known UI phase: record it for the next tick.++ let active = ctx.input(|i| !i.events.is_empty() || i.pointer.any_down() || i.pointer.is_moving());++ self.input_active = active;++ self.last_pointer_down = ctx.input(|i| i.pointer.any_down());++ // Geometry of a completed pass (a discarded pass is laid out again; only the final one++ // describes the surface the next capture will see). Window position is irrelevant.++ if !ctx.will_discard() {++ let rect = ctx.content_rect();++ let ppp = ctx.pixels_per_point();++ let changed = self.draw_geom.is_none_or(|g| g.rect.size() != rect.size() || g.ppp != ppp);++ if changed {++ self.geometry_epoch = self.geometry_epoch.wrapping_add(1);++ }++ self.draw_geom = Some(DrawGeometry { rect, ppp, epoch: self.geometry_epoch });++ self.ui_pass_seq = self.ui_pass_seq.saturating_add(1);++ }++ // A batch is acknowledged once a UI pass applied it, even if layout was later discarded.++ self.mark_synthetic_applied();++ // `AfterInput` replies wait for the final (non-discarded) pass that applied the last++ // synthetic event: a hidden request is answered only after its forced pass, and a pass++ // egui throws away cannot produce an early success reply.++ if !ctx.will_discard() && self.synthetic.is_empty() {++ for w in self.input_waiters.drain(..) {++ let _ = w.send(json!({"ok": true, "result": null}));++ }++ } else if !self.input_waiters.is_empty() {++ self.want_paint = true;++ ctx.request_repaint();++ }++ if self.frames.inflight() > 0 {++ ctx.request_repaint_after(std::time::Duration::from_millis(30));++ }++ }++++ /// The panels, menus, dialogs and overlays of one pass.++ fn frame(&mut self, ui: &mut egui::Ui) {++ let ctx = ui.ctx().clone();++ // Only a viewer that draws in *this* pass records a scale: a closed viewer, the Home++ // screen or another comp must stop idle prefetch at a stale scale.++ self.last_viewer_scale = None;++ self.apply_prefs(&ctx);++ // Video Preview is a second viewport: only a real pass can update it.++ prefs_live::frame(self, &ctx);++ self.auto.begin_frame();let tab_had_widget_focus = ctx.egui_wants_keyboard_input();menus::handle_shortcuts(self, &ctx);if !ctx.input(|i| i.pointer.primary_down()) {@@@ -1720,13 -1721,13 +2362,19 @@@panels::learn::coach(self, &ctx);let lift = panels::media_panels::import_card(self, ui, full);self.draw_toast(ui, full, lift);-- if self.session.config.is_some() && self.workspace_store.has_changes(&self.ui) && !ctx.input(|i| i.pointer.any_down()) {-- if self.workspace_store.due(ctx.input(|i| i.time)) {-- self.save_workspace_state();-- }-- if self.workspace_store.has_changes(&self.ui) {-- ctx.request_repaint_after(std::time::Duration::from_secs(1));-- }++ }++++ /// Workspace-layout auto-save: a background write that also runs while hidden, once the++ /// pointer has lifted.++ fn tick_workspace_autosave(&mut self, ctx: &egui::Context) {++ if self.session.config.is_none() || !self.workspace_store.has_changes(&self.ui) || self.last_pointer_down {++ return;++ }++ if self.workspace_store.due(self.now) {++ self.save_workspace_state();++ }++ if self.workspace_store.has_changes(&self.ui) {++ ctx.request_repaint_after(std::time::Duration::from_secs(1));}}@@@ -1743,7 -1744,7 +2391,7 @@@/// The status message or the latest toast, bottom left (`lift` points higher while the/// Importing card is there).fn draw_toast(&mut self, ui: &mut egui::Ui, full: egui::Rect, lift: f32) {-- let now = ui.input(|i| i.time);++ let now = self.now;let msg = if !self.ui.status.is_empty() {Some(self.ui.status.clone())} else {@@@ -1757,18 -1758,18 +2405,18 @@@ui.painter().rect_stroke(r, 6.0, egui::Stroke::new(1.0, t.field_border), egui::StrokeKind::Inside);ui.painter().galley(r.min + egui::vec2(12.0, 7.0), galley, t.text);self.auto.add("toast", r, &m);-- let resp = ui.interact(r, egui::Id::new("toast"), egui::Sense::click());++ let resp = ui.interact(r, egui::Id::unique("toast"), egui::Sense::click());if resp.clicked() {self.ui.status.clear();self.toast = None;}ui.ctx().request_repaint_after(std::time::Duration::from_millis(500));if !self.ui.status.is_empty() {-- let since: f64 = ui.data(|d| d.get_temp(egui::Id::new("status-since")).unwrap_or(now));-- ui.data_mut(|d| d.insert_temp(egui::Id::new("status-since"), since));++ let since: f64 = ui.data(|d| d.get_temp(egui::Id::unique("status-since")).unwrap_or(now));++ ui.data_mut(|d| d.insert_temp(egui::Id::unique("status-since"), since));if now - since > 5.0 {self.ui.status.clear();-- ui.data_mut(|d| d.remove::<f64>(egui::Id::new("status-since")));++ ui.data_mut(|d| d.remove::<f64>(egui::Id::unique("status-since")));}}}@@@ -1783,9 -1784,13 +2431,13 @@@ impl EffectcraftAppif self.session.script_ui.task_hosts.is_empty() {return;}+ let previous_comp = self.session.active_comp_id();let Some(r) = effectcraft_engine::scriptui::ScriptUi::run_tasks(&mut self.session) else { return };+ if self.session.active_comp_id().is_some() && self.session.active_comp_id() != previous_comp {+ self.ui.start_screen = false;+ }if let Some(msg) = r["errors"].as_array().and_then(|e| e.first()).and_then(|e| e["message"].as_str()) {-- self.toast = Some((format!("Scheduled script task: {msg}"), ctx.input(|i| i.time)));++ self.toast = Some((format!("Scheduled script task: {msg}"), self.now));} else if let Some(line) = r["output"].as_array().and_then(|o| o.last()).and_then(|l| l.as_str()) {self.ui.status = line.to_string();}@@@ -1796,7 -1801,7 +2448,8 @@@/// Auto-save a dirty project when the interval has passed (Settings ▸ Project ▸ Auto-Save).fn tick_autosave(&mut self, ctx: &egui::Context) {-- let now = web_time::SystemTime::now().duration_since(web_time::UNIX_EPOCH).map(|d| d.as_secs_f64()).unwrap_or(0.0);++ // Monotonic app time: a wall-clock jump must not skip or repeat an auto-save.++ let now = self.now;if let Some(Err(e)) = self.session.autosave_tick(now) {self.ui.status = e.to_string();}@@@ -1805,7 -1810,7 +2458,7 @@@}// File ▸ Watch Folder: look for new projects every 10 seconds.if self.session.state.watch_folder.is_some() {-- let key = egui::Id::new("watchFolder.lastPoll");++ let key = egui::Id::unique("watchFolder.lastPoll");let last: f64 = ctx.data(|d| d.get_temp(key)).unwrap_or(0.0);if now - last >= 10.0 {ctx.data_mut(|d| d.insert_temp(key, now));@@@ -1831,8 -1836,8 +2484,8 @@@if let Some(Err(e)) = footage_reload::poll_scan(&mut self.session) {self.ui.status = e.to_string();}-- let (last_key, focus_key) = (egui::Id::new("footageReload.lastScan"), egui::Id::new("footageReload.focused"));-- let focused = ctx.input(|i| i.focused);++ let (last_key, focus_key) = (egui::Id::unique("footageReload.lastScan"), egui::Id::unique("footageReload.focused"));++ let focused = self.focused;let was_focused: bool = ctx.data(|d| d.get_temp(focus_key)).unwrap_or(focused);ctx.data_mut(|d| d.insert_temp(focus_key, focused));if self.session.prefs.import.auto_reload_footage == "off" || self.session.project.items.is_empty() {@@@ -1868,84 -1873,84 +2521,37 @@@ impl eframe::App for EffectcraftApp}fn raw_input_hook(&mut self, ctx: &egui::Context, raw_input: &mut egui::RawInput) {-- let injected = !self.synthetic.is_empty();-- self.feed_synthetic(raw_input);++ let injected = self.synthetic_in_flight || !self.synthetic.is_empty();++ // Only a pass that can draw may receive synthetic input: `Context::run_ui` applies++ // everything the hook feeds to its input state, so a pass that cannot draw (fonts still++ // installing) would consume a batch it could not put back — putting it back would apply++ // the click/key state twice. The queue waits here for the first pass that draws.++ if self.fonts_ready {++ self.feed_synthetic(raw_input);++ }if pointer_wrap::prepare_input(ctx, raw_input, injected) {self.session.history.merge_key = None;}}-- fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {-- self.apply_gpu_failure(ctx);-- // The CJK fallback fonts depend on the interface language, so they follow a change of-- // Settings ▸ General ▸ Language instead of only the first frame.-- let language = crate::i18n::language(self);-- crate::i18n::set_current(language);-- if !self.styled || self.styled_language != language {-- theme::install(ctx, &self.tokens, language);-- self.styled_language = language;-- if !self.styled {-- fit_window(ctx);-- self.styled = true;-- }-- ctx.request_repaint();-- } else {-- self.fonts_ready = true;-- }-- let now = ctx.input(|i| i.time);-- let dt = (now - self.last_time) as f32;-- if dt > 0.0 {-- self.fps = self.fps * 0.9 + (1.0 / dt).min(480.0) * 0.1;-- }-- self.last_time = now;-- self.drain_control(ctx);-- if !self.synthetic.is_empty() {-- ctx.request_repaint();-- } else if !self.input_waiters.is_empty() {-- for w in self.input_waiters.drain(..) {-- let _ = w.send(json!({"ok": true, "result": null}));-- }-- }-- self.issue_screenshots(ctx);-- self.collect_screenshots(ctx);++ fn logic(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {++ // Never `ctx.input(|i| i.time)` here: `Context::run_logic` leaves events, pointer state and++ // time at the previous full pass's values (only the viewport information is refreshed).++ self.tick(ctx, frame);++ self.finish_ime_logic(ctx);}fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) {-- if self.gpu_failure_applied == Some(true) {-- self.close_after_device_loss(ui.ctx());-- return;-- }-- self.init_gpu(frame);-- if !self.fonts_ready {-- ui.ctx().request_repaint();-- return;-- }-- self.frame(ui);-- let ctx = ui.ctx().clone();-- #[cfg(not(target_arch = "wasm32"))]-- pointer_wrap::finish_native(&ctx, frame);-- // wasm32: no frame threads; render queued frames now, between UI frames.-- if cfg!(target_arch = "wasm32") && self.frames.pump(std::time::Duration::from_millis(if self.playback.playing { 24 } else { 40 })) {-- ctx.request_repaint();-- }-- self.last_ui_time = ctx.input(|i| i.time);-- if !self.synthetic.is_empty() {-- ctx.request_repaint();-- } else if !self.input_waiters.is_empty() {-- ctx.request_repaint();-- for w in self.input_waiters.drain(..) {-- let _ = w.send(json!({"ok": true, "result": null}));-- }-- }-- if self.frames.inflight() > 0 {-- ctx.request_repaint_after(std::time::Duration::from_millis(30));-- }++ self.draw(ui, frame);}}--/// Advance playback with the viewer's scale (called by the viewer panel each frame).--pub(crate) fn tick_playback(app: &mut EffectcraftApp, ctx: &egui::Context, scale: f64) {-- app.advance_playback(ctx, scale);++/// Record the scale the viewer drew at (called by the viewer panel each pass).++///++/// Playback itself advances in [`EffectcraftApp::tick`], so it keeps running while the window is++/// hidden; using the last drawn scale keeps prefetch keys consistent with the visible viewer.++pub(crate) fn note_viewer_scale(app: &mut EffectcraftApp, scale: f64) {++ app.last_viewer_scale = Some(scale);}/// Put `width` × `height` straight-alpha RGBA8 pixels on the system clipboard (Composition ▸ Copy@@@ -2180,3 -2185,3 +2786,521 @@@ mod appearance_testsassert_eq!(app.ui.theme, ThemeKind::Darker);}}++++#[cfg(test)]++mod lifecycle_tests {++ //! The logic-only / UI-pass split: queue work in `tick`, input, layout and setup in `draw`.++ //!++ //! The driver mirrors eframe's order for a hidden window: `raw_input_hook` prepares the raw++ //! input, a logic-only iteration runs `tick`, and a forced pass runs `draw` with the same++ //! prepared input. Nothing may depend on `current_pass_index`, which is zero in both.++++ use super::*;++ use effectcraft_engine::config::{ConfigStore, MemoryConfig};++++ fn app_with_comp() -> EffectcraftApp {++ let mut session = Session::default();++ session.execute("comp.new", json!({"name": "Lifecycle", "width": 64, "height": 36, "duration": 1})).unwrap();++ session.execute("layer.newSolid", json!({"color": "#ff0000"})).unwrap();++ let mut app = EffectcraftApp::new(session);++ app.ui.start_screen = false;++ app.ui.show_menu_bar = false;++ app.use_manual_clock();++ app++ }++++ fn raw(size: egui::Vec2) -> egui::RawInput {++ egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, size)), ..Default::default() }++ }++++ fn tick_with(app: &mut EffectcraftApp, ctx: &egui::Context, frame: &eframe::Frame, raw: &egui::RawInput) -> egui::LogicOutput {++ ctx.run_logic(raw, |ctx| app.tick(ctx, frame))++ }++++ fn hidden_tick(app: &mut EffectcraftApp, ctx: &egui::Context, frame: &eframe::Frame) {++ let _ = tick_with(app, ctx, frame, &raw(egui::vec2(800.0, 480.0)));++ }++++ /// One host iteration that ends in a UI pass (the forced hidden pass, or a visible frame).++ fn pass(app: &mut EffectcraftApp, ctx: &egui::Context, frame: &eframe::Frame, raw: &mut egui::RawInput) -> egui::FullOutput {++ eframe::App::raw_input_hook(app, ctx, raw);++ let mut out = ctx.run_ui(raw.take(), |ui| app.draw(ui, frame));++ out.textures_delta.clear();++ out++ }++++ fn ready(app: &mut EffectcraftApp, ctx: &egui::Context, frame: &eframe::Frame) -> DrawGeometry {++ // The first pass installs the fonts, the second draws with them.++ for _ in 0..3 {++ let mut raw = raw(egui::vec2(800.0, 480.0));++ pass(app, ctx, frame, &mut raw);++ }++ assert!(app.is_ready(), "fonts are ready after the warm-up passes");++ app.draw_geometry().expect("a completed pass records its geometry")++ }++++ fn send(app: &mut EffectcraftApp, method: &str, params: serde_json::Value) -> std::sync::mpsc::Receiver<serde_json::Value> {++ let (request, reply) = ControlRequest::new(method, params);++ let (tx, rx) = std::sync::mpsc::channel();++ tx.send(request).unwrap();++ app.control_rx = Some(rx);++ reply++ }++++ #[test]++ fn a_logic_only_tick_installs_no_fonts_and_records_no_geometry() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ hidden_tick(&mut app, &ctx, &frame);++ assert!(!app.is_ready(), "fonts need a real pass, not a logic-only tick");++ assert!(app.draw_geometry().is_none(), "a logic-only tick is not a frame");++ assert_eq!(app.ui_passes(), 0);++ }++++ #[test]++ fn a_control_command_that_needs_no_ui_completes_without_a_pass() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ let reply = send(&mut app, "engine.execute", json!({"command": "comp.new", "params": {"name": "Queued", "width": 32, "height": 18, "duration": 1}}));++ hidden_tick(&mut app, &ctx, &frame);++ let value = reply.try_recv().expect("a command that needs no UI is answered by the tick");++ assert_eq!(value["ok"], true, "{value}");++ assert_eq!(app.ui_passes(), 0);++ }++++ #[test]++ fn a_pass_that_cannot_draw_receives_no_synthetic_input() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ assert!(!app.is_ready(), "a fresh app installs its fonts in its first pass");++ let reply = send(&mut app, "ui.click", json!({"x": 40, "y": 40}));++ hidden_tick(&mut app, &ctx, &frame);++ assert!(reply.try_recv().is_err(), "a click is not answered before its UI pass");++ // The font-install pass cannot draw. It must not receive the click: `run_ui` applies what++ // the hook feeds, and a batch cannot be put back without applying its pointer state twice.++ let mut setup = raw(egui::vec2(800.0, 480.0));++ eframe::App::raw_input_hook(&mut app, &ctx, &mut setup);++ assert!(setup.events.is_empty(), "a pass that cannot draw gets no synthetic input");++ assert_eq!(app.synthetic.len(), 5, "the whole gesture still waits for a drawing pass");++ assert!(app.pending_synthetic_events().is_empty());++ let mut setup_pass = ctx.run_ui(setup.take(), |ui| app.draw(ui, &frame));++ setup_pass.textures_delta.clear();++ assert!(!app.is_ready(), "the pass that installs the fonts draws nothing");++ // Once fonts are ready the click reaches the UI exactly once, one event per pass.++ let mut passes = 0;++ while reply.try_recv().is_err() {++ passes += 1;++ assert!(passes < 40, "the click must be applied within a few passes");++ let mut raw = raw(egui::vec2(800.0, 480.0));++ pass(&mut app, &ctx, &frame, &mut raw);++ }++ assert!(reply.try_recv().is_err(), "the reply is sent once");++ assert!(app.pending_synthetic_events().is_empty());++ assert!(app.synthetic.is_empty(), "every event was applied once");++ }++++ #[test]++ fn one_pending_synthetic_batch_is_never_duplicated_while_hidden() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ ready(&mut app, &ctx, &frame);++ let reply = send(&mut app, "ui.click", json!({"x": 40, "y": 40}));++ hidden_tick(&mut app, &ctx, &frame);++ assert!(reply.try_recv().is_err(), "a click is not answered before its UI pass");++ // Several hidden host iterations: eframe keeps the first prepared input; only its one++ // event may reach the raw input, and a later hook must not add another.++ let mut first = raw(egui::vec2(800.0, 480.0));++ eframe::App::raw_input_hook(&mut app, &ctx, &mut first);++ assert_eq!(first.events.len(), 1, "the first event of the gesture is fed");++ let mut second = raw(egui::vec2(800.0, 480.0));++ eframe::App::raw_input_hook(&mut app, &ctx, &mut second);++ assert!(second.events.is_empty(), "an unapplied batch blocks the next event");++ assert_eq!(app.pending_synthetic_events().len(), 1);++ // The pass that applies the batch acknowledges it once; it is never fed again.++ pass(&mut app, &ctx, &frame, &mut first);++ assert!(app.pending_synthetic_events().is_empty());++ // Drive real passes until the gesture is applied: exactly one reply, no lost events.++ let mut passes = 0;++ while reply.try_recv().is_err() {++ passes += 1;++ assert!(passes < 40, "the click must be applied within a few passes");++ let mut raw = raw(egui::vec2(800.0, 480.0));++ pass(&mut app, &ctx, &frame, &mut raw);++ }++ assert!(app.pending_synthetic_events().is_empty());++ assert!(app.synthetic.is_empty());++ assert!(reply.try_recv().is_err(), "the reply is sent once");++ }++++ #[test]++ fn geometry_epoch_tracks_size_and_scale_but_not_window_position() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ let first = ready(&mut app, &ctx, &frame);++ let mut moved = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::pos2(120.0, 80.0), first.rect.size())), ..Default::default() };++ pass(&mut app, &ctx, &frame, &mut moved);++ assert_eq!(app.draw_geometry().unwrap().epoch, first.epoch, "moving the window does not change a capture");++ let mut resized = raw(egui::vec2(1024.0, 640.0));++ pass(&mut app, &ctx, &frame, &mut resized);++ let after_resize = app.draw_geometry().unwrap();++ assert!(after_resize.epoch > first.epoch, "a resize advances the epoch");++ let mut back = raw(egui::vec2(800.0, 480.0));++ pass(&mut app, &ctx, &frame, &mut back);++ assert!(app.draw_geometry().unwrap().epoch > after_resize.epoch, "changing back is another change, not the old epoch");++ }++++ #[test]++ fn only_a_viewer_that_draws_records_a_prefetch_scale() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ ready(&mut app, &ctx, &frame);++ assert!(app.last_viewer_scale.is_some(), "the visible viewer recorded the scale it drew at");++ // The Home screen draws no viewer: the old comp's scale must not keep idle prefetch alive.++ app.ui.start_screen = true;++ let mut input = raw(egui::vec2(800.0, 480.0));++ pass(&mut app, &ctx, &frame, &mut input);++ assert!(app.last_viewer_scale.is_none(), "no viewer drew, so there is no scale to prefetch at");++ // Back to the comp: the next pass records it again.++ app.ui.start_screen = false;++ let mut input = raw(egui::vec2(800.0, 480.0));++ pass(&mut app, &ctx, &frame, &mut input);++ assert!(app.last_viewer_scale.is_some());++ }++++ #[test]++ fn playback_advances_on_a_logic_only_tick() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ app.playback.playing = true;++ app.playback.plan = Some(effectcraft_engine::preview::PreviewPlan {++ start: 1,++ end: 1,++ first: 1,++ step: 1,++ fps: 24.0,++ looping: false,++ cache_first: false,++ video: false,++ audio: false,++ origin: Tick::ZERO,++ });++ app.playback.start_wall = 0.0;++ app.playback.start_frame = 1;++ app.clock_mut().advance(1.0);++ hidden_tick(&mut app, &ctx, &frame);++ assert!(!app.playback.playing, "a one-frame preview ends without any UI pass");++ assert_eq!(app.playback.audio_frame, Some(1), "the audio-only playhead reached the plan's end");++ assert_eq!(app.ui_passes(), 0);++ }++++ #[test]++ fn workspace_layout_autosave_writes_on_a_hidden_tick() {++ let store = Arc::new(MemoryConfig::default());++ let mut app = EffectcraftApp::new(Session { config: Some(store.clone()), ..Default::default() });++ app.ui.start_screen = false;++ app.use_manual_clock();++ app.ui.focused = PanelKind::Timeline;++ app.clock_mut().advance(2.0);++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ hidden_tick(&mut app, &ctx, &frame);++ assert!(store.read(WORKSPACES_FILE).is_some(), "the layout is saved while the window is hidden");++ assert_eq!(app.ui_passes(), 0);++ }++++ #[test]++ fn the_close_guard_answers_a_close_request_without_a_pass() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ assert!(app.session.is_dirty(), "creating a comp and a layer leaves unsaved changes");++ let mut raw = raw(egui::vec2(800.0, 480.0));++ raw.viewports.insert(egui::ViewportId::ROOT, egui::ViewportInfo { events: vec![egui::ViewportEvent::Close], ..Default::default() });++ let out = tick_with(&mut app, &ctx, &frame, &raw);++ assert!(app.dialog.is_some(), "a hidden close request opens the unsaved-changes prompt");++ let cancel = out.viewport_commands.values().flatten().any(|c| matches!(c, egui::ViewportCommand::CancelClose));++ assert!(cancel, "the window stays open while the prompt is asking");++ assert_eq!(app.ui_passes(), 0);++ }++++ // ---------------------------------------------------------------- screenshots++++ fn screenshot_request(++ app: &mut EffectcraftApp,++ ctx: &egui::Context,++ path: Option<&str>,++ target: ShotTarget,++ ) -> std::sync::mpsc::Receiver<serde_json::Value> {++ let (tx, rx) = std::sync::mpsc::channel();++ app.admit_screenshot(ctx, path.map(str::to_string), target, tx);++ rx++ }++++ fn shot_callbacks(out: &egui::LogicOutput) -> Vec<egui::ScreenshotCallback> {++ out.viewport_commands++ .values()++ .flatten()++ .filter_map(|c| match c {++ egui::ViewportCommand::Screenshot(cb) => Some(cb.clone()),++ _ => None,++ })++ .collect()++ }++++ /// Three settled passes and the settle delay, then the tick that issues the capture.++ fn issue_shot(app: &mut EffectcraftApp, ctx: &egui::Context, frame: &eframe::Frame) -> egui::ScreenshotCallback {++ issue_shot_at(app, ctx, frame, egui::vec2(800.0, 480.0))++ }++++ fn issue_shot_at(app: &mut EffectcraftApp, ctx: &egui::Context, frame: &eframe::Frame, size: egui::Vec2) -> egui::ScreenshotCallback {++ for _ in 0..SCREENSHOT_SETTLE_PASSES {++ let mut raw = raw(size);++ pass(app, ctx, frame, &mut raw);++ }++ app.clock_mut().advance(SCREENSHOT_SETTLE_S + 0.01);++ let out = tick_with(app, ctx, frame, &raw(size));++ let cbs = shot_callbacks(&out);++ assert_eq!(cbs.len(), 1, "one settled screenshot is issued once");++ cbs.into_iter().next().unwrap()++ }++++ fn image(width: usize, height: usize) -> Arc<egui::ColorImage> {++ Arc::new(egui::ColorImage::new([width, height], vec![egui::Color32::from_rgb(10, 20, 30); width.checked_mul(height).unwrap()]))++ }++++ #[test]++ fn a_screenshot_is_issued_only_after_settled_passes_and_writes_from_the_tick() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ ready(&mut app, &ctx, &frame);++ let path = std::env::temp_dir().join(format!("effectcraft-shot-{}-ok.png", std::process::id()));++ let _ = std::fs::remove_file(&path);++ let reply = screenshot_request(&mut app, &ctx, path.to_str(), ShotTarget::Window);++ // Not settled: a tick issues nothing and asks for passes instead.++ let out = tick_with(&mut app, &ctx, &frame, &raw(egui::vec2(800.0, 480.0)));++ assert!(shot_callbacks(&out).is_empty(), "no capture before the UI settles");++ assert_eq!(out.viewport_commands.values().flatten().filter(|c| matches!(c, egui::ViewportCommand::RequestPaintWhileHidden)).count(), 1);++ let cb = issue_shot(&mut app, &ctx, &frame);++ assert!(reply.try_recv().is_err(), "the callback must not write or reply itself");++ cb.complete(image(800, 480));++ hidden_tick(&mut app, &ctx, &frame);++ let value = reply.try_recv().expect("the tick drains the completed slot and replies");++ assert_eq!(value["ok"], true, "{value}");++ assert!(path.exists(), "{value}");++ assert_eq!(value["result"]["width"], 800);++ assert_eq!(value["result"]["height"], 480);++ assert_eq!(app.shot_bytes, 0, "the reservation is released");++ let _ = std::fs::remove_file(&path);++ }++++ #[test]++ fn a_resize_between_issue_and_completion_rejects_the_pixels_and_retries() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ ready(&mut app, &ctx, &frame);++ let path = std::env::temp_dir().join(format!("effectcraft-shot-{}-retry.png", std::process::id()));++ let _ = std::fs::remove_file(&path);++ let reply = screenshot_request(&mut app, &ctx, path.to_str(), ShotTarget::Window);++ let first = issue_shot(&mut app, &ctx, &frame);++ let size = egui::vec2(1024.0, 640.0);++ let mut resized = raw(size);++ pass(&mut app, &ctx, &frame, &mut resized);++ first.complete(image(800, 480));++ let _ = tick_with(&mut app, &ctx, &frame, &raw(size));++ assert!(reply.try_recv().is_err(), "pixels from the old surface epoch are discarded");++ assert!(!path.exists(), "a stale image is never written");++ // The retry is issued against the new geometry and the new image is accepted.++ let second = issue_shot_at(&mut app, &ctx, &frame, size);++ second.complete(image(1024, 640));++ let _ = tick_with(&mut app, &ctx, &frame, &raw(size));++ let value = reply.try_recv().expect("the retried capture replies");++ assert_eq!(value["ok"], true, "{value}");++ assert_eq!(value["result"]["width"], 1024);++ let _ = std::fs::remove_file(&path);++ }++++ #[test]++ fn screenshot_admission_bounds_requests_and_a_timeout_releases_its_reservation() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ ready(&mut app, &ctx, &frame);++ let mut replies = Vec::new();++ for _ in 0..MAX_PENDING_SHOTS {++ replies.push(screenshot_request(&mut app, &ctx, None, ShotTarget::Rect([0.0, 0.0, 4.0, 4.0])));++ }++ let refused = screenshot_request(&mut app, &ctx, None, ShotTarget::Rect([0.0, 0.0, 4.0, 4.0]));++ let value = refused.try_recv().expect("the fifth request is refused immediately");++ assert_eq!(value["ok"], false, "{value}");++ // Every queued request times out on a hidden window that presents no frame; each one++ // releases its reservation exactly once.++ app.clock_mut().advance(SCREENSHOT_TIMEOUT_S + 1.0);++ hidden_tick(&mut app, &ctx, &frame);++ for reply in replies {++ let value = reply.try_recv().expect("a timed-out request gets an actionable reply");++ assert_eq!(value["ok"], false, "{value}");++ assert!(value["error"].as_str().is_some_and(|e| e.contains("no frame")), "{value}");++ }++ assert_eq!(app.shot_bytes, 0);++ assert!(app.pending_screenshots.is_empty());++ }++++ #[test]++ fn a_late_callback_after_cancellation_writes_nothing_and_replies_once() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ ready(&mut app, &ctx, &frame);++ let path = std::env::temp_dir().join(format!("effectcraft-shot-{}-late.png", std::process::id()));++ let _ = std::fs::remove_file(&path);++ let reply = screenshot_request(&mut app, &ctx, path.to_str(), ShotTarget::Window);++ let late = issue_shot(&mut app, &ctx, &frame);++ app.clock_mut().advance(SCREENSHOT_TIMEOUT_S + 1.0);++ hidden_tick(&mut app, &ctx, &frame);++ let timeout = reply.try_recv().expect("the request times out");++ assert_eq!(timeout["ok"], false, "{timeout}");++ late.complete(image(800, 480));++ hidden_tick(&mut app, &ctx, &frame);++ assert!(reply.try_recv().is_err(), "a late completion sends no second reply");++ assert!(!path.exists(), "a late completion writes no file");++ assert_eq!(app.shot_bytes, 0);++ }++++ /// Every repaint delay requested on `ctx` (what a host uses to wake the app).++ fn wake_requests(ctx: &egui::Context) -> Arc<std::sync::Mutex<Vec<std::time::Duration>>> {++ let wakes: Arc<std::sync::Mutex<Vec<std::time::Duration>>> = Arc::default();++ let record = Arc::clone(&wakes);++ ctx.set_repaint_observer(move |i| record.lock().unwrap_or_else(std::sync::PoisonError::into_inner).push(i.delay));++ wakes++ }++++ #[test]++ fn an_issued_capture_schedules_a_wake_up_for_its_deadline() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ ready(&mut app, &ctx, &frame);++ let reply = screenshot_request(&mut app, &ctx, None, ShotTarget::Window);++ for _ in 0..SCREENSHOT_SETTLE_PASSES {++ let mut raw = raw(egui::vec2(800.0, 480.0));++ pass(&mut app, &ctx, &frame, &mut raw);++ }++ app.clock_mut().advance(SCREENSHOT_SETTLE_S + 0.01);++ // Record the repaint requests of the tick that issues the capture only.++ let wakes = wake_requests(&ctx);++ let out = tick_with(&mut app, &ctx, &frame, &raw(egui::vec2(800.0, 480.0)));++ assert_eq!(shot_callbacks(&out).len(), 1, "the settled capture is issued once");++ let delays = wakes.lock().unwrap_or_else(std::sync::PoisonError::into_inner).clone();++ // The deadline is 8 s after admission; the capture was issued ~0.31 s in, so the app must++ // ask for a wake-up close to that timeout, not only for the next paint.++ let deadline_wake = delays.iter().any(|d| d.as_secs_f64() > 7.0 && d.as_secs_f64() <= SCREENSHOT_TIMEOUT_S);++ assert!(deadline_wake, "an issued capture asks the host to wake for its timeout: {delays:?}");++ // The callback never arrives (a hidden window or a display asleep). The host wakes at the++ // requested delay; without this wake-up the timeout below could never be evaluated.++ app.clock_mut().advance(SCREENSHOT_TIMEOUT_S + 1.0);++ hidden_tick(&mut app, &ctx, &frame);++ let value = reply.try_recv().expect("the deadline wake-up produces the timeout reply");++ assert_eq!(value["ok"], false, "{value}");++ assert!(value["error"].as_str().is_some_and(|e| e.contains("no frame")), "{value}");++ assert_eq!(app.shot_bytes, 0);++ assert!(app.pending_screenshots.is_empty());++ }++++ #[test]++ fn a_downscaled_capture_is_cropped_with_the_images_own_scale() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ let geom = ready(&mut app, &ctx, &frame);++ assert_eq!((geom.rect.width(), geom.rect.height(), geom.ppp), (800.0, 480.0, 1.0));++ // The adapter-limit fit (E2) returned half the requested pixels. Left red, right blue.++ let fitted =++ Arc::new(egui::ColorImage::new([400, 240], (0..400 * 240).map(|i| if i % 400 < 200 { egui::Color32::RED } else { egui::Color32::BLUE }).collect()));++ let dir = std::env::temp_dir();++ for (name, crop, want) in [("left", [0.0, 0.0, 400.0, 240.0], egui::Color32::RED), ("right", [400.0, 0.0, 400.0, 240.0], egui::Color32::BLUE)] {++ let path = dir.join(format!("effectcraft-shot-{}-scale-{name}.png", std::process::id()));++ let _ = std::fs::remove_file(&path);++ let reply = screenshot_request(&mut app, &ctx, path.to_str(), ShotTarget::Rect(crop));++ let cb = issue_shot(&mut app, &ctx, &frame);++ cb.complete(Arc::clone(&fitted));++ hidden_tick(&mut app, &ctx, &frame);++ let value = reply.try_recv().expect("the downscaled capture replies");++ assert_eq!(value["ok"], true, "{value}");++ assert_eq!(value["result"]["width"], 200, "{value}");++ assert_eq!(value["result"]["height"], 120, "{value}");++ let png = std::fs::read(&path).expect("the PNG is written");++ let decoded = image::load_from_memory(&png).expect("our PNG decodes").to_rgba8();++ assert_eq!((decoded.width(), decoded.height()), (200, 120), "{value}");++ let px = decoded.get_pixel(100, 60).0;++ assert!(px[0] == want.r() && px[1] == want.g() && px[2] == want.b(), "{name}: {px:?} is not from its half of the fitted image");++ let _ = std::fs::remove_file(&path);++ }++ }++++ #[test]++ fn a_capture_before_any_pass_never_uses_the_window_frame_rect() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ // Only the outer (title bar included) rectangle is known: it is not the captured surface.++ let outer = egui::Rect::from_min_size(egui::pos2(0.0, -30.0), egui::vec2(800.0, 510.0));++ let mut raw = egui::RawInput::default();++ raw.viewports.insert(egui::ViewportId::ROOT, egui::ViewportInfo { outer_rect: Some(outer), ..Default::default() });++ let _ = tick_with(&mut app, &ctx, &frame, &raw);++ let (tx, reply) = std::sync::mpsc::channel();++ app.admit_screenshot(&ctx, None, ShotTarget::Window, tx);++ let value = reply.try_recv().expect("the request is answered now");++ assert_eq!(value["ok"], false, "{value}");++ assert!(value["error"].as_str().is_some_and(|e| e.contains("geometry is not known")), "{value}");++ assert!(app.pending_screenshots.is_empty(), "nothing was reserved against the wrong rectangle");++ assert_eq!(app.shot_bytes, 0);++ assert!(app.want_paint, "the pass that records the geometry is requested");++ }++++ #[test]++ fn an_element_that_moves_while_the_ui_settles_is_captured_where_it_is() {++ let ctx = egui::Context::default();++ let frame = eframe::Frame::_new_kittest();++ let mut app = app_with_comp();++ let geom = ready(&mut app, &ctx, &frame);++ // Any registered panel: the crop follows this element's rectangle.++ let panel = app.auto.previous.iter().chain(app.auto.elements.iter()).find(|e| e.id.starts_with("panel.")).map(|e| e.id.clone());++ let panel = panel.expect("a dock panel is on screen after a completed pass");++ let reply = screenshot_request(&mut app, &ctx, None, ShotTarget::Id(panel.clone()));++ for _ in 0..SCREENSHOT_SETTLE_PASSES {++ let mut raw = raw(egui::vec2(800.0, 480.0));++ pass(&mut app, &ctx, &frame, &mut raw);++ }++ // The panel moves after its last draw: the crop must follow it, not the admission rect.++ let moved = [40.0, 30.0, 300.0, 200.0];++ for list in [&mut app.auto.previous, &mut app.auto.elements] {++ if let Some(e) = list.iter_mut().find(|e| e.id == panel) {++ e.rect = moved;++ }++ }++ app.clock_mut().advance(SCREENSHOT_SETTLE_S + 0.01);++ let out = tick_with(&mut app, &ctx, &frame, &raw(egui::vec2(800.0, 480.0)));++ assert_eq!(shot_callbacks(&out).len(), 1, "the settled capture is issued once");++ let crop = app.pending_screenshots.first().and_then(|s| s.crop).expect("the element crop is resolved at issuance");++ assert!((crop[0] - (moved[0] - geom.rect.min.x)).abs() < 0.01, "{crop:?}");++ assert!((crop[1] - (moved[1] - geom.rect.min.y)).abs() < 0.01, "{crop:?}");++ assert!((crop[2] - moved[2]).abs() < 0.01 && (crop[3] - moved[3]).abs() < 0.01, "{crop:?}");++ // Let it complete and reply, so the request does not outlive the test.++ if let Some(cb) = shot_callbacks(&out).into_iter().next() {++ cb.complete(image(800, 480));++ }++ hidden_tick(&mut app, &ctx, &frame);++ let value = reply.try_recv().expect("the capture replies");++ assert_eq!(value["ok"], true, "{value}");++ assert_eq!((value["result"]["width"].as_u64(), value["result"]["height"].as_u64()), (Some(300), Some(200)), "{value}");++ }++}diff --cc crates/ui-egui/src/menu_keys.rsindex 397385309,9477e142b..71e3b6425--- a/crates/ui-egui/src/menu_keys.rs+++ b/crates/ui-egui/src/menu_keys.rs@@@ -55,16 -61,16 +61,16 @@@ struct KeyOpened}fn pending_id() -> Id {-- Id::new("menu-keys-first")++ Id::unique("menu-keys-first")}fn opened_id() -> Id {-- Id::new("menu-keys-opened")++ Id::unique("menu-keys-opened")}fn active_id() -> Id {-- Id::new("menu-keys-active")++ Id::unique("menu-keys-active")}fn alt_id() -> Id {-- Id::new("menu-keys-alt")++ Id::unique("menu-keys-alt")}impl Nav {@@@ -81,7 -118,7 +118,7 @@@}let Some(level) = self.levels.get_mut(depth) else { return };if level.menu.is_none() {-- level.menu = Some(find_menu_root(ui).id);++ level.menu = Some(find_menu_root(ui).scope_id);level.sizing = ui.is_sizing_pass();}level.rows.push(Row { id: r.id, enabled: r.enabled(), submenu });diff --cc crates/ui-egui/src/menus.rsindex 36a85aef5,ea9a6d91e..851f6fb07--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@@ -363,7 -367,7 +367,7 @@@ pub fn invoke(app: &mut EffectcraftAppreturn invoke(app, ctx, "project.delete", json!({}));}if id == "edit.clear" && params.as_object().is_some_and(|p| p.is_empty()) && app.ui.focused == PanelKind::RenderQueue {-- let selected = ctx.data(|d| d.get_temp::<(Vec<u64>, Option<u64>)>(egui::Id::new("rq-ui"))).and_then(|(_, id)| id);++ let selected = ctx.data(|d| d.get_temp::<(Vec<u64>, Option<u64>)>(egui::Id::unique("rq-ui"))).and_then(|(_, id)| id);return match selected {Some(item) => run_engine(app, ctx, "renderQueue.remove", json!({"item": item})),None => Err("select a Render Queue item first".into()),@@@ -377,7 -381,7 +381,7 @@@}return crate::panels::delete_items::delete_confirmed(app, ctx, json!({}));}-- let now = ctx.input(|i| i.time);++ let now = app.now();// Closing a modified project asks to save it first; the command runs once answered.if crate::panels::unsaved::guard(app, id, ¶ms) {return Ok(json!({"dialog": "unsavedChanges"}));@@@ -907,7 -915,7 +915,7 @@@ fn toggle(slot: &mut bool, p: &Value) -/// Perform a frontend command (from `Event::Frontend`).pub fn frontend(app: &mut EffectcraftApp, ctx: &egui::Context, id: &str, p: Value) -> Result<Value, String> {-- let now = ctx.input(|i| i.time);++ let now = app.now();let v = &mut app.ui.viewer;Ok(match id {"mediaBrowser.copySourcePath" => {@@@ -1236,7 -1244,7 +1244,7 @@@"view.lookAt" => {let r: Vec<f64> = p.get("rect").and_then(Value::as_array).map(|a| a.iter().filter_map(Value::as_f64).collect()).unwrap_or_default();if r.len() == 4 {-- let map: Option<crate::panels::viewer::ViewerMap> = ctx.data(|d| d.get_temp(egui::Id::new("viewer-map")));++ let map: Option<crate::panels::viewer::ViewerMap> = ctx.data(|d| d.get_temp(egui::Id::unique("viewer-map")));if let Some(m) = map {let (rw, rh) = (((r[2] - r[0]) as f32).max(1.0), ((r[3] - r[1]) as f32).max(1.0));let zoom = ((m.area.width() - 40.0) / rw).min((m.area.height() - 40.0) / rh).clamp(0.015, 32.0);@@@ -1790,17 -1820,17 +1820,17 @@@ pub fn forwardable_during_text_edit(mod/// run the Spacebar shortcut./// The system clipboard's text of this frame's paste event, for the Edit ▸ Paste it runs.fn system_paste_id() -> egui::Id {-- egui::Id::new("menus-system-paste")++ egui::Id::unique("menus-system-paste")}fn space_tap_id() -> egui::Id {-- egui::Id::new("spacebar-tap")++ egui::Id::unique("spacebar-tap")}/// The modifiers held when this frame's input began: the state the last pass ended with, if it/// ran this (egui keeps only the state after the frame's events). Records this pass's state.fn modifiers_at_start(ctx: &egui::Context) -> Option<egui::Modifiers> {-- let id = egui::Id::new("shortcut-modifiers");++ let id = egui::Id::unique("shortcut-modifiers");let pass = ctx.cumulative_pass_nr();let now = ctx.input(|i| i.modifiers);ctx.data_mut(|d| {@@@ -2033,7 -2063,27 +2063,27 @@@ fn handle_shortcuts_impl(app: &mut Effe}}+ /// The id under which [`menu_bar`] remembers which of its menus was open at the end of the last+ /// frame (its title's open look, and the hover that switches between the titles).+ fn open_menu_id() -> egui::Id {- egui::Id::new("menu-bar-open")++ egui::Id::unique("menu-bar-open")+ }++ /// The id under which [`menu_bar`] remembers a title press still in progress (press-and-browse).+ fn browse_menu_id() -> egui::Id {- egui::Id::new("menu-bar-browse")++ egui::Id::unique("menu-bar-browse")+ }+/// Draw the in-window menu bar (the engine's AE menu tree).+ ///+ /// The titles open on the press, not the release (native menu bars): while one is held the menus+ /// can be browsed by moving onto them, and releasing over an entry chooses it. Hovering another+ /// title switches the open menu to it, and the open one closes on a press outside it or when the+ /// window loses focus. The pointer leaving the window — onto the OS title bar, directly above the+ /// bar — closes nothing, however long: the platform forwards none of the title bar's clicks to+ /// egui (only the cursor leaving), so there is no click to close on and a graze must not drop the+ /// menu. The closing press itself still reaches the widget under it, as a click does in After+ /// Effects.pub fn menu_bar(app: &mut EffectcraftApp, ui: &mut egui::Ui) {let ctx = ui.ctx().clone();let mut clicked: Option<(String, Value)> = None;diff --cc crates/ui-egui/src/panels/anim_tools.rsindex 15a4f4f89,d9bcb1717..17a69b807--- a/crates/ui-egui/src/panels/anim_tools.rs+++ b/crates/ui-egui/src/panels/anim_tools.rs@@@ -22,7 -22,7 +22,7 @@@ fn label(p: &egui::Painter, x: f32, y:/// A dropdown with options; returns the new index when changed.fn choice(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect, auto: &str, options: &[&str], cur: usize) -> Option<usize> {let t = app.tokens;-- let id = egui::Id::new(("animtool-dd", auto));++ let id = egui::Id::unique(("animtool-dd", auto));if widgets::dropdown(ui, r, options.get(cur).copied().unwrap_or(""), &t, id).clicked() {widgets::open_popup(ui, id);}@@@ -33,7 -33,7 +33,7 @@@fn number(app: &mut EffectcraftApp, ui: &mut egui::Ui, at: egui::Pos2, auto: &str, v: f64, speed: f64, range: (f64, f64), dec: usize, suffix: &str) -> f64 {let t = app.tokens;-- let (r, nv, _) = widgets::hot_number_at(ui, at, egui::Id::new(("animtool-n", auto)), v, speed, range, dec, suffix, &t);++ let (r, nv, _) = widgets::hot_number_at(ui, at, egui::Id::unique(("animtool-n", auto)), v, speed, range, dec, suffix, &t);app.auto.add(auto, r, &format!("{v}"));nv.unwrap_or(v)}@@@ -41,7 -41,7 +41,7 @@@fn checkbox(app: &mut EffectcraftApp, ui: &mut egui::Ui, at: egui::Pos2, auto: &str, text: &str, on: bool) -> bool {let t = app.tokens;let r = Rect::from_min_size(at, vec2(16.0, 16.0));-- let clicked = widgets::checkbox(ui, r, on, &t, egui::Id::new(("animtool-cb", auto))).clicked();++ let clicked = widgets::checkbox(ui, r, on, &t, egui::Id::unique(("animtool-cb", auto))).clicked();ui.painter().text(pos2(r.max.x + 6.0, r.center().y), Align2::LEFT_CENTER, text, Tokens::ui(12.0), t.text);app.auto.add(auto, r, text);if clicked { !on } else { on }@@@ -109,7 -109,7 +109,7 @@@ pub fn wiggler(app: &mut EffectcraftAppapp.ui.anim_tools = st.clone();let b = Rect::from_min_size(pos2(rect.max.x - 92.0, y), vec2(80.0, 24.0));let enabled = app.session.state.selected_keys.len() >= 2;-- if widgets::text_button(ui, b, "Apply", enabled, &t, egui::Id::new("wg-apply")).clicked() {++ if widgets::text_button(ui, b, "Apply", enabled, &t, egui::Id::unique("wg-apply")).clicked() {let params = json!({"apply": if st.wiggle_spatial { "spatial" } else { "temporal" },"noise": if st.wiggle_smooth { "smooth" } else { "jagged" },@@@ -150,7 -150,7 +150,7 @@@ pub fn smoother(app: &mut EffectcraftApy += ROW + 8.0;let b = Rect::from_min_size(pos2(rect.max.x - 92.0, y), vec2(80.0, 24.0));let enabled = app.session.state.selected_keys.len() >= 3;-- if widgets::text_button(ui, b, "Apply", enabled, &t, egui::Id::new("sm-apply")).clicked() {++ if widgets::text_button(ui, b, "Apply", enabled, &t, egui::Id::unique("sm-apply")).clicked() {apply(app, "keys.smooth", json!({"tolerance": tol}));}app.auto.add("smoother.apply", b, "Apply");@@@ -190,7 -196,7 +196,7 @@@ pub fn motion_sketch(app: &mut Effectcrlet b = Rect::from_min_size(pos2(x0, y), vec2(120.0, 24.0));let armed = st.sketch_armed;let has_layer = !app.session.state.selected_layers.is_empty();-- if widgets::text_button(ui, b, if armed { "Cancel Capture" } else { "Start Capture" }, has_layer && !armed, &t, egui::Id::new("ms-start")).clicked() {++ if widgets::text_button(ui, b, if armed { "Cancel Capture" } else { "Start Capture" }, has_layer && !armed, &t, egui::Id::unique("ms-start")).clicked() {if !has_layer {app.ui.status = "Select a layer to sketch its motion".into();} else {@@@ -213,7 -219,7 +219,7 @@@ struct Capture}fn capture_id() -> egui::Id {-- egui::Id::new("motion-sketch-capture")++ egui::Id::unique("motion-sketch-capture")}/// The Motion Sketch overlay on the Composition viewer (`area`): while armed, a press starts@@@ -224,9 -230,9 +230,9 @@@ pub fn sketch_overlay(app: &mut Effectcreturn;}let ctx = ui.ctx().clone();-- let Some(map) = ctx.data(|d| d.get_temp::<crate::panels::viewer::ViewerMap>(egui::Id::new("viewer-map"))) else { return };++ let Some(map) = ctx.data(|d| d.get_temp::<crate::panels::viewer::ViewerMap>(egui::Id::unique("viewer-map"))) else { return };let area = map.area;-- let resp = ui.interact(area, egui::Id::new("motion-sketch-overlay"), Sense::drag());++ let resp = ui.interact(area, egui::Id::unique("motion-sketch-overlay"), Sense::drag());app.auto.add("motionSketch.overlay", area, "Motion Sketch capture area");let now = ctx.input(|i| i.time);let painter = ui.painter().with_clip_rect(area);@@@ -392,7 -398,7 +398,7 @@@ pub fn mask_interpolation(app: &mut Eff}let b = Rect::from_min_size(pos2(rect.max.x - 92.0, y), vec2(80.0, 24.0));let enabled = app.session.state.selected_keys.len() >= 2;-- if widgets::text_button(ui, b, "Apply", enabled, &t, egui::Id::new("mi-apply")).clicked() {++ if widgets::text_button(ui, b, "Apply", enabled, &t, egui::Id::unique("mi-apply")).clicked() {match app.session.execute("mask.interpolate", json!({})) {Ok(r) => app.ui.status = format!("Mask Interpolation: {} keyframes added ({} vertices)", r["keys"], r["vertices"]),Err(e) => app.ui.status = e.to_string(),diff --cc crates/ui-egui/src/panels/camera_tracker_ui.rsindex 2bccfae07,2bccfae07..bca98ea4b--- a/crates/ui-egui/src/panels/camera_tracker_ui.rs+++ b/crates/ui-egui/src/panels/camera_tracker_ui.rs@@@ -217,11 -217,11 +217,11 @@@ pub fn viewer_hook// Interaction over the image.// While Space (Hand tool) is held the overlay only hovers, so the viewer underneath gets the pan drag.let sense = if super::space_hand(&ctx) { Sense::hover() } else { Sense::click_and_drag() };-- let resp = ui.interact(map.area, egui::Id::new("viewer-camera-tracker"), sense);++ let resp = ui.interact(map.area, egui::Id::unique("viewer-camera-tracker"), sense);app.auto.add("viewer.cameraTracker", map.area, "3D Camera Tracker points");// The overlay is on top of the viewer, so a middle-button drag lands here: pan the viewer like the Hand tool.if resp.dragged_by(egui::PointerButton::Middle) {-- let pid = egui::Id::new("viewer-camera-tracker-pan");++ let pid = egui::Id::unique("viewer-camera-tracker-pan");if resp.drag_started() {let start_pan = app.ui.viewer.pan;ui.data_mut(|d| d.insert_temp(pid, start_pan));@@@ -237,7 -237,7 +237,7 @@@let hover = resp.hover_pos();let point_at = |p: Pos2| hits.iter().filter(|h| h.1.distance(p) <= h.2 + 3.0).min_by(|x, y| x.1.distance(p).total_cmp(&y.1.distance(p))).map(|h| h.0);let tri = hover.filter(|p| point_at(*p).is_none()).and_then(|p| triangle_at(&hits, p));-- let mid = egui::Id::new("viewer-camera-tracker-marquee");++ let mid = egui::Id::unique("viewer-camera-tracker-marquee");let marquee: Option<Pos2> = ui.data(|d| d.get_temp(mid));// Hover target / the selection's target.if marquee.is_none() {@@@ -284,7 -284,7 +284,7 @@@}}// Right-click: the points under the cursor (selection, else the hovered triangle).-- let cid = egui::Id::new("viewer-camera-tracker-menu-points");++ let cid = egui::Id::unique("viewer-camera-tracker-menu-points");if resp.secondary_clicked() {let pts: Vec<u32> = if !selected.is_empty() {selected.clone()@@@ -413,12 -413,12 +413,12 @@@ pub fn editorlet b1 = Rect::from_min_size(pos2(r.min.x + 24.0, r.min.y + 4.0), vec2(84.0, 22.0));let b2 = Rect::from_min_size(pos2(b1.max.x + 8.0, b1.min.y), vec2(84.0, 22.0));let b3 = Rect::from_min_size(pos2(b2.max.x + 8.0, b1.min.y), vec2(110.0, 22.0));-- if widgets::text_button(ui, b1, "Analyze", false, &t, egui::Id::new(("ct-analyze", g.uid))).clicked() && !busy {++ if widgets::text_button(ui, b1, "Analyze", false, &t, egui::Id::unique(("ct-analyze", g.uid))).clicked() && !busy {actions.push(("camera.analyze".into(), me.clone()));}app.auto.add(&format!("effectControls.cameraTracker.{}.analyze", g.uid), b1, "Analyze");if running {-- if widgets::text_button(ui, b2, "Cancel", false, &t, egui::Id::new(("ct-cancel", g.uid))).clicked() {++ if widgets::text_button(ui, b2, "Cancel", false, &t, egui::Id::unique(("ct-cancel", g.uid))).clicked() {actions.push(("camera.cancel".into(), json!({})));}app.auto.add(&format!("effectControls.cameraTracker.{}.cancel", g.uid), b2, "Cancel");@@@ -426,7 -426,7 +426,7 @@@let params = effectcraft_engine::camera_track::static_params(g);let solve = ct::solve(¶ms);if solve.is_some() {-- if widgets::text_button(ui, b3, "Create Camera", false, &t, egui::Id::new(("ct-camera", g.uid))).clicked() {++ if widgets::text_button(ui, b3, "Create Camera", false, &t, egui::Id::unique(("ct-camera", g.uid))).clicked() {actions.push(("camera.create".into(), me.clone()));}app.auto.add(&format!("effectControls.cameraTracker.{}.createCamera", g.uid), b3, "Create Camera");diff --cc crates/ui-egui/src/panels/comp_settings.rsindex 2cd19df5d,7e676bcca..6aff37823--- a/crates/ui-egui/src/panels/comp_settings.rs+++ b/crates/ui-egui/src/panels/comp_settings.rs@@@ -177,7 -182,7 +182,7 @@@ fn timecode_field(ui: &mut egui::Ui, bu}fn name_focus_id() -> egui::Id {-- egui::Id::new("comp-preset-name-focus")++ egui::Id::unique("comp-preset-name-focus")}/// Save Preset's Choose Name prompt (drawn in its own modal over the dialog while@@@ -297,7 -302,7 +302,7 @@@ pub fn show});auto.add("dialog.comp.preset", r.response.rect, "Preset");let (save_r, _) = ui.allocate_exact_size(vec2(20.0, 20.0), egui::Sense::hover());-- let save = crate::widgets::icon_button(ui, save_r, Icon::Plus, d.preset_name.is_some(), t, egui::Id::new("comp-preset-save"))++ let save = crate::widgets::icon_button(ui, save_r, Icon::Plus, d.preset_name.is_some(), t, egui::Id::unique("comp-preset-save")).on_hover_text(tr("Save Preset…"));auto.add("dialog.comp.presetSave", save_r, "Save Preset");if save.clicked() {@@@ -306,7 -311,7 +311,7 @@@}if let Some(q) = own {let (del_r, _) = ui.allocate_exact_size(vec2(20.0, 20.0), egui::Sense::hover());-- let del = crate::widgets::icon_button(ui, del_r, Icon::Trash, false, t, egui::Id::new("comp-preset-delete"))++ let del = crate::widgets::icon_button(ui, del_r, Icon::Trash, false, t, egui::Id::unique("comp-preset-delete")).on_hover_text(tr("Delete Preset"));auto.add("dialog.comp.presetDelete", del_r, "Delete Preset");if del.clicked() {diff --cc crates/ui-egui/src/panels/dialogs.rsindex d773fc433,07b257e29..99496a218--- a/crates/ui-egui/src/panels/dialogs.rs+++ b/crates/ui-egui/src/panels/dialogs.rs@@@ -189,7 -191,7 +191,7 @@@ fn modal_with_scroll(ctx: &egui::Contex/// window.pub(crate) fn modal_fit(ctx: &egui::Context, title: &str, size: egui::Vec2, t: &Tokens, body: impl FnOnce(&mut egui::Ui, f32)) {let size = size.min(modal_space(ctx));-- let id = egui::Id::new(("modal", title));++ let id = egui::Id::unique(("modal", title));// Dragging the title row moves the dialog off what it edits. The offset is kept within the// window, so dragging back never has to undo a part the dialog could not follow.let offset_id = id.with("offset");@@@ -273,7 -276,7 +276,7 @@@ const CREDITS_HEIGHT: f32 = 380.0fn about(app: &mut EffectcraftApp, ctx: &egui::Context, t: &Tokens) {let mut close = false;let mut cmd: Option<&str> = None;-- let tab_id = egui::Id::new("about_tab");++ let tab_id = egui::Id::unique("about_tab");modal(ctx, "About EffectCraft", vec2(680.0, 520.0), t, |ui| {let mut tab = ui.data_mut(|d| d.get_temp::<usize>(tab_id)).unwrap_or(0);ui.horizontal(|ui| {@@@ -462,7 -479,7 +479,7 @@@ fn solid(app: &mut EffectcraftApp, ctx(ds.solid_name.clone(), ds.solid_color, ds.solid_size, ds.solid_pixel_aspect, ds.solid_affect_all);let (editing, shared) = (ds.solid_layer, ds.solid_shared);let comp_size = app.session.active_comp().map(|c| (c.width, c.height)).unwrap_or((1920, 1080));-- let lock_id = egui::Id::new("solid-lock-aspect");++ let lock_id = egui::Id::unique("solid-lock-aspect");let mut lock = ctx.data(|m| m.get_temp::<bool>(lock_id)).unwrap_or(true);let auto = &mut app.auto;modal(ctx, "Solid Settings", vec2(480.0, if editing.is_some() { 430.0 } else { 390.0 }), t, |ui| {@@@ -613,6 -630,6 +630,8 @@@ fn palette(app: &mut EffectcraftApp, ct.collect();modal(ctx, "Command Palette", vec2(560.0, 470.0), t, |ui| {let r = ui.add(egui::TextEdit::singleline(&mut q).hint_text(tr("Type a command or effect…")).desired_width(f32::INFINITY).font(Tokens::ui(14.0)));++ // A placeholder disappears once typing starts; keep the field named for assistive input.++ ctx.accesskit_node_builder(r.id, |node| node.set_label(tr("Type a command or effect…")));// Take the keyboard when the palette opens (and if anything else takes it away), but not// while the field already has it: egui's `request_focus` interrupts the IME composition,// and asking on every frame cancelled the pinyin being typed, so no Chinese could be@@@ -731,7 -748,7 +750,7 @@@ mod testsassert_eq!(app.dialog_state.palette_query, "nihao");// Something else taking the keyboard takes it away for a frame; the field claims it back// (a request is what gets the keys back, and there is no composition to interrupt then).-- ctx.memory_mut(|m| m.request_focus(egui::Id::new("elsewhere")));++ ctx.memory_mut(|m| m.request_focus(egui::Id::unique("elsewhere")));assert!(frame_with(&mut app, &ctx, vec![]).platform_output.ime.is_none(), "the field lost the keyboard");assert!(frame_with(&mut app, &ctx, vec![]).platform_output.ime.is_some(), "and takes it back");}diff --cc crates/ui-egui/src/panels/effect_controls.rsindex 03b3a1ac4,3295b13e0..f0c023448--- a/crates/ui-egui/src/panels/effect_controls.rs+++ b/crates/ui-egui/src/panels/effect_controls.rs@@@ -156,7 -156,7 +156,7 @@@ fn key_navigatorlet on_key = prop.keys.iter().any(|k| (layer.comp_time(k.time).0 - ectx.time.0).abs() <= half);for (what, dx) in [("prev", -44.0), ("key", -32.0), ("next", -20.0)] {let cr = Rect::from_center_size(pos2(r.max.x + dx, cy), vec2(12.0, 16.0));-- let resp = ui.interact(cr, egui::Id::new(("ec-nav", uid, what)), Sense::click());++ let resp = ui.interact(cr, egui::Id::unique(("ec-nav", uid, what)), Sense::click());let col = if resp.hovered() { t.text } else { t.text_dim };match what {"prev" => triangle(p, cr.center(), true, col),@@@ -228,7 -228,7 +228,7 @@@ fn prop_row}let swr = Rect::from_center_size(pos2(r.min.x + indent, cy), vec2(14.0, 14.0));if !prop.static_only && !matches!(prop.ui, ParamUi::Hidden) {-- let resp = ui.interact(swr, egui::Id::new(("ec-sw", uid)), Sense::click());++ let resp = ui.interact(swr, egui::Id::unique(("ec-sw", uid)), Sense::click());icons::paint(p,swr,@@@ -272,7 -272,7 +272,7 @@@let name_clip = Rect::from_min_max(pos2(swr.max.x + 6.0, r.min.y), pos2(vx - 6.0, r.max.y));app.auto.add(&format!("effectControls.prop.{uid}.name"), name_clip, &prop.name);p.with_clip_rect(name_clip.intersect(p.clip_rect())).text(pos2(swr.max.x + 6.0, cy), Align2::LEFT_CENTER, &prop.name, Tokens::ui(12.0), t.text);-- let name_response = ui.interact(name_clip, egui::Id::new(("ec-prop-name", uid)), Sense::click());++ let name_response = ui.interact(name_clip, egui::Id::unique(("ec-prop-name", uid)), Sense::click());if name_response.double_clicked() {app.ui.timeline.search.clear();app.ui.timeline.scroll_to = Some(crate::state::ScrollTo::Property(uid));@@@ -291,7 -291,7 +291,7 @@@let twirl_open = |app: &mut EffectcraftApp, ui: &mut egui::Ui| {let open = app.ui.fx_slider_open.contains(&uid);let tw = Rect::from_center_size(pos2(swr.min.x - 9.0, cy), vec2(10.0, 10.0));-- if widgets::twirl(ui, tw, open, egui::Id::new(("ec-stw", uid)), &t).clicked() {++ if widgets::twirl(ui, tw, open, egui::Id::unique(("ec-stw", uid)), &t).clicked() {if open {app.ui.fx_slider_open.remove(&uid);} else {@@@ -310,8 -310,8 +310,8 @@@let i = v.round().max(0.0) as usize;let label = opts.get(i).cloned().unwrap_or_else(|| format!("Mask {i}"));let dr = Rect::from_min_size(pos2(vx, cy - 9.0), vec2((r.max.x - vx - 56.0).clamp(80.0, 200.0), 18.0));-- let pop = egui::Id::new(("ec-mpop", uid));-- if widgets::dropdown(ui, dr, &label, &t, egui::Id::new(("ec-m", uid))).clicked() {++ let pop = egui::Id::unique(("ec-mpop", uid));++ if widgets::dropdown(ui, dr, &label, &t, egui::Id::unique(("ec-m", uid))).clicked() {widgets::open_popup(ui, pop);}app.auto.add(&format!("effectControls.prop.{uid}.value"), dr, &prop.name);@@@ -320,7 -320,7 +320,7 @@@}}Value::Scalar(v) if matches!(prop.ui, ParamUi::Angle) => {-- let (rr, dr, nv) = fw::angle_field(ui, pos2(vx, cy - 9.0), egui::Id::new(("ec-v", uid)), *v, 1, &t);++ let (rr, dr, nv) = fw::angle_field(ui, pos2(vx, cy - 9.0), egui::Id::unique(("ec-v", uid)), *v, 1, &t);app.auto.add(&format!("effectControls.prop.{uid}.value"), rr.union(dr), &fw::format_angle(*v, 1));app.auto.add(&format!("effectControls.prop.{uid}.revolutions"), rr, &prop.name);if let Some(nv) = nv {@@@ -344,7 -341,7 +341,7 @@@let (vr, nv, _) = widgets::hot_number_at(ui,pos2(vx, cy - 9.0),-- egui::Id::new(("ec-v", uid)),++ egui::Id::unique(("ec-v", uid)),*v,speed,(min, max),@@@ -368,7 -365,7 +365,7 @@@if matches!(prop.ui, ParamUi::Point | ParamUi::Point3) {let cr = Rect::from_center_size(pos2(x + 8.0, cy), vec2(18.0, 18.0));let active = app.ui.fx_pick.as_ref().is_some_and(|k| k.prop == uid && k.kind == "point");-- if fw::crosshair_button(ui, cr, active, egui::Id::new(("ec-xh", uid)), &t)++ if fw::crosshair_button(ui, cr, active, egui::Id::unique(("ec-xh", uid)), &t).on_hover_text(crate::i18n::tr("Click, then click in the Composition panel")).clicked(){@@@ -378,7 -375,7 +375,7 @@@x += 22.0;}for d in 0..n.min(c.len()) {-- let (vr, nv, _) = widgets::hot_number_at(ui, pos2(x, cy - 9.0), egui::Id::new(("ec-v", uid, d)), c[d], 1.0, (-1e9, 1e9), 1, "", &t);++ let (vr, nv, _) = widgets::hot_number_at(ui, pos2(x, cy - 9.0), egui::Id::unique(("ec-v", uid, d)), c[d], 1.0, (-1e9, 1e9), 1, "", &t);app.auto.add(&format!("effectControls.prop.{uid}.value.{d}"), vr, &prop.name);dims.push(vr);if let Some(nv) = nv {@@@ -396,14 -393,14 +393,14 @@@}Value::Color(c) => {let sr = Rect::from_min_size(pos2(vx, cy - 8.0), vec2(30.0, 16.0));-- let pop = egui::Id::new(("ec-cpop", uid));-- if widgets::swatch(ui, sr, [c[0] as f32, c[1] as f32, c[2] as f32, 1.0], egui::Id::new(("ec-c", uid)), &t).clicked() {++ let pop = egui::Id::unique(("ec-cpop", uid));++ if widgets::swatch(ui, sr, [c[0] as f32, c[1] as f32, c[2] as f32, 1.0], egui::Id::unique(("ec-c", uid)), &t).clicked() {widgets::open_popup(ui, pop);}app.auto.add(&format!("effectControls.prop.{uid}.value"), sr, &prop.name);let er = Rect::from_center_size(pos2(sr.max.x + 14.0, cy), vec2(18.0, 18.0));let active = app.ui.fx_pick.as_ref().is_some_and(|k| k.prop == uid && k.kind == "color");-- if fw::eyedropper_button(ui, er, active, egui::Id::new(("ec-eye", uid)), &t)++ if fw::eyedropper_button(ui, er, active, egui::Id::unique(("ec-eye", uid)), &t).on_hover_text(crate::i18n::tr("Eyedropper: click, then click in the Composition panel")).clicked(){@@@ -417,7 -414,7 +414,7 @@@}Value::Bool(b) => {let cr = Rect::from_min_size(pos2(vx, cy - 8.0), vec2(16.0, 16.0));-- if widgets::checkbox(ui, cr, *b, &t, egui::Id::new(("ec-b", uid))).clicked() {++ if widgets::checkbox(ui, cr, *b, &t, egui::Id::unique(("ec-b", uid))).clicked() {set(actions, json!(!b));}p.text(pos2(cr.max.x + 6.0, cy), Align2::LEFT_CENTER, &prop.name, Tokens::ui(12.0), t.text_dim);@@@ -427,8 -424,8 +424,8 @@@if let ParamUi::Popup { options } = &prop.ui {let widest = options.iter().map(|o| p.layout_no_wrap(o.clone(), Tokens::ui(11.5), t.text).size().x).fold(0.0, f32::max);let dr = Rect::from_min_size(pos2(vx, cy - 9.0), vec2((widest + 30.0).clamp(80.0, (r.max.x - vx - 56.0).max(80.0)), 18.0));-- let pop = egui::Id::new(("ec-epop", uid));-- if widgets::dropdown(ui, dr, options.get(*i as usize).map(String::as_str).unwrap_or(""), &t, egui::Id::new(("ec-e", uid))).clicked() {++ let pop = egui::Id::unique(("ec-epop", uid));++ if widgets::dropdown(ui, dr, options.get(*i as usize).map(String::as_str).unwrap_or(""), &t, egui::Id::unique(("ec-e", uid))).clicked() {widgets::open_popup(ui, pop);}app.auto.add(&format!("effectControls.prop.{uid}.value"), dr, &prop.name);@@@ -441,26 -438,17 +438,17 @@@let comp = app.session.active_comp_arc();if let Some(comp) = comp {let dr = Rect::from_min_size(pos2(vx, cy - 9.0), vec2(((r.max.x - vx) * 0.55).clamp(90.0, 170.0), 18.0));- let idx_of = |id: u64| comp.layers.iter().position(|x| x.id.0 == id);- let name = l.and_then(|id| idx_of(id).map(|i| format!("{}. {}", i + 1, comp.layers[i].name))).unwrap_or_else(|| "None".into());- let pop = egui::Id::new(("ec-lpop", uid));- if widgets::dropdown(ui, dr, &name, &t, egui::Id::new(("ec-l", uid))).clicked() {- widgets::open_popup(ui, pop);- if let Some(chosen) = widgets::layer_picker(ui, dr, &comp.layers, *l, &t, egui::Id::new(("ec-l", uid))) {++ if let Some(chosen) = widgets::layer_picker(ui, dr, &comp.layers, *l, &t, egui::Id::unique(("ec-l", uid))) {+ set(actions, chosen.map(|id| json!(id)).unwrap_or(serde_json::Value::Null));}app.auto.add(&format!("effectControls.prop.{uid}.value"), dr, &prop.name);- let mut opts = vec!["None".to_string()];- opts.extend(comp.layers.iter().enumerate().map(|(i, l)| format!("{}. {}", i + 1, l.name)));- let cur = l.and_then(idx_of).map(|i| i + 1).unwrap_or(0);- if let Some(i) = widgets::popup_menu(ui, pop, dr.left_bottom(), &opts, Some(cur)) {- set(actions, if i == 0 { serde_json::Value::Null } else { json!(comp.layers[i - 1].id.0) });- }// Source / Masks / Effects & Masks (the hidden companion parameter).if let Some(src) = group.get(&effectcraft_engine::effects::layer_source_id(&prop.match_id)) {let si = src.value.as_enum() as usize;let opts: Vec<String> = effectcraft_engine::effects::LAYER_SOURCE_OPTIONS.iter().map(|s| s.to_string()).collect();let sr = Rect::from_min_size(pos2(dr.max.x + 6.0, cy - 9.0), vec2(((r.max.x - dr.max.x) - 64.0).clamp(70.0, 120.0), 18.0));-- let spop = egui::Id::new(("ec-lspop", uid));-- if widgets::dropdown(ui, sr, opts.get(si).map(String::as_str).unwrap_or(""), &t, egui::Id::new(("ec-ls", uid))).clicked() {++ let spop = egui::Id::unique(("ec-lspop", uid));++ if widgets::dropdown(ui, sr, opts.get(si).map(String::as_str).unwrap_or(""), &t, egui::Id::unique(("ec-ls", uid))).clicked() {widgets::open_popup(ui, spop);}app.auto.add(&format!("effectControls.prop.{uid}.source"), sr, &src.name);@@@ -480,7 -468,7 +468,7 @@@Value::Str(s) if matches!(prop.ui, ParamUi::File { .. }) => {let bw = 70.0;let br = Rect::from_min_size(pos2(vx, cy - 9.0), vec2(bw, 18.0));-- if widgets::text_button(ui, br, crate::i18n::tr("Choose..."), false, &t, egui::Id::new(("ec-file", uid))).clicked() {++ if widgets::text_button(ui, br, crate::i18n::tr("Choose..."), false, &t, egui::Id::unique(("ec-file", uid))).clicked() {let filters: Vec<&str> = match &prop.ui {ParamUi::File { filters } => filters.iter().map(String::as_str).collect(),_ => vec![],@@@ -505,7 -493,7 +493,7 @@@let nr = Rect::from_min_max(pos2(br.max.x + 8.0, r.min.y), pos2(r.max.x - 8.0, r.max.y));let np = p.with_clip_rect(nr.intersect(p.clip_rect()));np.text(pos2(nr.min.x, cy), Align2::LEFT_CENTER, &shown, Tokens::ui(12.0), if s.trim().is_empty() { t.text_dim } else { t.text });-- let hover = ui.interact(nr, egui::Id::new(("ec-file-name", uid)), Sense::hover());++ let hover = ui.interact(nr, egui::Id::unique(("ec-file-name", uid)), Sense::hover());if !s.trim().is_empty() && !s.contains('\n') {hover.on_hover_text(s.as_str());}@@@ -515,9 -503,9 +503,11 @@@// typed in a field, set when it loses the focus (Esc keeps the old text).Value::Str(s) if matches!(prop.ui, ParamUi::Text) => {let fr = Rect::from_min_size(pos2(vx, cy - 9.0), vec2((r.max.x - vx - 12.0).clamp(80.0, 320.0), 18.0));-- let bid = egui::Id::new(("ec-text", uid));++ let bid = egui::Id::unique(("ec-text", uid));let mut buf: String = ui.data(|d| d.get_temp(bid)).unwrap_or_else(|| s.clone());let resp = widgets::text_field(ui, fr, &mut buf, "", &t);++ // The field has no visible hint: give the screen reader the parameter's name.++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::TextInput, ui.is_enabled(), &prop.name));app.auto.add(&format!("effectControls.prop.{uid}.value"), fr, &prop.name);if resp.lost_focus() {if buf != *s && !ui.input(|i| i.key_pressed(egui::Key::Escape)) {@@@ -598,7 -586,7 +588,7 @@@ fn slider_rowlet dec = decimals as usize;p.text(pos2(tr.min.x, tr.max.y + 4.0), Align2::LEFT_TOP, format!("{slider_min:.dec$}"), Tokens::ui(10.5), t.text_dim);p.text(pos2(tr.max.x, tr.max.y + 4.0), Align2::RIGHT_TOP, format!("{slider_max:.dec$}"), Tokens::ui(10.5), t.text_dim);-- let sresp = ui.interact(tr.expand2(vec2(4.0, 6.0)), egui::Id::new(("ec-slider", uid)), Sense::click_and_drag());++ let sresp = ui.interact(tr.expand2(vec2(4.0, 6.0)), egui::Id::unique(("ec-slider", uid)), Sense::click_and_drag());app.auto.add(&format!("effectControls.prop.{uid}.slider"), tr, &prop.name);if (sresp.dragged() || sresp.clicked())&& let Some(pt) = sresp.interact_pointer_pos()@@@ -619,7 -607,7 +609,7 @@@ fn dial_row(app: &mut EffectcraftApp, ulet uid = prop.uid;let d = (r.height() - 12.0).min(52.0);let dr = Rect::from_min_size(pos2(r.min.x + x0 + 40.0, r.min.y + 6.0), vec2(d, d));-- let id = egui::Id::new(("ec-dial", uid));++ let id = egui::Id::unique(("ec-dial", uid));let (resp, nv) = fw::angle_dial(ui, dr, v, id, &t);app.auto.add(&format!("effectControls.prop.{uid}.dial"), dr, &prop.name);if let Some(nv) = nv {@@@ -738,7 -726,7 +728,7 @@@ fn group_rowsif r.max.y >= rect.min.y && r.min.y <= rect.max.y {app.auto.add(&format!("effectControls.row.{}", sg.uid), r, &sg.name);app.auto.add(&format!("effectControls.group.{}.twirl", sg.uid), tw, &sg.name);-- if widgets::twirl(ui, tw, open, egui::Id::new(("ec-g", sg.uid)), &t).clicked() {++ if widgets::twirl(ui, tw, open, egui::Id::unique(("ec-g", sg.uid)), &t).clicked() {toggle_closed(app, sg, open, ui.input(|i| i.modifiers.alt || i.modifiers.command));}let name = p.text(pos2(tw.max.x + 6.0, r.center().y), Align2::LEFT_CENTER, &sg.name, Tokens::ui(12.0), t.text);@@@ -769,12 -757,12 +759,12 @@@ fn warp_editor(app: &mut EffectcraftApplet busy = app.session.is_warp_analyzing();let b1 = Rect::from_min_size(pos2(r.min.x + 24.0, r.min.y + 4.0), vec2(84.0, 22.0));let b2 = Rect::from_min_size(pos2(b1.max.x + 8.0, b1.min.y), vec2(84.0, 22.0));-- if widgets::text_button(ui, b1, "Analyze", false, &t, egui::Id::new(("warp-analyze", g.uid))).clicked() && !busy {++ if widgets::text_button(ui, b1, "Analyze", false, &t, egui::Id::unique(("warp-analyze", g.uid))).clicked() && !busy {actions.push(("warp.analyze".into(), json!({"layer": layer.id.0, "effect": g.uid})));}app.auto.add(&format!("effectControls.warp.{}.analyze", g.uid), b1, "Analyze");if running {-- if widgets::text_button(ui, b2, "Cancel", false, &t, egui::Id::new(("warp-cancel", g.uid))).clicked() {++ if widgets::text_button(ui, b2, "Cancel", false, &t, egui::Id::unique(("warp-cancel", g.uid))).clicked() {actions.push(("warp.cancel".into(), json!({})));}app.auto.add(&format!("effectControls.warp.{}.cancel", g.uid), b2, "Cancel");@@@ -800,13 -788,13 +790,13 @@@ fn roto_editor(app: &mut EffectcraftApplet b1 = Rect::from_min_size(pos2(r.min.x + 24.0, r.min.y + 4.0), vec2(84.0, 22.0));let b2 = Rect::from_min_size(pos2(b1.max.x + 8.0, b1.min.y), vec2(84.0, 22.0));let label = if frozen { "Unfreeze" } else { "Freeze" };-- if widgets::text_button(ui, b1, label, frozen, &t, egui::Id::new(("roto-freeze-ec", g.uid))).clicked() && !running {++ if widgets::text_button(ui, b1, label, frozen, &t, egui::Id::unique(("roto-freeze-ec", g.uid))).clicked() && !running {let id = if frozen { "roto.unfreeze" } else { "roto.freeze" };actions.push((id.into(), json!({"layer": layer.id.0, "effect": g.uid})));}app.auto.add(&format!("effectControls.roto.{}.freeze", g.uid), b1, label);let (l2, id2) = if running { ("Stop", "roto.cancel") } else { ("Propagate", "roto.propagate") };-- if widgets::text_button(ui, b2, l2, false, &t, egui::Id::new(("roto-prop-ec", g.uid))).clicked() && !frozen {++ if widgets::text_button(ui, b2, l2, false, &t, egui::Id::unique(("roto-prop-ec", g.uid))).clicked() && !frozen {actions.push((id2.into(), json!({"layer": layer.id.0, "effect": g.uid})));}app.auto.add(&format!("effectControls.roto.{}.propagate", g.uid), b2, l2);@@@ -831,13 -819,13 +821,13 @@@ fn object_matte_editor(app: &mut Effectlet b1 = Rect::from_min_size(pos2(r.min.x + 24.0, r.min.y + 4.0), vec2(84.0, 22.0));let b2 = Rect::from_min_size(pos2(b1.max.x + 8.0, b1.min.y), vec2(84.0, 22.0));let label = if frozen { "Unfreeze" } else { "Freeze" };-- if widgets::text_button(ui, b1, crate::i18n::tr(label), frozen, &t, egui::Id::new(("om-freeze-ec", g.uid))).clicked() && !busy {++ if widgets::text_button(ui, b1, crate::i18n::tr(label), frozen, &t, egui::Id::unique(("om-freeze-ec", g.uid))).clicked() && !busy {let id = if frozen { "objectMatte.unfreeze" } else { "objectMatte.freeze" };actions.push((id.into(), json!({"layer": layer.id.0, "effect": g.uid})));}app.auto.add(&format!("effectControls.objectMatte.{}.freeze", g.uid), b1, label);let (l2, id2) = if running { ("Stop", "roto.cancel") } else { ("Track", "objectMatte.propagate") };-- if widgets::text_button(ui, b2, crate::i18n::tr(l2), false, &t, egui::Id::new(("om-track-ec", g.uid))).clicked() && !frozen && (running || !busy) {++ if widgets::text_button(ui, b2, crate::i18n::tr(l2), false, &t, egui::Id::unique(("om-track-ec", g.uid))).clicked() && !frozen && (running || !busy) {actions.push((id2.into(), json!({"layer": layer.id.0, "effect": g.uid})));}app.auto.add(&format!("effectControls.objectMatte.{}.track", g.uid), b2, l2);@@@ -881,7 -869,7 +871,7 @@@ fn curves_size(width: f32) -> f32fn frame_histogram(app: &mut EffectcraftApp, ctx: &egui::Context) -> Option<std::sync::Arc<[[u32; 256]; 5]>> {let img = app.viewer_pixels()?;let key = std::sync::Arc::as_ptr(&img) as usize;-- let id = egui::Id::new("ec-histogram");++ let id = egui::Id::unique("ec-histogram");if let Some((k, h)) = ctx.data(|d| d.get_temp::<(usize, std::sync::Arc<[[u32; 256]; 5]>)>(id))&& k == key{@@@ -944,7 -932,7 +934,8 @@@ fn curves_editor(app: &mut EffectcraftAlet x0 = r.min.x + 30.0;let cy = r.min.y + 17.0;let names: [&str; 5] = [crate::i18n::tr("RGB"), crate::i18n::tr("Red"), crate::i18n::tr("Green"), crate::i18n::tr("Blue"), crate::i18n::tr("Alpha")];-- if let Some(n) = channel_popup(app, ui, p, x0, cy, ch, &names, egui::Id::new(("ec-cch", euid)), &format!("effectControls.effect.{euid}.curves.channel")) {++ if let Some(n) = channel_popup(app, ui, p, x0, cy, ch, &names, egui::Id::unique(("ec-cch", euid)), &format!("effectControls.effect.{euid}.curves.channel"))++ {match chan_prop {Some(pr) => actions.push(("prop.set".into(), json!({"layer": layer.id.0, "prop": pr.uid, "value": n}))),None => {@@@ -954,7 -942,7 +945,7 @@@}let pencil = app.ui.fx_curve_pencil.contains(&euid);let mr = Rect::from_min_size(pos2(x0 + 146.0, cy - 9.0), vec2(56.0, 18.0));-- if widgets::dropdown(ui, mr, if pencil { "Pencil" } else { "Bezier" }, &t, egui::Id::new(("ec-cmode", euid))).clicked() {++ if widgets::dropdown(ui, mr, if pencil { "Pencil" } else { "Bezier" }, &t, egui::Id::unique(("ec-cmode", euid))).clicked() {if pencil {app.ui.fx_curve_pencil.remove(&euid);} else {@@@ -968,7 -956,7 +959,7 @@@_ => fw::CurvePoints::identity(),};let rr = Rect::from_min_size(pos2(mr.max.x + 8.0, cy - 9.0), vec2(44.0, 18.0));-- let rresp = ui.interact(rr, egui::Id::new(("ec-creset", euid)), Sense::click());++ let rresp = ui.interact(rr, egui::Id::unique(("ec-creset", euid)), Sense::click());p.text(rr.center(), Align2::CENTER_CENTER, crate::i18n::tr("Reset"), Tokens::ui(11.5), if rresp.hovered() { t.hot_text } else { t.text_dim });app.auto.add(&format!("effectControls.effect.{euid}.curves.reset"), rr, "Reset curve");if rresp.clicked() {@@@ -979,8 -967,8 +970,8 @@@// Input/output gradients along the axes.let col = channel_color(ch);p.rect_filled(Rect::from_min_max(pos2(gr.min.x, gr.max.y + 3.0), pos2(gr.max.x, gr.max.y + 8.0)), 0.0, col.gamma_multiply(0.5));-- let id = egui::Id::new(("ec-curves", euid, ch));- let (resp, edit) = fw::curves_graph(ui, gr, &cur, ch, pencil, id, &t);++ let id = egui::Id::unique(("ec-curves", euid, ch));+ let (resp, edit) = fw::curves_graph(ui, gr, &cur, ch, pencil, true, id, &t);app.auto.add(&format!("effectControls.effect.{euid}.curves.graph"), gr, "Curves");let started = resp.drag_started() || resp.clicked();if let Some(np) = edit.changed {@@@ -1033,7 -1021,7 +1024,8 @@@ fn levels_editor};if effect == "ec.color.levelsic" {let names: [&str; 5] = [crate::i18n::tr("RGB"), crate::i18n::tr("Red"), crate::i18n::tr("Green"), crate::i18n::tr("Blue"), crate::i18n::tr("Alpha")];-- if let Some(n) = channel_popup(app, ui, p, x0, cy, ch, &names, egui::Id::new(("ec-lch", euid)), &format!("effectControls.effect.{euid}.levels.channel"))++ if let Some(n) =++ channel_popup(app, ui, p, x0, cy, ch, &names, egui::Id::unique(("ec-lch", euid)), &format!("effectControls.effect.{euid}.levels.channel")){app.ui.fx_levels_channel.insert(euid, n);}@@@ -1055,24 -1043,24 +1047,24 @@@let (ib, iw, gm, ob, ow) = (val(&ids[0]), val(&ids[1]), val(&ids[2]), val(&ids[3]), val(&ids[4]));let mut set = |ui: &egui::Ui, id: &str, v: f64, started: bool| {if let Some(pr) = g.prop(id) {-- let key = gesture_key(ui, egui::Id::new(("ec-lv", euid, id)), started);++ let key = gesture_key(ui, egui::Id::unique(("ec-lv", euid, id)), started);actions.push(("prop.set".into(), json!({"layer": layer.id.0, "prop": pr.uid, "value": v, "merge": key})));}};let track = Rect::from_min_size(pos2(hr.min.x, hr.max.y + 1.0), vec2(w, 10.0));let started = |ui: &egui::Ui| ui.input(|i| i.pointer.any_pressed());-- let (r0, nv) = fw::level_handle(ui, track, ib, Color32::BLACK, egui::Id::new(("ec-lib", euid, ch)), &t);++ let (r0, nv) = fw::level_handle(ui, track, ib, Color32::BLACK, egui::Id::unique(("ec-lib", euid, ch)), &t);app.auto.add(&format!("effectControls.effect.{euid}.levels.inBlack"), r0, "Input Black");if let Some(v) = nv {set(ui, &ids[0], v.min(iw - 0.005), started(ui));}let gx = fw::gamma_handle(ib, iw, gm);-- let (r1, nv) = fw::level_handle(ui, track, gx, Color32::from_gray(128), egui::Id::new(("ec-lg", euid, ch)), &t);++ let (r1, nv) = fw::level_handle(ui, track, gx, Color32::from_gray(128), egui::Id::unique(("ec-lg", euid, ch)), &t);app.auto.add(&format!("effectControls.effect.{euid}.levels.gamma"), r1, "Gamma");if let Some(v) = nv {set(ui, &ids[2], (fw::gamma_from_handle(ib, iw, v) * 100.0).round() / 100.0, started(ui));}-- let (r2, nv) = fw::level_handle(ui, track, iw, Color32::WHITE, egui::Id::new(("ec-liw", euid, ch)), &t);++ let (r2, nv) = fw::level_handle(ui, track, iw, Color32::WHITE, egui::Id::unique(("ec-liw", euid, ch)), &t);app.auto.add(&format!("effectControls.effect.{euid}.levels.inWhite"), r2, "Input White");if let Some(v) = nv {set(ui, &ids[1], v.max(ib + 0.005), started(ui));@@@ -1087,12 -1075,12 +1079,12 @@@p.rect_filled(Rect::from_min_max(pos2(x0, bar.min.y), pos2(x1, bar.max.y)), 0.0, Color32::from_gray(v));}let otrack = Rect::from_min_size(pos2(bar.min.x, bar.max.y + 1.0), vec2(w, 10.0));-- let (r3, nv) = fw::level_handle(ui, otrack, ob, Color32::BLACK, egui::Id::new(("ec-lob", euid, ch)), &t);++ let (r3, nv) = fw::level_handle(ui, otrack, ob, Color32::BLACK, egui::Id::unique(("ec-lob", euid, ch)), &t);app.auto.add(&format!("effectControls.effect.{euid}.levels.outBlack"), r3, "Output Black");if let Some(v) = nv {set(ui, &ids[3], v, started(ui));}-- let (r4, nv) = fw::level_handle(ui, otrack, ow, Color32::WHITE, egui::Id::new(("ec-low", euid, ch)), &t);++ let (r4, nv) = fw::level_handle(ui, otrack, ow, Color32::WHITE, egui::Id::unique(("ec-low", euid, ch)), &t);app.auto.add(&format!("effectControls.effect.{euid}.levels.outWhite"), r4, "Output White");if let Some(v) = nv {set(ui, &ids[4], v, started(ui));@@@ -1123,7 -1111,7 +1115,7 @@@ fn histogram_only(app: &mut Effectcraft/// Open the rename field on effect `uid` (Enter with the effect selected), name selected.pub fn start_rename(ctx: &egui::Context, uid: u64, name: &str) {-- let id = egui::Id::new(("ec-rename", uid));++ let id = egui::Id::unique(("ec-rename", uid));ctx.data_mut(|d| d.insert_temp(id, name.to_string()));ctx.data_mut(|d| d.insert_temp(id.with("select"), true));ctx.memory_mut(|m| m.request_focus(id.with("field")));@@@ -1147,7 -1135,7 +1139,7 @@@ pub fn show(app: &mut EffectcraftApp, up.text(pos2(hdr.min.x + 10.0, hdr.center().y), Align2::LEFT_CENTER, format!("{} • {}", comp_name, layer.name), Tokens::ui(11.5), t.text_dim);p.line_segment([hdr.left_bottom(), hdr.right_bottom()], Stroke::new(1.0, t.separator));let body = Rect::from_min_max(pos2(rect.min.x, hdr.max.y), rect.max);-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("ec-scroll"), body);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("ec-scroll"), body);let mut y = body.min.y + 4.0 - scroll.offset;let mut actions: Actions = vec![];let bp = p.with_clip_rect(body);@@@ -1165,12 -1153,12 +1157,12 @@@);}// Clicking empty space deselects the effects.-- let bg = ui.interact(body, egui::Id::new("ec-bg"), Sense::click());++ let bg = ui.interact(body, egui::Id::unique("ec-bg"), Sense::click());if bg.clicked() {app.session.state.selected_props.retain(|(l, u)| !(*l == layer.id && fx.iter().any(|g| effect_active(g, layer.id, &[(*l, *u)]))));}let has_clip = !app.session.state.effect_clipboard.is_empty();-- let drag_id = egui::Id::new("ec-drag-effect");++ let drag_id = egui::Id::unique("ec-drag-effect");let dragging: Option<u64> = ctx.data(|d| d.get_temp(drag_id));// Header tops, for drag-to-reorder.let mut tops: Vec<(u64, f32)> = vec![];@@@ -1197,16 -1185,16 +1189,16 @@@);}let fxr = Rect::from_center_size(pos2(r.min.x + 14.0, r.center().y), vec2(16.0, 16.0));-- if widgets::icon_toggle(ui, fxr, Icon::Fx, g.enabled, &t, egui::Id::new(("ec-fx", g.uid)), Sense::click()).clicked() {++ if widgets::icon_toggle(ui, fxr, Icon::Fx, g.enabled, &t, egui::Id::unique(("ec-fx", g.uid)), Sense::click()).clicked() {actions.push(("effect.toggle".into(), json!({"layer": layer.id.0, "effect": g.uid})));}app.auto.add(&format!("effectControls.effect.{}.fx", g.uid), fxr, &g.name);let tw = Rect::from_center_size(pos2(r.min.x + 32.0, r.center().y), vec2(12.0, 12.0));-- if widgets::twirl(ui, tw, open, egui::Id::new(("ec-tw", g.uid)), &t).clicked() {++ if widgets::twirl(ui, tw, open, egui::Id::unique(("ec-tw", g.uid)), &t).clicked() {toggle_closed(app, g, open, ui.input(|i| i.modifiers.alt || i.modifiers.command));}app.auto.add(&format!("effectControls.effect.{}.twirl", g.uid), tw, &g.name);-- let rename_id = egui::Id::new(("ec-rename", g.uid));++ let rename_id = egui::Id::unique(("ec-rename", g.uid));let editing: Option<String> = ctx.data(|d| d.get_temp(rename_id));let reset = Rect::from_min_size(pos2(r.max.x - 96.0, r.center().y - 9.0), vec2(40.0, 18.0));if let Some(mut value) = editing.as_ref().cloned() {@@@ -1239,7 -1227,7 +1231,7 @@@let name = bp.text(pos2(tw.max.x + 6.0, r.center().y), Align2::LEFT_CENTER, &shown, Tokens::semibold(12.0), t.text);app.auto.add(&format!("effectControls.effect.{}.name", g.uid), name, &g.name);}-- let rresp = ui.interact(reset, egui::Id::new(("ec-reset", g.uid)), Sense::click());++ let rresp = ui.interact(reset, egui::Id::unique(("ec-reset", g.uid)), Sense::click());bp.text(reset.center(), Align2::CENTER_CENTER, crate::i18n::tr("Reset"), Tokens::ui(11.5), if rresp.hovered() { t.hot_text } else { t.text_dim });app.auto.add(&format!("effectControls.effect.{}.reset", g.uid), reset, "Reset");if rresp.clicked() {@@@ -1247,10 -1235,10 +1239,10 @@@}// About…: the effect's name and category (AE's About dialog).let about = Rect::from_min_size(pos2(r.max.x - 50.0, r.center().y - 9.0), vec2(44.0, 18.0));-- let aresp = ui.interact(about, egui::Id::new(("ec-about", g.uid)), Sense::click());++ let aresp = ui.interact(about, egui::Id::unique(("ec-about", g.uid)), Sense::click());bp.text(about.center(), Align2::CENTER_CENTER, crate::i18n::tr("About..."), Tokens::ui(11.5), if aresp.hovered() { t.hot_text } else { t.text_dim });app.auto.add(&format!("effectControls.effect.{}.about", g.uid), about, "About");-- let apop = egui::Id::new(("ec-about-pop", g.uid));++ let apop = egui::Id::unique(("ec-about-pop", g.uid));if aresp.clicked() {widgets::open_popup(ui, apop);}@@@ -1264,14 -1252,14 +1256,14 @@@}let hresp = ui.interact(Rect::from_min_max(pos2(tw.max.x, r.min.y), pos2(reset.min.x - 4.0, r.max.y)),-- egui::Id::new(("ec-hdr", g.uid)),++ egui::Id::unique(("ec-hdr", g.uid)),if editing.is_some() { Sense::hover() } else { Sense::click_and_drag() },);if hresp.double_clicked() {ctx.data_mut(|d| d.insert_temp(rename_id, shown.clone()));ctx.data_mut(|d| d.insert_temp(rename_id.with("start"), true));}-- hresp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, true, active, &shown));++ hresp.widget_info(|| egui::WidgetInfo::selected(egui::Role::Button, true, active, &shown));app.auto.add(&format!("effectControls.effect.{}", g.uid), r, &g.name);if hresp.clicked() || hresp.drag_started() || hresp.secondary_clicked() {let add = ui.input(|i| i.modifiers.shift || i.modifiers.command);@@@ -1363,7 -1351,7 +1355,7 @@@if effect == "ec.color.tint" {let r = Rect::from_min_size(pos2(body.min.x + PARAM_NAME_X, y + 2.0), vec2(120.0, ROW));let label = crate::i18n::tr("Swap Colors");-- let resp = widgets::text_button(ui, r, label, false, &t, egui::Id::new(("ec-tint-swap", g.uid)));++ let resp = widgets::text_button(ui, r, label, false, &t, egui::Id::unique(("ec-tint-swap", g.uid)));app.auto.add_response(&format!("effectControls.effect.{}.swapColors", g.uid), &resp, label);if resp.clicked() {actions.push(("prop.select".into(), json!({"layer": layer.id.0, "prop": g.uid})));@@@ -1489,7 -1477,7 +1481,7 @@@ pub fn viewer_hook// GPU frames: read the shown frame back for sampling.app.viewer_pixels();}-- let resp = ui.interact(map.area, egui::Id::new("viewer-fx-pick"), Sense::click());++ let resp = ui.interact(map.area, egui::Id::unique("viewer-fx-pick"), Sense::click());app.auto.add("viewer.fxPick", map.area, &pick.name);let hint = if pick.kind == "point" { format!("Click to set {}", pick.name) } else { format!("Click to sample {}", pick.name) };let chip = Rect::from_min_size(map.area.min + vec2(10.0, 10.0), vec2(220.0, 22.0));@@@ -1554,7 -1542,7 +1546,7 @@@app.ui.status.clear();} else {app.viewer_pixels();-- let resp = ui.interact(map.area, egui::Id::new("viewer-text-color-pick"), Sense::click());++ let resp = ui.interact(map.area, egui::Id::unique("viewer-text-color-pick"), Sense::click());app.auto.add("viewer.textColorPick", map.area, &pick.field);let chip = Rect::from_min_size(map.area.min + vec2(10.0, 10.0), vec2(220.0, 22.0));painter.rect_filled(chip, 11.0, Color32::from_black_alpha(180));@@@ -1648,7 -1636,7 +1640,7 @@@}for (pr, s) in pts.iter().zip(screen) {let hr = Rect::from_center_size(s, vec2(16.0, 16.0));-- let id = egui::Id::new(("viewer-fx-pt", pr.uid));++ let id = egui::Id::unique(("viewer-fx-pt", pr.uid));// The picker owns the click. Preview handles must not steal it or start a drag.let resp = (!picking).then(|| ui.interact(hr, id, Sense::drag()));let col = if picked_prop == Some(pr.uid) || resp.as_ref().is_some_and(|r| r.hovered() || r.dragged()) { t.accent } else { Color32::WHITE };diff --cc crates/ui-egui/src/panels/effects_presets.rsindex d2058fbea,d2058fbea..3e4bd9275--- a/crates/ui-egui/src/panels/effects_presets.rs+++ b/crates/ui-egui/src/panels/effects_presets.rs@@@ -133,7 -133,7 +133,7 @@@ fn folder_rowif r.max.y < list.min.y || r.min.y > list.max.y {return open;}-- let resp = ui.interact(r.intersect(list), egui::Id::new(("fxcat", key)), Sense::click());++ let resp = ui.interact(r.intersect(list), egui::Id::unique(("fxcat", key)), Sense::click());if resp.hovered() {lp.rect_filled(r, 0.0, t.hover);}@@@ -179,7 -179,7 +179,7 @@@ fn effect_rowreturn;}let star = Rect::from_center_size(pos2(r.max.x - 38.0, r.center().y), vec2(16.0, 16.0));-- let resp = ui.interact(r.intersect(list), egui::Id::new((auto_prefix, e.id)), Sense::click_and_drag());++ let resp = ui.interact(r.intersect(list), egui::Id::unique((auto_prefix, e.id)), Sense::click_and_drag());if resp.hovered() {lp.rect_filled(r, 0.0, t.hover);}@@@ -194,7 -194,7 +194,7 @@@app.auto.add(&format!("{auto_prefix}.{}", e.id), r, e.name);// Favourite star (always shown when starred, else on hover).let fav = app.session.prefs.is_effect_favorite(e.id);-- let sresp = ui.interact(star.intersect(list), egui::Id::new((auto_prefix, e.id, "star")), Sense::click());++ let sresp = ui.interact(star.intersect(list), egui::Id::unique((auto_prefix, e.id, "star")), Sense::click());if fav || resp.hovered() || sresp.hovered() {let gold = Color32::from_rgb(0xe8, 0xc0, 0x40);filled_star(lp, star.center(), 6.0, fav.then_some(gold), if fav || sresp.hovered() { gold } else { t.text_faint });@@@ -234,7 -234,7 +234,7 @@@ fn preset_rowif r.max.y < list.min.y || r.min.y > list.max.y {return;}-- let resp = ui.interact(r.intersect(list), egui::Id::new(("fxpreset", auto_id)), Sense::click_and_drag());++ let resp = ui.interact(r.intersect(list), egui::Id::unique(("fxpreset", auto_id)), Sense::click_and_drag());if resp.hovered() {lp.rect_filled(r, 0.0, t.hover);}@@@ -251,7 -251,7 +251,7 @@@/// User preset files, rescanned every few seconds (and on Refresh List).fn user_presets(ctx: &egui::Context, force: bool, scan: impl FnOnce() -> Vec<PresetFile>) -> Arc<Vec<PresetFile>> {-- let id = egui::Id::new("fx-user-presets");++ let id = egui::Id::unique("fx-user-presets");let now = ctx.input(|i| i.time);if !force&& let Some((at, v)) = ctx.data(|d| d.get_temp::<(f64, Arc<Vec<PresetFile>>)>(id))@@@ -281,8 -281,8 +281,8 @@@ pub fn show(app: &mut EffectcraftApp, uapp.auto.add("effects.search", sr, "Search");// Contents menu.let mr = Rect::from_center_size(pos2(rect.max.x - 18.0, sr.center().y), vec2(22.0, 22.0));-- let mpop = egui::Id::new("fx-contents-menu");-- if widgets::icon_button(ui, mr, Icon::Hamburger, false, &t, egui::Id::new("fx-menu")).on_hover_text(tr("Effects & Presets options")).clicked() {++ let mpop = egui::Id::unique("fx-contents-menu");++ if widgets::icon_button(ui, mr, Icon::Hamburger, false, &t, egui::Id::unique("fx-menu")).on_hover_text(tr("Effects & Presets options")).clicked() {widgets::open_popup(ui, mpop);}app.auto.add("effects.menu", mr, "Effects & Presets options");@@@ -350,7 -350,7 +350,7 @@@let view = app.ui.effects_view.clone();let list = Rect::from_min_max(pos2(rect.min.x, sr.max.y + 6.0), rect.max);let lp = p.with_clip_rect(list);-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("fx-scroll"), list);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("fx-scroll"), list);let query = q.trim().to_lowercase();let searching = !query.is_empty();let mut y = list.min.y - scroll.offset;@@@ -462,7 -462,7 +462,7 @@@_ => None,}) && let Some(pos) = ctx.pointer_hover_pos(){-- let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::new("dnd-fx")));++ let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("dnd-fx")));let g = painter.layout_no_wrap(name, Tokens::ui(12.0), t.text);let r = Rect::from_min_size(pos + vec2(12.0, 8.0), g.size() + vec2(16.0, 8.0));painter.rect_filled(r, 4.0, Color32::from_rgba_premultiplied(40, 40, 40, 230));@@@ -582,7 -582,7 +582,7 @@@ mod testsfor _ in 0..5 {let start = std::time::Instant::now();for _ in 0..1000 {-- let (_, shared) = ctx.data(|d| d.get_temp::<(f64, Arc<Vec<PresetFile>>)>(egui::Id::new("fx-user-presets"))).unwrap();++ let (_, shared) = ctx.data(|d| d.get_temp::<(f64, Arc<Vec<PresetFile>>)>(egui::Id::unique("fx-user-presets"))).unwrap();std::hint::black_box((*shared).clone());}before.push(start.elapsed());diff --cc crates/ui-egui/src/panels/essential.rsindex 2e99c7d39,2e99c7d39..19fba3358--- a/crates/ui-egui/src/panels/essential.rs+++ b/crates/ui-egui/src/panels/essential.rs@@@ -79,6 -79,6 +79,10 @@@ fn body(app: &mut EffectcraftApp, ui: &}}});++ // The label beside the combo names it for a screen reader; the selected comp alone++ // doesn't say what the dropdown chooses. Keep the visible label and value together.++ let primary_name = format!("{} {}", tr("Primary:"), comp_name);++ r.response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::ComboBox, ui.is_enabled(), &primary_name));app.auto.add("essential.primary", r.response.rect, &comp_name);});let solo = app.session.state.essential_solo;@@@ -90,7 -90,7 +94,7 @@@// ---- Name.let eg = project.comp(cid).and_then(|c| c.essential.clone()).unwrap_or_default();let shown_name = if eg.name.is_empty() { comp_name.clone() } else { eg.name.clone() };-- let name_id = egui::Id::new("eg-name-buf");++ let name_id = egui::Id::unique("eg-name-buf");let mut name: String = ctx.data(|d| d.get_temp(name_id)).unwrap_or_else(|| shown_name.clone());let r = ui.add(egui::TextEdit::singleline(&mut name).hint_text(tr("Template name")).desired_width(f32::INFINITY));app.auto.add("essential.name", r.rect, &shown_name);@@@ -291,7 -291,7 +295,7 @@@ fn link_menu(app: &mut EffectcraftApp,/// A control's name; double-click to rename (comments: edit the text).fn name_label(app: &mut EffectcraftApp, ui: &mut egui::Ui, cid: ItemId, c: &EgControl, text: RichText, actions: &mut Actions) {-- let edit_id = egui::Id::new(("eg-rename", c.id));++ let edit_id = egui::Id::unique(("eg-rename", c.id));let editing: Option<String> = ui.ctx().data(|d| d.get_temp(edit_id));match editing {Some(mut buf) => {@@@ -329,7 -329,7 +333,7 @@@ fn value_widget(app: &mut EffectcraftApKV::Str(s) => s.clone(),_ => String::new(),};-- let id = egui::Id::new(("eg-text", auto));++ let id = egui::Id::unique(("eg-text", auto));let mut buf: String = ui.ctx().data(|d| d.get_temp(id)).unwrap_or_else(|| cur.clone());let r = ui.add(egui::TextEdit::singleline(&mut buf).desired_width(140.0));if r.has_focus() {diff --cc crates/ui-egui/src/panels/expr_bar.rsindex 4f6d1c747,4f6d1c747..e40d0a2d0--- a/crates/ui-egui/src/panels/expr_bar.rs+++ b/crates/ui-egui/src/panels/expr_bar.rs@@@ -24,7 -24,7 +24,7 @@@ struct Cache}fn cache_id(cid: ItemId) -> egui::Id {-- egui::Id::new(("expr-error-bar", cid.0))++ egui::Id::unique(("expr-error-bar", cid.0))}/// Both layout and painting read the same completed diagnostics; neither evaluates expressions.@@@ -64,7 -64,7 +64,7 @@@ pub fn draw(app: &mut EffectcraftApp, ulet count = Rect::from_center_size(pos2(rect.max.x - 44.0, rect.center().y), vec2(40.0, 16.0));let prev = Rect::from_center_size(pos2(rect.max.x - 74.0, rect.center().y), vec2(16.0, 16.0));for (r, label, auto, d) in [(prev, "◀", "viewer.exprErrors.prev", n - 1), (next, "▶", "viewer.exprErrors.next", 1)] {-- let resp = ui.interact(r, egui::Id::new(("expr-bar", auto)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("expr-bar", auto)), Sense::click());p.text(r.center(), Align2::CENTER_CENTER, label, Tokens::ui(11.0), if resp.hovered() { Color32::WHITE } else { t.text });app.auto.add(auto, r, label);if resp.clicked() {@@@ -76,7 -76,7 +76,7 @@@let comp_name = app.session.project.item(cid).map(|it| it.name.clone()).unwrap_or_default();let Some(e) = c.errors.get(i).cloned() else { return };let msg_rect = Rect::from_min_max(pos2(rect.min.x + 26.0, rect.min.y), pos2(prev.min.x - 6.0, rect.max.y));-- let resp = ui.interact(msg_rect, egui::Id::new("expr-bar-msg"), Sense::click()).on_hover_text(tr("Click to reveal the expression in the timeline"));++ let resp = ui.interact(msg_rect, egui::Id::unique("expr-bar-msg"), Sense::click()).on_hover_text(tr("Click to reveal the expression in the timeline"));p.with_clip_rect(msg_rect).text(pos2(msg_rect.min.x, rect.center().y),Align2::LEFT_CENTER,diff --cc crates/ui-egui/src/panels/flowchart.rsindex f59d35982,f59d35982..c7019492f--- a/crates/ui-egui/src/panels/flowchart.rs+++ b/crates/ui-egui/src/panels/flowchart.rs@@@ -270,7 -270,7 +270,7 @@@ pub fn show(app: &mut EffectcraftApp, ulet w = 18.0 + label.len() as f32 * 6.6;let r = Rect::from_min_size(pos2(x - w, bar.min.y + 5.0), vec2(w, 20.0));x -= w + 6.0;-- if widgets::text_button(ui, r, label, on, &t, egui::Id::new(("flow-opt", key))).clicked() {++ if widgets::text_button(ui, r, label, on, &t, egui::Id::unique(("flow-opt", key))).clicked() {let v = if key == "direction" { json!({"direction": if o.vertical { "lr" } else { "tb" }}) } else { json!({key: !on}) };cmds.push(("flowchart.options".into(), v));}@@@ -282,7 -282,7 +282,7 @@@let g = build(&app.session.project, rid, &o);let pos = layout(&g, o.vertical);let origin = body.min + vec2(24.0 + o.pan[0], 24.0 + o.pan[1]);-- let bg = ui.interact(body, egui::Id::new("flow-bg"), Sense::click_and_drag());++ let bg = ui.interact(body, egui::Id::unique("flow-bg"), Sense::click_and_drag());if bg.dragged() {let d = bg.drag_delta();app.ui.flowchart.pan[0] += d.x;@@@ -322,7 -322,7 +322,7 @@@}let (icon, fill) = kind_style(n.kind);let selected = o.selected.as_deref() == Some(n.id.as_str());-- let resp = ui.interact(r.intersect(body), egui::Id::new(("flow-node", &n.id)), Sense::click());++ let resp = ui.interact(r.intersect(body), egui::Id::unique(("flow-node", &n.id)), Sense::click());let fill = if resp.hovered() { fill.gamma_multiply(1.25) } else { fill };gp.rect_filled(r, 5.0, fill);gp.rect_stroke(diff --cc crates/ui-egui/src/panels/footage_panel.rsindex a9e7cefb2,a9e7cefb2..31d9beeda--- a/crates/ui-egui/src/panels/footage_panel.rs+++ b/crates/ui-egui/src/panels/footage_panel.rs@@@ -58,7 -58,7 +58,7 @@@ pub fn show(app: &mut EffectcraftApp, u&& f.has_video{let key = (view.item.0, view.time.0, app.session.revision);-- let tid = egui::Id::new("footage-panel-tex");++ let tid = egui::Id::unique("footage-panel-tex");let cached: Option<((u64, i64, u64), egui::TextureHandle, [u32; 2])> = ctx.data(|d| d.get_temp(tid));let tex = match cached {Some((k, tex, size)) if k == key => Some((tex, size)),@@@ -97,7 -97,7 +97,7 @@@p.rect_filled(Rect::from_min_max(pos2(x_of(a), ruler.max.y - 4.0), pos2(x_of(b), ruler.max.y)), 0.0, t.work_area);let cx = x_of(view.time);p.line_segment([pos2(cx, ruler.min.y), pos2(cx, ruler.max.y)], Stroke::new(1.5, t.cti));-- let resp = ui.interact(ruler, egui::Id::new("footage-ruler"), Sense::click_and_drag());++ let resp = ui.interact(ruler, egui::Id::unique("footage-ruler"), Sense::click_and_drag());app.auto.add("footage.ruler", ruler, "Time ruler");if (resp.clicked() || resp.dragged())&& let Some(pt) = resp.interact_pointer_pos()@@@ -106,7 -106,7 +106,7 @@@kit::exec(app, "footage.setTime", json!({"time": s}));}// Playback.-- let play_id = egui::Id::new("footage-playing");++ let play_id = egui::Id::unique("footage-playing");let playing: bool = ctx.data(|d| d.get_temp(play_id).unwrap_or(false));if playing {let dt = ctx.input(|i| i.stable_dt).min(0.1) as f64;diff --cc crates/ui-egui/src/panels/fx_editors.rsindex 1ae74caa2,56a186e8e..7ee11b714--- a/crates/ui-egui/src/panels/fx_editors.rs+++ b/crates/ui-egui/src/panels/fx_editors.rs@@@ -83,7 -83,7 +83,7 @@@ fn tabsfor (i, name) in names.iter().enumerate() {let w = if cols.is_empty() { 16.0 + name.chars().count() as f32 * 6.2 } else { 20.0 };let r = Rect::from_min_size(pos2(x, cy - 9.0), vec2(w, 18.0));-- let resp = ui.interact(r, egui::Id::new((id, i)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique((id, i)), Sense::click());let sel = i == cur;if sel {p.rect_filled(r, 3.0, t.row_selected);@@@ -113,7 -113,7 +113,7 @@@fn reset_link(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painter, r: Rect, id: &str) -> bool {let t = app.tokens;-- let resp = ui.interact(r, egui::Id::new(id), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(id), Sense::click());p.text(r.center(), Align2::CENTER_CENTER, tr("Reset"), Tokens::ui(11.5), if resp.hovered() { t.hot_text } else { t.text_dim });app.auto.add(id, r, "Reset");resp.clicked()@@@ -192,8 -192,8 +192,8 @@@ fn rgb_curvesset_str(actions, layer, g, id, fw::CurvePoints::identity().format(), None);}let gr = Rect::from_min_size(pos2(x0, r.min.y + 30.0), vec2(size, size));-- let gid = egui::Id::new(("lumetri-rgb", euid, ch));- let (resp, edit) = fw::curves_graph(ui, gr, &cur, ch, false, gid, &t);++ let gid = egui::Id::unique(("lumetri-rgb", euid, ch));+ let (resp, edit) = fw::curves_graph(ui, gr, &cur, ch, false, false, gid, &t);app.auto.add(&format!("{prefix}.graph"), gr, "RGB Curves");register_points(app, &prefix, gr, &cur.0);let key = gesture_key(ui, gid, resp.drag_started() || resp.clicked());@@@ -321,7 -321,7 +321,7 @@@ fn huesat_curves}).collect();p.add(egui::Shape::line(line, Stroke::new(1.5, Color32::from_gray(0xe8))));-- let gid = egui::Id::new(("lumetri-hs", euid, k));++ let gid = egui::Id::unique(("lumetri-hs", euid, k));let resp = ui.interact(gr.expand(6.0), gid, Sense::click_and_drag());app.auto.add(&format!("{prefix}.graph"), gr, name);let drag_id = gid.with("drag");@@@ -476,7 -476,7 +476,7 @@@ fn colorama_wheel}p.circle_stroke(c, outer, Stroke::new(1.0, Color32::from_black_alpha(160)));p.circle_stroke(c, inner, Stroke::new(1.0, Color32::from_black_alpha(160)));-- let wid = egui::Id::new(("colorama-wheel", euid));++ let wid = egui::Id::unique(("colorama-wheel", euid));let ring = Rect::from_center_size(c, vec2(outer * 2.0 + 40.0, outer * 2.0 + 40.0));let resp = ui.interact(ring, wid, Sense::click_and_drag());app.auto.add(&format!("{prefix}.wheel"), ring, "Output Cycle");@@@ -712,8 -712,8 +712,8 @@@ fn glow_map(app: &mut EffectcraftApp, uset_str(actions, layer, g, "arbitraryMap", join_map(&m), None);}let gr = Rect::from_min_size(pos2(x0, r.min.y + 30.0), vec2(size, size));-- let gid = egui::Id::new(("glow-map", euid, ch));- let (resp, edit) = fw::curves_graph(ui, gr, &map[ch], ch + 1, false, gid, &t);++ let gid = egui::Id::unique(("glow-map", euid, ch));+ let (resp, edit) = fw::curves_graph(ui, gr, &map[ch], ch + 1, false, false, gid, &t);app.auto.add(&format!("{prefix}.graph"), gr, "Arbitrary Map");register_points(app, &prefix, gr, &map[ch].0);let key = gesture_key(ui, gid, resp.drag_started() || resp.clicked());@@@ -786,19 -786,19 +786,19 @@@ fn reshape_buttonslet b1 = Rect::from_min_size(pos2(r.min.x + 24.0, r.min.y + 4.0), vec2(84.0, 22.0));let b2 = Rect::from_min_size(pos2(b1.max.x + 8.0, b1.min.y), vec2(96.0, 22.0));let b3 = Rect::from_min_size(pos2(b2.max.x + 8.0, b1.min.y), vec2(56.0, 22.0));-- if widgets::text_button(ui, b1, "Add Point", false, &t, egui::Id::new(("reshape-add", euid))).clicked() {++ if widgets::text_button(ui, b1, "Add Point", false, &t, egui::Id::unique(("reshape-add", euid))).clicked() {let mut v = pairs.clone();v.push(add_pair(&pairs));set_str(actions, layer, g, "correspondencePoints", format_pairs(&v), None);}app.auto.add(&format!("effectControls.effect.{euid}.reshape.add"), b1, "Add Point");-- if widgets::text_button(ui, b2, "Remove Point", false, &t, egui::Id::new(("reshape-remove", euid))).clicked() && !pairs.is_empty() {++ if widgets::text_button(ui, b2, "Remove Point", false, &t, egui::Id::unique(("reshape-remove", euid))).clicked() && !pairs.is_empty() {let mut v = pairs.clone();v.pop();set_str(actions, layer, g, "correspondencePoints", format_pairs(&v), None);}app.auto.add(&format!("effectControls.effect.{euid}.reshape.remove"), b2, "Remove Point");-- if widgets::text_button(ui, b3, "Clear", false, &t, egui::Id::new(("reshape-clear", euid))).clicked() && !pairs.is_empty() {++ if widgets::text_button(ui, b3, "Clear", false, &t, egui::Id::unique(("reshape-clear", euid))).clicked() && !pairs.is_empty() {set_str(actions, layer, g, "correspondencePoints", String::new(), None);}app.auto.add(&format!("effectControls.effect.{euid}.reshape.clear"), b3, "Clear");@@@ -857,8 -857,8 +857,8 @@@ fn extractor_layersp.text(pos2(r.min.x + 37.0, r.center().y), Align2::LEFT_CENTER, tr("Layer"), Tokens::ui(12.0), t.text);let vx = (r.min.x + r.width() * 0.48).max(r.min.x + 161.0);let dr = Rect::from_min_size(pos2(vx, r.center().y - 9.0), vec2((r.max.x - vx - 56.0).clamp(80.0, 200.0), 18.0));-- let pop = egui::Id::new(("extractor-layers", euid));-- if widgets::dropdown(ui, dr, &label, &t, egui::Id::new(("extractor-layer", euid)))++ let pop = egui::Id::unique(("extractor-layers", euid));++ if widgets::dropdown(ui, dr, &label, &t, egui::Id::unique(("extractor-layer", euid))).on_hover_text(tr("The OpenEXR layer shown in red, green, blue and alpha")).clicked(){@@@ -899,8 -899,8 +899,8 @@@ pub fn channel_popuplet t = app.tokens;let uid = prop.uid;let label = if cur.trim().is_empty() { NO_CHANNEL } else { cur };-- let pop = egui::Id::new(("ec-chpop", uid));-- if widgets::dropdown(ui, r, label, &t, egui::Id::new(("ec-ch", uid))).clicked() {++ let pop = egui::Id::unique(("ec-chpop", uid));++ if widgets::dropdown(ui, r, label, &t, egui::Id::unique(("ec-ch", uid))).clicked() {widgets::open_popup(ui, pop);}app.auto.add(&format!("effectControls.prop.{uid}.value"), r, &prop.name);@@@ -992,7 -992,7 +992,7 @@@ pub fn reshape_overlaypainter.line_segment([ps, pd], Stroke::new(1.0, Color32::from_white_alpha(150)));for (end, s, col) in [(0usize, ps, ys), (1, pd, cs)] {let hr = Rect::from_center_size(s, vec2(12.0, 12.0));-- let id = egui::Id::new(("reshape-pt", g.uid, i, end));++ let id = egui::Id::unique(("reshape-pt", g.uid, i, end));let resp = ui.interact(hr, id, Sense::drag());let hot = resp.hovered() || resp.dragged();painter.rect_filled(Rect::from_center_size(s, vec2(7.0, 7.0)), 0.0, if hot { Color32::WHITE } else { col });@@@ -1086,7 -1086,7 +1086,7 @@@ pub fn mesh_warp_overlaylet accent = app.tokens.accent;for (k, s) in screen.iter().enumerate() {let hr = Rect::from_center_size(*s, vec2(10.0, 10.0));-- let id = egui::Id::new(("mesh-warp-vertex", g.uid, k));++ let id = egui::Id::unique(("mesh-warp-vertex", g.uid, k));let resp = ui.interact(hr, id, Sense::drag());let hot = resp.hovered() || resp.dragged();let dot = Rect::from_center_size(*s, vec2(5.0, 5.0));diff --cc crates/ui-egui/src/panels/gradient_editor.rsindex bb6923025,bb6923025..9db4d6163--- a/crates/ui-egui/src/panels/gradient_editor.rs+++ b/crates/ui-egui/src/panels/gradient_editor.rs@@@ -291,7 -291,7 +291,7 @@@ pub fn show(app: &mut EffectcraftApp, c// Clicking a row's empty space adds a stop there.for (track, rowr, id) in [(Track::Opacity, opacity_row, "dialog.gradient.addOpacity"), (Track::Color, color_row, "dialog.gradient.addColor")] {-- let r = ui.interact(rowr, egui::Id::new(("gradient-add", id)), Sense::click());++ let r = ui.interact(rowr, egui::Id::unique(("gradient-add", id)), Sense::click());app.auto.add(id, rowr, id);if r.clicked()&& let Some(p) = r.interact_pointer_pos()@@@ -323,7 -323,7 +323,7 @@@Stroke::new(if selected { 2.0 } else { 1.0 }, if selected { t.accent } else { t.field_border }),StrokeKind::Outside,);-- let resp = ui.interact(r.expand(2.0), egui::Id::new(("gradient-stop", track == Track::Color, id)), Sense::click_and_drag());++ let resp = ui.interact(r.expand(2.0), egui::Id::unique(("gradient-stop", track == Track::Color, id)), Sense::click_and_drag());let name = match track {Track::Opacity => format!("dialog.gradient.opacityStop.{i}"),Track::Color => format!("dialog.gradient.colorStop.{i}"),diff --cc crates/ui-egui/src/panels/gradient_handles.rsindex e855a49e1,e855a49e1..bc0ec4d82--- a/crates/ui-egui/src/panels/gradient_handles.rs+++ b/crates/ui-egui/src/panels/gradient_handles.rs@@@ -76,7 -76,7 +76,7 @@@ pub fn viewer_hook}for (pr, s) in pts.iter().zip(screen) {let hr = Rect::from_center_size(s, vec2(16.0, 16.0));-- let id = egui::Id::new(("viewer-gradient-pt", pr.uid));++ let id = egui::Id::unique(("viewer-gradient-pt", pr.uid));let resp = ui.interact(hr, id, Sense::drag());let col = if resp.hovered() || resp.dragged() { t.accent } else { Color32::WHITE };fw::draw_crosshair(painter, s + vec2(1.0, 1.0), 5.0, Color32::from_black_alpha(160));diff --cc crates/ui-egui/src/panels/graph.rsindex 0b372c0a0,0b372c0a0..fa082040c--- a/crates/ui-egui/src/panels/graph.rs+++ b/crates/ui-egui/src/panels/graph.rs@@@ -190,7 -190,7 +190,7 @@@ impl ButtonBarconst MORE_W: f32 = 24.0;fn new(ctx: &egui::Context, bar: Rect) -> Self {-- let chosen = ctx.data_mut(|d| d.remove_temp::<String>(egui::Id::new(MORE_POPUP).with("chosen")));++ let chosen = ctx.data_mut(|d| d.remove_temp::<String>(egui::Id::unique(MORE_POPUP).with("chosen")));ButtonBar { x: bar.min.x + 8.0, limit: bar.max.x - 8.0 - Self::MORE_W - 4.0, hidden: Vec::new(), chosen }}@@@ -201,7 -201,7 +201,7 @@@}let t = app.tokens;let r = Rect::from_min_size(pos2(bar.max.x - 8.0 - Self::MORE_W, bar.center().y - 9.0), vec2(Self::MORE_W, 18.0));-- let pid = egui::Id::new(MORE_POPUP);++ let pid = egui::Id::unique(MORE_POPUP);let resp = ui.interact(r, pid.with("button"), Sense::click()).on_hover_text(crate::i18n::tr("More"));p.rect_filled(r, 3.0, if resp.hovered() { t.hover } else { Color32::from_rgb(0x2c, 0x2c, 0x2c) });p.text(r.center(), Align2::CENTER_CENTER, "»", Tokens::ui(12.0), t.text);@@@ -252,7 -252,7 +252,7 @@@ fn text_buttonreturn bar.chosen.as_deref() == Some(id);}let r = Rect::from_min_size(pos2(bar.x, y - 9.0), vec2(w, 18.0));-- let resp = ui.interact(r, egui::Id::new(("graph-btn", id)), Sense::click()).on_hover_text(tip);++ let resp = ui.interact(r, egui::Id::unique(("graph-btn", id)), Sense::click()).on_hover_text(tip);p.rect_filled(r,3.0,@@@ -278,14 -278,14 +278,14 @@@ pub(crate) fn show(app: &mut Effectcraflet plot = Rect::from_min_max(area.min + vec2(0.0, 6.0), pos2(area.max.x, area.max.y - footer_h));let bar = Rect::from_min_max(pos2(area.min.x, area.max.y - footer_h), area.max);// Background first so keys and handles (added later) sit on top for hit-testing.-- let bg = ui.interact(plot, egui::Id::new("graph-bg"), Sense::click_and_drag());++ let bg = ui.interact(plot, egui::Id::unique("graph-bg"), Sense::click_and_drag());p.rect_filled(area, 0.0, Color32::from_rgb(0x1d, 0x1d, 0x1d));app.auto.add("timeline.graph", plot, &app.ui.timeline.graph_mode.clone());let speed = speed_graph(app, comp);let cs = curves(app, comp, ectx, tm, plot, speed);// Just opened, or the graph type changed (value and speed have different units): frame the// graphs (Fit Selection to View, else Fit All Graphs to View).-- let was_speed_id = egui::Id::new("graph-was-speed");++ let was_speed_id = egui::Id::unique("graph-was-speed");let type_changed = ctx.data(|d| d.get_temp::<bool>(was_speed_id)).is_some_and(|was| was != speed);ctx.data_mut(|d| d.insert_temp(was_speed_id, speed));if ctx.data_mut(|d| d.remove_temp::<bool>(fit_pending_id())).unwrap_or(false) || type_changed {@@@ -322,7 -322,7 +322,7 @@@let pad = (hi - lo) * 0.08;let auto = (lo - pad, hi + pad);// While a key or handle is being dragged the scale stays put (no feedback loop).-- let drag_id = egui::Id::new("graph-dragging");++ let drag_id = egui::Id::unique("graph-dragging");let dragging = ctx.data(|d| d.get_temp::<bool>(drag_id)).unwrap_or(false) && ctx.input(|i| i.pointer.any_down());let (lo, hi) = if app.ui.timeline.graph_auto_zoom && !dragging { auto } else { app.ui.timeline.graph_range.unwrap_or(auto) };if app.ui.timeline.graph_auto_zoom && !dragging {@@@ -398,7 -398,7 +398,7 @@@let kp = pos2(tm.x(k.t), ymap(k.v));// In the speed graph an end key rises with the handle being dragged; skipping it once it// leaves the plot would drop the handle's widget and end the drag at the top edge.-- let handle_dragged = || ["in", "out"].iter().any(|side| ctx.is_being_dragged(egui::Id::new(("ghandle", uid, d, k.idx, *side))));++ let handle_dragged = || ["in", "out"].iter().any(|side| ctx.is_being_dragged(egui::Id::unique(("ghandle", uid, d, k.idx, *side))));if !plot.expand(6.0).contains(kp) && !handle_dragged() {continue;}@@@ -411,7 -411,7 +411,7 @@@pc.circle_filled(hp, 3.5, Color32::from_rgb(0xd8, 0xd8, 0x60));let side = if h.out { "out" } else { "in" };let hr = Rect::from_center_size(hp, vec2(10.0, 10.0));-- let hresp = ui.interact(hr, egui::Id::new(("ghandle", uid, d, k.idx, side)), Sense::drag());++ let hresp = ui.interact(hr, egui::Id::unique(("ghandle", uid, d, k.idx, side)), Sense::drag());app.auto.add(&format!("timeline.graph.handle.{uid}.{d}.{}.{side}", k.idx), hr, "Bezier handle");// The same side's handles of every selected key move with it, by as much as the// pointer moved (After Effects), in one undo step.@@@ -464,7 -464,7 +464,7 @@@pc.rect_filled(Rect::from_center_size(kp, vec2(7.0, 7.0)), 0.0, col);pc.rect_stroke(Rect::from_center_size(kp, vec2(7.0, 7.0)), 0.0, Stroke::new(1.0, c.color), StrokeKind::Outside);let kr = Rect::from_center_size(kp, vec2(11.0, 11.0));-- let kresp = ui.interact(kr, egui::Id::new(("gkey", uid, d, k.idx)), Sense::click_and_drag());++ let kresp = ui.interact(kr, egui::Id::unique(("gkey", uid, d, k.idx)), Sense::click_and_drag());app.auto.add(&format!("timeline.graph.key.{uid}.{d}.{}", k.idx), kr, &c.prop.name);let mods = ui.input(|i| i.modifiers);let key = &c.prop.keys[k.idx];@@@ -526,12 -526,12 +526,12 @@@let br = Rect::from_two_pos(o, cur);pc.rect_filled(br, 0.0, t.accent.gamma_multiply(0.12));pc.rect_stroke(br, 0.0, Stroke::new(1.0, t.accent), StrokeKind::Middle);-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("graph-box"), br));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("graph-box"), br));}if bg.drag_stopped()-- && let Some(br) = ctx.data(|d| d.get_temp::<Rect>(egui::Id::new("graph-box")))++ && let Some(br) = ctx.data(|d| d.get_temp::<Rect>(egui::Id::unique("graph-box"))){-- ctx.data_mut(|d| d.remove::<Rect>(egui::Id::new("graph-box")));++ ctx.data_mut(|d| d.remove::<Rect>(egui::Id::unique("graph-box")));let keys: Vec<serde_json::Value> = key_screens.iter().filter(|(_, sp)| br.contains(*sp)).map(|(k, _)| k.clone()).collect();actions.push(("keys.select".into(), json!({"keys": keys, "add": ui.input(|i| i.modifiers.shift)})));}@@@ -628,14 -628,14 +628,14 @@@ fn fit_all(app: &mut EffectcraftApp)}fn fit_pending_id() -> egui::Id {-- egui::Id::new("graph-fit-pending")++ egui::Id::unique("graph-fit-pending")}/// Called every Timeline frame with whether the Graph Editor is on: switching it on (header/// button, menu, Shift+F3 or the control channel) frames the graphs on its first frame, when the/// plot rect is known, as After Effects does.pub(crate) fn track_open(ctx: &egui::Context, on: bool) {-- let was_id = egui::Id::new("graph-editor-was-on");++ let was_id = egui::Id::unique("graph-editor-was-on");let was = ctx.data(|d| d.get_temp::<bool>(was_id)).unwrap_or(false);ctx.data_mut(|d| {d.insert_temp(was_id, on);@@@ -740,7 -740,7 +740,7 @@@ struct KeyGrab}fn key_grab_id() -> egui::Id {-- egui::Id::new("graph-key-grab")++ egui::Id::unique("graph-key-grab")}/// A Bezier handle moving with a handle drag: its key, side and dimension, the key's place@@@ -787,7 -787,7 +787,7 @@@ impl HandleGrabtype HandleDrag = (Pos2, Vec<HandleGrab>);fn handle_drag_id() -> egui::Id {-- egui::Id::new("graph-handle-drag")++ egui::Id::unique("graph-handle-drag")}/// Which axes a drag may move on (time, value): both, or with Shift only the one the pointer moved more along.diff --cc crates/ui-egui/src/panels/graph_tools.rsindex a13a5396f,a13a5396f..ee5d7543f--- a/crates/ui-egui/src/panels/graph_tools.rs+++ b/crates/ui-egui/src/panels/graph_tools.rs@@@ -35,7 -35,7 +35,7 @@@ struct BoxDrag}fn box_id() -> egui::Id {-- egui::Id::new("graph-transform-box")++ egui::Id::unique("graph-transform-box")}/// Bounds of the selected keys: (t0, v0, t1, v1).@@@ -80,7 -80,7 +80,7 @@@ pub(crate) fn transform_boxlet value_ok = !speed && keys.iter().all(|k| k.editable);let col = Color32::from_rgb(0xd8, 0xd8, 0xd8);let ctx = ui.ctx().clone();-- let drag_id = egui::Id::new("graph-dragging");++ let drag_id = egui::Id::unique("graph-dragging");let hp = handle_points(r);let data = |q: Pos2| [tm.t(q.x), vmap(q.y)];// Which data point each handle sits on, and its opposite.@@@ -100,7 -100,7 +100,7 @@@let mut resp_any: Option<egui::Response> = None;if !handles {p.rect_stroke(r, 0.0, Stroke::new(1.0, col.gamma_multiply(0.7)), StrokeKind::Middle);-- let resp = ui.interact(r, egui::Id::new("graph-box-inside"), Sense::drag());++ let resp = ui.interact(r, egui::Id::unique("graph-box-inside"), Sense::drag());app.auto.add("timeline.graph.transformBox", r, "Transform box");if resp.drag_started()&& let Some(o) = ui.input(|i| i.pointer.press_origin())@@@ -117,7 -117,7 +117,7 @@@let hr = Rect::from_center_size(*h, vec2(7.0, 7.0));p.rect_filled(hr, 0.0, Color32::from_gray(0x20));p.rect_stroke(hr, 0.0, Stroke::new(1.0, col), StrokeKind::Middle);-- let resp = ui.interact(hr.expand(2.0), egui::Id::new(("graph-box-handle", i)), Sense::drag());++ let resp = ui.interact(hr.expand(2.0), egui::Id::unique(("graph-box-handle", i)), Sense::drag());app.auto.add(&format!("timeline.graph.transformBox.{i}"), hr, "Transform box handle");if resp.drag_started() {let opp = [2, 3, 0, 1, 6, 7, 4, 5][i];@@@ -255,7 -255,7 +255,7 @@@ struct AltScale}fn alt_id() -> egui::Id {-- egui::Id::new("timeline-alt-scale")++ egui::Id::unique("timeline-alt-scale")}/// Selected keys' comp-time range.diff --cc crates/ui-egui/src/panels/home.rsindex 269f2f447,fcfd01700..5522548eb--- a/crates/ui-egui/src/panels/home.rs+++ b/crates/ui-egui/src/panels/home.rs@@@ -250,7 -251,7 +251,7 @@@ fn rail_ui(app: &mut EffectcraftApp, uilet mut y = rail.min.y + 20.0;for (label, id, primary) in [("New Project", "file.newProject", true), ("Open Project…", "file.open", false)] {let r = Rect::from_min_size(pos2(x0, y), vec2(w, 34.0));-- if widgets::text_button(ui, r, tr(label), primary, &t, egui::Id::new(("home", id))).clicked() {++ if widgets::text_button(ui, r, tr(label), primary, &t, egui::Id::unique(("home", id))).clicked() {actions.push((id, json!({})));}app.auto.add(&format!("home.{id}"), r, label);@@@ -267,7 -268,7 +268,7 @@@};for (k, (label, icon)) in [("Home", Icon::Home), ("Templates", Icon::Grid), ("Learn", Icon::Sparkle)].into_iter().enumerate() {let r = Rect::from_min_size(pos2(rail.min.x + 8.0, y), vec2(rail.width() - 16.0, 34.0));-- let resp = ui.interact(r, egui::Id::new(("home-tab", label)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("home-tab", label)), Sense::click());let on = page == k;if on || resp.hovered() {p.rect_filled(r, 6.0, if on { t.row_selected } else { t.hover });@@@ -298,7 -299,7 +299,7 @@@cy += 22.0;for (icon, label, cmd) in links {let r = Rect::from_min_size(pos2(x0, cy), vec2(w, 26.0));-- let resp = ui.interact(r, egui::Id::new(("home-link", cmd)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("home-link", cmd)), Sense::click());let discord = cmd == "help.discord";if discord {p.rect_filled(r, 13.0, Color32::from_rgb(0x58, 0x65, 0xf2));@@@ -319,7 -320,7 +320,7 @@@let sw = (w - 6.0) / 2.0;for (i, (name, slug)) in sib.iter().enumerate() {let r = Rect::from_min_size(pos2(x0 + (i % 2) as f32 * (sw + 6.0), cy + (i / 2) as f32 * 26.0), vec2(sw, 22.0));-- let resp = ui.interact(r, egui::Id::new(("sib", *slug)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("sib", *slug)), Sense::click());p.rect_filled(r, 11.0, if resp.hovered() { t.hover } else { t.field_bg });p.text(r.center(), Align2::CENTER_CENTER, *name, Tokens::ui(11.0), t.text);app.auto.add(&format!("home.sibling.{slug}"), r, name);@@@ -362,7 -363,7 +363,7 @@@ fn home_pagelet tw = ((w - gap * 3.0) / 4.0).clamp(120.0, 220.0);for (k, (label, id, icon)) in tiles.into_iter().enumerate() {let r = Rect::from_min_size(pos2(x0 + k as f32 * (tw + gap), y), vec2(tw, 64.0));-- let resp = ui.interact(r, egui::Id::new(("home-tile", id)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("home-tile", id)), Sense::click());p.rect_filled(r, 8.0, if resp.hovered() { t.hover } else { t.panel_bg });p.rect_stroke(r, 8.0, Stroke::new(1.0, if resp.hovered() { t.accent } else { t.separator }), StrokeKind::Inside);let ir = Rect::from_center_size(pos2(r.min.x + 30.0, r.center().y), vec2(32.0, 32.0));@@@ -384,7 -385,7 +385,7 @@@// Recent: heading, filter, clear.p.text(pos2(x0, y + 12.0), Align2::LEFT_CENTER, tr("Recent"), Tokens::semibold(17.0), t.tab_text_active);let entries = recent_entries(&app.session.prefs);-- let fid = egui::Id::new("home-filter");++ let fid = egui::Id::unique("home-filter");let mut filter: String = ctx.data(|d| d.get_temp(fid)).unwrap_or_default();let fr = Rect::from_min_size(pos2(x0 + w - 240.0, y), vec2(240.0, 26.0));widgets::search_field(ui, fr, &mut filter, tr("Filter recent files"), &t);@@@ -392,7 -393,7 +393,7 @@@ctx.data_mut(|d| d.insert_temp(fid, filter.clone()));if !entries.is_empty() {let cr = Rect::from_min_size(pos2(fr.min.x - 96.0, y + 3.0), vec2(84.0, 20.0));-- let resp = ui.interact(cr, egui::Id::new("home-clear-recent"), Sense::click());++ let resp = ui.interact(cr, egui::Id::unique("home-clear-recent"), Sense::click());p.text(cr.right_center(), Align2::RIGHT_CENTER, tr("Clear list"), Tokens::ui(11.5), if resp.hovered() { t.text } else { t.text_faint });app.auto.add("home.clearRecent", cr, "Clear Recent Projects");if resp.clicked() {@@@ -429,7 -430,7 +430,7 @@@if r.min.y > area.max.y {break;}-- let resp = ui.interact(r, egui::Id::new(("home-recent", e.index)), Sense::click()).on_hover_text(&e.path);++ let resp = ui.interact(r, egui::Id::unique(("home-recent", e.index)), Sense::click()).on_hover_text(&e.path);if resp.hovered() {p.rect_filled(r, 6.0, t.hover);}diff --cc crates/ui-egui/src/panels/info.rsindex 581e43344,581e43344..a075087d3--- a/crates/ui-egui/src/panels/info.rs+++ b/crates/ui-egui/src/panels/info.rs@@@ -10,7 -10,7 +10,7 @@@ pub fn show(app: &mut EffectcraftApp, ulet t = app.tokens;let p = ui.painter().with_clip_rect(rect);let x0 = rect.min.x + 12.0;-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("info-scroll"), rect);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("info-scroll"), rect);let mut y = rect.min.y + 14.0 - scroll.offset;if app.pointer_comp.is_some() {// GPU frames: read the shown frame back for sampling.diff --cc crates/ui-egui/src/panels/layer_panel.rsindex e5d8e4e0d,e5d8e4e0d..2ebb2dee0--- a/crates/ui-egui/src/panels/layer_panel.rs+++ b/crates/ui-egui/src/panels/layer_panel.rs@@@ -41,11 -41,11 +41,11 @@@ struct Tex}fn tex_id() -> egui::Id {-- egui::Id::new("layer-panel-tex")++ egui::Id::unique("layer-panel-tex")}fn fit_id() -> egui::Id {-- egui::Id::new("layer-panel-fit")++ egui::Id::unique("layer-panel-fit")}/// The Layer panel's last Fit magnification (points per layer pixel), for View ▸ Zoom In / Zoom@@@ -144,8 -144,8 +144,8 @@@ pub fn show(app: &mut EffectcraftApp, unames.extend(fx.groups().map(|g| g.name.clone()));}let vr = Rect::from_min_size(pos2(vx + 36.0, bar.center().y - 10.0), vec2(150.0, 20.0));-- let pop = egui::Id::new("layer-view-pop");-- if widgets::dropdown(ui, vr, &names[view.min(names.len() - 1)], &t, egui::Id::new("layer-view")).clicked() {++ let pop = egui::Id::unique("layer-view-pop");++ if widgets::dropdown(ui, vr, &names[view.min(names.len() - 1)], &t, egui::Id::unique("layer-view")).clicked() {widgets::open_popup(ui, pop);}app.auto.add("layerPanel.view", vr, "View");@@@ -233,7 -233,7 +233,7 @@@}let space = super::space_hand(&ctx);if space || matches!(app.ui.tool, Tool::Hand | Tool::Zoom) {-- let resp = ui.interact(area, egui::Id::new("layer-panel-nav"), Sense::click_and_drag());++ let resp = ui.interact(area, egui::Id::unique("layer-panel-nav"), Sense::click_and_drag());let alt = ui.input(|i| i.modifiers.alt);if resp.hovered() {ctx.set_cursor_icon(match app.ui.tool {@@@ -264,10 -264,10 +264,10 @@@return;}// Interaction: paint tools.-- let resp = ui.interact(area, egui::Id::new("layer-panel-interact"), Sense::click_and_drag());++ let resp = ui.interact(area, egui::Id::unique("layer-panel-interact"), Sense::click_and_drag());let kind = app.ui.tool.paint_kind();let o = app.session.state.paint.clone();-- let did = egui::Id::new("layer-panel-drag");++ let did = egui::Id::unique("layer-panel-drag");if let Some(hp) = resp.hover_pos() {let lp = to_layer(hp);app.pointer_comp = Some([lp[0] as f32, lp[1] as f32]);diff --cc crates/ui-egui/src/panels/learn.rsindex b613791fd,b613791fd..a3c4a85f6--- a/crates/ui-egui/src/panels/learn.rs+++ b/crates/ui-egui/src/panels/learn.rs@@@ -31,7 -31,7 +31,7 @@@ pub fn home_tab(app: &mut EffectcraftApif r.min.y > area.max.y {break;}-- let resp = ui.interact(r, egui::Id::new(("learn-card", &tut.id)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("learn-card", &tut.id)), Sense::click());p.rect_filled(r, 8.0, if resp.hovered() { Color32::from_rgb(0x2c, 0x2e, 0x37) } else { Color32::from_rgb(0x24, 0x26, 0x2e) });// A small original badge: the step count in a circle.let badge = Rect::from_min_size(pos2(r.min.x + 16.0, r.min.y + 16.0), vec2(44.0, 44.0));@@@ -50,7 -50,7 +50,7 @@@p.galley(pos2(tx, r.min.y + 84.0), g, t.text_faint);let br = Rect::from_min_size(pos2(r.max.x - 104.0, r.min.y + 16.0), vec2(88.0, 28.0));let label = if running.as_deref() == Some(tut.id.as_str()) { "Resume" } else { "Start" };-- let clicked = widgets::text_button(ui, br, label, true, &t, egui::Id::new(("learn-start", &tut.id))).clicked();++ let clicked = widgets::text_button(ui, br, label, true, &t, egui::Id::unique(("learn-start", &tut.id))).clicked();app.auto.add(&format!("home.learn.{}", tut.id), r, &tut.title);app.auto.add(&format!("home.learn.{}.start", tut.id), br, label);if clicked || resp.clicked() {@@@ -92,7 -92,7 +92,7 @@@ pub fn coach(app: &mut EffectcraftApp,{let time = ctx.input(|i| i.time);let pulse = (0.5 + 0.5 * (time * 4.0).sin()) as f32;-- let p = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::new("learn-highlight")));++ let p = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::unique("learn-highlight")));let hr = r.expand(3.0 + 2.0 * pulse);p.rect_stroke(hr, 5.0, Stroke::new(2.0, t.accent.gamma_multiply(0.6 + 0.4 * pulse)), StrokeKind::Outside);app.auto.add("learn.highlight", hr, tp);@@@ -100,7 -100,7 +100,7 @@@}let w = 340.0;let mut action: Option<&str> = None;-- let area = egui::Area::new(egui::Id::new("learn-coach"))++ let area = egui::Area::new(egui::Id::unique("learn-coach")).order(egui::Order::Foreground).fixed_pos(pos2(screen.max.x - w - 20.0, screen.max.y - 250.0)).show(ctx, |ui| {diff --cc crates/ui-egui/src/panels/markers_ui.rsindex 2fff7e1c8,2fff7e1c8..ff5fa0005--- a/crates/ui-egui/src/panels/markers_ui.rs+++ b/crates/ui-egui/src/panels/markers_ui.rs@@@ -244,7 -244,7 +244,7 @@@ pub fn dialog(app: &mut EffectcraftApp// ---------------------------------------------------------------- timeline drawing + gesturesfn drag_state_id() -> egui::Id {-- egui::Id::new("marker-drag")++ egui::Id::unique("marker-drag")}/// Snap `t` (comp seconds) to the CTI, the work area and other marker times within 8 px.@@@ -301,7 -301,7 +301,7 @@@ fn marker(app: &mut EffectcraftApp, uip.text(pos2(x + 7.0, y0 + h / 2.0), Align2::LEFT_CENTER, m.comment.lines().next().unwrap_or_default(), Tokens::ui(10.0), t.text);}let hit = Rect::from_min_max(pos2(x - 5.0, y0 - 1.0), pos2(x + 5.0, y1));-- let id = egui::Id::new(("marker", r.layer, r.index));++ let id = egui::Id::unique(("marker", r.layer, r.index));let resp = ui.interact(hit, id, Sense::click_and_drag());app.auto.add(&r.auto_id(), hit, if m.comment.is_empty() { "marker" } else { &m.comment });let tip = if m.comment.is_empty() { "Marker".to_string() } else { m.comment.clone() };@@@ -391,7 -391,7 +391,7 @@@ pub(crate) fn comp_markers(app: &mut Ef/// one undo step. Dropped back on the bin or outside the time graph's width, nothing is added.pub(crate) fn marker_bin(app: &mut EffectcraftApp, ui: &mut egui::Ui, comp: &Comp, tm: TMap, bin: Rect, strip: Rect) {let t = app.tokens;-- let resp = ui.interact(bin, egui::Id::new("marker-bin"), Sense::drag()).on_hover_text(tr("Composition marker bin: drag a marker to the time ruler"));++ let resp = ui.interact(bin, egui::Id::unique("marker-bin"), Sense::drag()).on_hover_text(tr("Composition marker bin: drag a marker to the time ruler"));app.auto.add("timeline.markerBin", bin, "Composition marker bin");let hot = resp.hovered() || resp.dragged();if hot {@@@ -436,7 -436,7 +436,7 @@@ fn nested_markers(app: &mut Effectcraftreturn;}// Where they land, once per revision (with time remapping that samples the layer's frames).-- let (key, rev) = (egui::Id::new(("nested-markers", cid.0, layer.id.0)), app.session.revision);++ let (key, rev) = (egui::Id::unique(("nested-markers", cid.0, layer.id.0)), app.session.revision);let cached = ui.ctx().data(|d| d.get_temp::<(u64, Vec<(Tick, usize)>)>(key)).filter(|(r, _)| *r == rev);let at = cached.map(|(_, v)| v).unwrap_or_else(|| {let v: Vec<(Tick, usize)> =@@@ -457,7 -457,7 +457,7 @@@}let hit = Rect::from_min_max(pos2(x - 5.0, y0 - 1.0), pos2(x + 5.0, r.max.y - 3.0));let tip = if m.comment.is_empty() { format!("Marker in {name}") } else { format!("{} (marker in {name})", m.comment) };-- let resp = ui.interact(hit, egui::Id::new(("nested-marker", layer.id.0, i)), Sense::click()).on_hover_text(&tip);++ let resp = ui.interact(hit, egui::Id::unique(("nested-marker", layer.id.0, i)), Sense::click()).on_hover_text(&tip);app.auto.add(&format!("timeline.layer.{}.nestedMarker.{i}", layer.id.0), hit, &tip);if resp.double_clicked() {let opened =diff --cc crates/ui-egui/src/panels/media_panels.rsindex cd32cb7f2,cd32cb7f2..28ac5b2c0--- a/crates/ui-egui/src/panels/media_panels.rs+++ b/crates/ui-egui/src/panels/media_panels.rs@@@ -29,7 -29,7 +29,7 @@@ type Listing = (f64, Arc<Result<Vec<mb:/// Thumbnail of a file (cached per path; `None` while not decoded or not decodable).fn thumbnail(app: &EffectcraftApp, ctx: &egui::Context, path: &str, budget: &mut u32) -> Thumb {-- let id = egui::Id::new(("mb-thumb", path));++ let id = egui::Id::unique(("mb-thumb", path));if let Some(t) = ctx.data(|d| d.get_temp::<Thumb>(id)) {return t;}@@@ -76,7 -76,7 +76,7 @@@ pub fn media_browser(app: &mut Effectcrlet st = app.session.state.media_browser.clone();let dir = st.folder.clone().unwrap_or_else(|| b.home());// Listing cached per folder for a second.-- let lid = egui::Id::new(("mb-list", dir.clone(), st.importable_only));++ let lid = egui::Id::unique(("mb-list", dir.clone(), st.importable_only));let now = ctx.input(|i| i.time);let listing: Option<Listing> = ctx.data(|d| d.get_temp(lid));let entries = match listing {@@@ -137,7 -137,7 +137,7 @@@);for (i, (name, path)) in places.iter().enumerate() {let r = Rect::from_min_size(pos2(side.min.x, fy), vec2(side.width(), 20.0));-- let resp = ui.interact(r, egui::Id::new(("mb-fav", i)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("mb-fav", i)), Sense::click());if *path == dir {p.rect_filled(r, 0.0, t.row_selected);} else if resp.hovered() {@@@ -162,7 -162,7 +162,7 @@@let tile = vec2(140.0, 112.0);let cols = ((list.width() - 8.0) / tile.x).floor().max(1.0) as usize;let mut budget = 2u32;-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("mb-scroll"), list);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("mb-scroll"), list);let lp = p.with_clip_rect(list);let mut actions: Vec<(&str, Value)> = vec![];for (i, e) in entries.iter().enumerate() {@@@ -173,7 -173,7 +173,7 @@@if !r.intersects(list) {continue;}-- let resp = ui.interact(r.intersect(list), egui::Id::new(("mb-entry", &e.path)), Sense::click_and_drag());++ let resp = ui.interact(r.intersect(list), egui::Id::unique(("mb-entry", &e.path)), Sense::click_and_drag());app.auto.add(&format!("mediaBrowser.entry.{}", e.name), r, &e.name);lp.rect_filled(r, 4.0, if resp.hovered() { t.hover } else { t.row });let thumb = Rect::from_min_max(r.min + vec2(6.0, 6.0), pos2(r.max.x - 6.0, r.max.y - 26.0));@@@ -264,7 -264,7 +264,7 @@@ fn rows_of(v: &Value) -> Vec<(String, S/// An editable comment field; returns the edited text when it changes.fn comment_field(ui: &mut egui::Ui, r: Rect, id: &str, text: &str) -> Option<String> {-- let key = egui::Id::new(("meta-comment", id));++ let key = egui::Id::unique(("meta-comment", id));let mut buf: String = ui.data(|d| d.get_temp(key)).unwrap_or_else(|| text.to_string());let mut child = ui.new_child(egui::UiBuilder::new().max_rect(r));let resp = child.add(egui::TextEdit::multiline(&mut buf).desired_width(r.width()).desired_rows(2).hint_text(tr("Add a comment")));@@@ -438,8 -438,8 +438,8 @@@ mod testskind: Some("video"),}).collect();-- let old_id = egui::Id::new("old-list");-- let new_id = egui::Id::new("new-list");++ let old_id = egui::Id::unique("old-list");++ let new_id = egui::Id::unique("new-list");ctx.data_mut(|d| {d.insert_temp(old_id, (0.0, Ok::<_, String>(entries.clone())));d.insert_temp(new_id, (0.0, Arc::new(Ok::<_, String>(entries))));diff --cc crates/ui-egui/src/panels/misc.rsindex cd0ab6897,cd0ab6897..b0ec5e570--- a/crates/ui-egui/src/panels/misc.rs+++ b/crates/ui-egui/src/panels/misc.rs@@@ -24,7 -24,7 +24,7 @@@ pub fn preview(app: &mut EffectcraftApplet p = ui.painter().with_clip_rect(rect);// The panel scrolls when it is shorter than its controls (the default workspace shows just// the transport row, as in After Effects).-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("preview-scroll"), rect);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("preview-scroll"), rect);let panel_clip = ui.clip_rect();ui.set_clip_rect(rect.intersect(panel_clip));let y = rect.min.y + 12.0 - scroll.offset;@@@ -42,7 -42,7 +42,7 @@@for (icon, cmd, tip) in buttons {let r = Rect::from_min_size(pos2(x, y), vec2(bw, 28.0));let icon = if cmd == "playback.toggle" && app.playback.playing { Icon::Pause } else { icon };-- if widgets::icon_button(ui, r, icon, cmd == "playback.toggle" && app.playback.playing, &t, egui::Id::new(("pv", cmd))).on_hover_text(tip).clicked() {++ if widgets::icon_button(ui, r, icon, cmd == "playback.toggle" && app.playback.playing, &t, egui::Id::unique(("pv", cmd))).on_hover_text(tip).clicked() {// The play button plays with the options of the shortcut shown below.let params = if cmd == "playback.toggle" { json!({"shortcut": current.id()}) } else { json!({}) };let _ = crate::menus::invoke(app, &ctx, cmd, params);@@@ -117,7 -117,7 +117,7 @@@for (k, (key, text, v)) in [("preRoll", "Pre-roll", o.pre_roll), ("postRoll", "Post-roll", o.post_roll)].into_iter().enumerate() {let lx = xv + k as f32 * 100.0;p.text(pos2(lx, yy), Align2::LEFT_CENTER, text, Tokens::ui(11.5), t.text_dim);-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(lx + 52.0, yy - 9.0), egui::Id::new(("pv-roll", key)), v, 0.05, (0.0, 600.0), 1, "s", &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(lx + 52.0, yy - 9.0), egui::Id::unique(("pv-roll", key)), v, 0.05, (0.0, 600.0), 1, "s", &t);app.auto.add(&format!("preview.{key}"), r, text);if let Some(nv) = nv {changes.push(json!({"shortcut": current.id(), key: nv}));@@@ -160,7 -160,7 +160,7 @@@}let sx = xv + 106.0;p.text(pos2(sx, yy), Align2::LEFT_CENTER, tr("Skip"), Tokens::ui(12.0), t.text_dim);-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(sx + 30.0, yy - 9.0), egui::Id::new("pv-skip"), o.skip as f64, 0.1, (0.0, 99.0), 0, "", &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(sx + 30.0, yy - 9.0), egui::Id::unique("pv-skip"), o.skip as f64, 0.1, (0.0, 99.0), 0, "", &t);app.auto.add("preview.skip", r, "Skip");if let Some(nv) = nv {changes.push(json!({"shortcut": current.id(), "skip": nv.round() as u32}));@@@ -182,7 -182,7 +182,7 @@@}if o.resolution == PreviewResolution::Custom {let (r, nv, _) =-- widgets::hot_number_at(ui, pos2(xv + 106.0, yy - 9.0), egui::Id::new("pv-custom-res"), o.custom_resolution as f64, 0.1, (1.0, 40.0), 0, "", &t);++ widgets::hot_number_at(ui, pos2(xv + 106.0, yy - 9.0), egui::Id::unique("pv-custom-res"), o.custom_resolution as f64, 0.1, (1.0, 40.0), 0, "", &t);app.auto.add("preview.customResolution", r, "Custom Resolution");if let Some(nv) = nv {changes.push(json!({"shortcut": current.id(), "customResolution": nv.round() as u32}));@@@ -240,7 -240,7 +240,7 @@@ fn fmt_rate(r: f64) -> Stringfn check_row(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painter, at: egui::Pos2, key: &str, text: &str, on: bool) -> bool {let t = app.tokens;let r = Rect::from_min_size(pos2(at.x, at.y - 8.0), vec2(16.0, 16.0));-- let clicked = widgets::checkbox(ui, r, on, &t, egui::Id::new(("pv-check", key))).clicked();++ let clicked = widgets::checkbox(ui, r, on, &t, egui::Id::unique(("pv-check", key))).clicked();p.text(pos2(r.max.x + 5.0, at.y), Align2::LEFT_CENTER, text, Tokens::ui(12.0), t.text);app.auto.add(&format!("preview.{key}"), r, text);clicked@@@ -250,7 -250,7 +250,7 @@@/// returns the chosen index.fn dropdown_row(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect, key: &str, text: &str, items: &[String], current: Option<usize>) -> Option<usize> {let t = app.tokens;-- let pid = egui::Id::new(("pv-pop", key));++ let pid = egui::Id::unique(("pv-pop", key));if widgets::dropdown(ui, r, text, &t, pid.with("btn")).clicked() {let open: bool = ui.data(|d| d.get_temp(pid.with("open")).unwrap_or(false));ui.data_mut(|d| d.insert_temp(pid.with("open"), !open));@@@ -318,7 -318,7 +318,7 @@@ pub fn audio(app: &mut EffectcraftApp,let clip = Rect::from_min_max(pos2(bar.min.x, top - 14.0), pos2(bar.max.x, top - 4.0));p.rect_filled(clip, 1.0, if m.clipped[c] { red } else { t.field_bg });let id = if c == 0 { "audio.clipLeft" } else { "audio.clipRight" };-- if ui.interact(clip, egui::Id::new(id), Sense::click()).clicked() {++ if ui.interact(clip, egui::Id::unique(id), Sense::click()).clicked() {app.meter.clipped[c] = false;}app.auto.add(id, clip, if c == 0 { "Left clip indicator" } else { "Right clip indicator" });@@@ -370,7 -370,7 +370,7 @@@ pub fn history(app: &mut EffectcraftApplet nodes = app.session.history_tree();let row_h = 22.0;let cur = nodes.iter().position(|n| n.current).unwrap_or(0);-- let scroll_id = egui::Id::new("history-scroll");++ let scroll_id = egui::Id::unique("history-scroll");let mut scroll = widgets::PanelScroll::begin(ui, scroll_id, rect);// The current state scrolls into view when it changes (undo, redo, a new step).if ui.data(|d| d.get_temp::<usize>(scroll_id.with("current"))) != Some(cur) {@@@ -390,7 -390,7 +390,7 @@@for n in nodes.iter().skip(first).take(visible) {let r = Rect::from_min_size(pos2(rect.min.x, y), vec2(rect.width(), row_h));y += row_h;-- let resp = ui.interact(r, egui::Id::new(("hist", n.id.as_str())), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("hist", n.id.as_str())), Sense::click());if n.current {p.rect_filled(r, 0.0, t.row_selected);} else if resp.hovered() {@@@ -423,7 -423,7 +423,7 @@@ pub fn markers(app: &mut EffectcraftApplet t = app.tokens;let p = ui.painter().with_clip_rect(rect);let Some(c) = app.session.active_comp_arc() else { return };-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("markers-scroll"), rect);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("markers-scroll"), rect);let mut y = rect.min.y + 8.0 - scroll.offset;if c.markers.is_empty() {p.text(rect.center(), Align2::CENTER_CENTER, tr("No composition markers"), Tokens::ui(12.0), t.text_faint);@@@ -437,7 -437,7 +437,7 @@@let tc = crate::panels::timecode(&app.session, &c, m.time);p.text(pos2(r.min.x + 12.0, r.center().y), Align2::LEFT_CENTER, tc, Tokens::mono(11.5), t.timecode);p.text(pos2(r.min.x + 120.0, r.center().y), Align2::LEFT_CENTER, &m.comment, Tokens::ui(12.0), t.text);-- if ui.interact(r, egui::Id::new(("mk", m.time.0)), Sense::click()).clicked() {++ if ui.interact(r, egui::Id::unique(("mk", m.time.0)), Sense::click()).clicked() {app.session.set_time(m.time);}}diff --cc crates/ui-egui/src/panels/mod.rsindex 3aa9a19c5,04ddf2b64..5327ab170--- a/crates/ui-egui/src/panels/mod.rs+++ b/crates/ui-egui/src/panels/mod.rs@@@ -212,7 -218,7 +218,7 @@@ pub fn show(app: &mut EffectcraftApp, u/// The ≡ panel menu (opened from a tab).pub fn panel_menu_popup(app: &mut EffectcraftApp, ui: &mut egui::Ui) {-- let id = egui::Id::new("panel-menu");++ let id = egui::Id::unique("panel-menu");let Some((panel, pos)) = ui.ctx().data(|d| d.get_temp::<(PanelKind, egui::Pos2)>(id)) else { return };// The menu opens in the window that shows the panel (a panel can have its own window).if app.panel_viewport(ui.ctx(), panel) != ui.ctx().viewport_id() {diff --cc crates/ui-egui/src/panels/paint_panels.rsindex 675bc1e16,675bc1e16..eba7ecce7--- a/crates/ui-egui/src/panels/paint_panels.rs+++ b/crates/ui-egui/src/panels/paint_panels.rs@@@ -36,7 -36,7 +36,7 @@@ fn numberlet t = app.tokens;p.text(pos2(x, y + 9.0), Align2::LEFT_CENTER, label, Tokens::ui(11.5), if enabled { t.text_dim } else { t.text_faint });let lw = p.layout_no_wrap(label.to_string(), Tokens::ui(11.5), t.text).size().x;-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(x + lw + 6.0, y), egui::Id::new(("paint-num", key)), v, 0.5, range, 0, suffix, &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(x + lw + 6.0, y), egui::Id::unique(("paint-num", key)), v, 0.5, range, 0, suffix, &t);app.auto.add(key, r, label);nv.filter(|_| enabled)}@@@ -58,8 -58,8 +58,8 @@@ fn popup_rowlet t = app.tokens;p.text(pos2(x, y + 10.0), Align2::LEFT_CENTER, label, Tokens::ui(11.5), if enabled { t.text_dim } else { t.text_faint });let r = Rect::from_min_size(pos2(x + 70.0, y), vec2((w - 70.0).max(60.0), 20.0));-- let pop = egui::Id::new(("paint-pop", key));-- if widgets::dropdown(ui, r, options.get(cur).map(String::as_str).unwrap_or(""), &t, egui::Id::new(("paint-dd", key))).clicked() && enabled {++ let pop = egui::Id::unique(("paint-pop", key));++ if widgets::dropdown(ui, r, options.get(cur).map(String::as_str).unwrap_or(""), &t, egui::Id::unique(("paint-dd", key))).clicked() && enabled {widgets::open_popup(ui, pop);}app.auto.add(key, r, label);@@@ -70,6 -70,6 +70,15 @@@ fn rgb(c: [f64; 4]) -> [f32; 3][c[0] as f32, c[1] as f32, c[2] as f32]}++/// The swap-colours icon: one arrow right above one arrow left.++fn paint_swap_icon(p: &egui::Painter, rect: Rect, color: Color32) {++ let stroke = Stroke::new(1.0, color);++ let (left, right) = (rect.left() + 2.0, rect.right() - 2.0);++ let (top, bottom) = (rect.top() + 3.0, rect.bottom() - 3.0);++ p.arrow(pos2(left, top), vec2(right - left, 0.0), stroke);++ p.arrow(pos2(right, bottom), vec2(left - right, 0.0), stroke);++}++pub fn paint(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {let t = app.tokens;let p = ui.painter().with_clip_rect(rect);@@@ -91,33 -91,33 +100,35 @@@// Colour swatches (foreground over background) with swap / reset.let fg = Rect::from_min_size(pos2(x0, y), vec2(26.0, 20.0));let bg = Rect::from_min_size(pos2(x0 + 14.0, y + 10.0), vec2(26.0, 20.0));-- widgets::swatch(ui, bg, [o.background[0] as f32, o.background[1] as f32, o.background[2] as f32, 1.0], egui::Id::new("paint-bg"), &t);-- let bresp = ui.interact(Rect::from_min_max(pos2(fg.max.x, bg.min.y), bg.max), egui::Id::new("paint-bg-hit"), Sense::click());++ widgets::swatch(ui, bg, [o.background[0] as f32, o.background[1] as f32, o.background[2] as f32, 1.0], egui::Id::unique("paint-bg"), &t);++ let bresp = ui.interact(Rect::from_min_max(pos2(fg.max.x, bg.min.y), bg.max), egui::Id::unique("paint-bg-hit"), Sense::click());if bresp.clicked() {-- widgets::open_popup(ui, egui::Id::new("paint-bg-pop"));++ widgets::open_popup(ui, egui::Id::unique("paint-bg-pop"));}-- if widgets::swatch(ui, fg, [o.color[0] as f32, o.color[1] as f32, o.color[2] as f32, 1.0], egui::Id::new("paint-fg"), &t).clicked() {-- widgets::open_popup(ui, egui::Id::new("paint-fg-pop"));++ if widgets::swatch(ui, fg, [o.color[0] as f32, o.color[1] as f32, o.color[2] as f32, 1.0], egui::Id::unique("paint-fg"), &t).clicked() {++ widgets::open_popup(ui, egui::Id::unique("paint-fg-pop"));}app.auto.add("paint.color", fg, "Foreground color");app.auto.add("paint.background", bg, "Background color");let mut fc = rgb(o.color);-- if crate::widgets::color_popup(ui, egui::Id::new("paint-fg-pop"), fg.left_bottom(), &mut fc) {++ if crate::widgets::color_popup(ui, egui::Id::unique("paint-fg-pop"), fg.left_bottom(), &mut fc) {set(app, json!({"color": [fc[0], fc[1], fc[2], 1.0]}));}let mut bc = rgb(o.background);-- if crate::widgets::color_popup(ui, egui::Id::new("paint-bg-pop"), bg.left_bottom(), &mut bc) {++ if crate::widgets::color_popup(ui, egui::Id::unique("paint-bg-pop"), bg.left_bottom(), &mut bc) {set(app, json!({"background": [bc[0], bc[1], bc[2], 1.0]}));}let swap = Rect::from_min_size(pos2(x0 + 46.0, y), vec2(18.0, 14.0));-- let sresp = ui.interact(swap, egui::Id::new("paint-swap"), Sense::click());-- p.text(swap.center(), Align2::CENTER_CENTER, "⇄", Tokens::ui(12.0), if sresp.hovered() { t.text } else { t.text_dim });++ let sresp = ui.interact(swap, egui::Id::unique("paint-swap"), Sense::click());++ // Two arrows (foreground over background): drawn, so the icon does not depend on a font++ // carrying U+21C4 (the bundled fonts do not).++ paint_swap_icon(&p, swap, if sresp.hovered() { t.text } else { t.text_dim });app.auto.add("paint.swapColors", swap, "Swap colors");if sresp.on_hover_text(tr("Swap Paint Colors (X)")).clicked() {set(app, json!({"color": o.background, "background": o.color}));}let reset = Rect::from_min_size(pos2(x0 + 46.0, y + 18.0), vec2(18.0, 14.0));-- let rresp = ui.interact(reset, egui::Id::new("paint-reset-colors"), Sense::click());++ let rresp = ui.interact(reset, egui::Id::unique("paint-reset-colors"), Sense::click());p.rect_filled(Rect::from_min_size(reset.min + vec2(4.0, 3.0), vec2(7.0, 6.0)), 0.0, Color32::WHITE);p.rect_stroke(Rect::from_min_size(reset.min + vec2(8.0, 6.0), vec2(7.0, 6.0)), 0.0, Stroke::new(1.0, t.text_dim), StrokeKind::Inside);app.auto.add("paint.resetColors", reset, "Default colors");@@@ -146,7 -146,7 +157,7 @@@let (r, nv, _) = widgets::hot_number_at(ui,pos2(x0 + w - 52.0, y + 1.0),-- egui::Id::new("paint-custom-frames"),++ egui::Id::unique("paint-custom-frames"),o.custom_frames as f64,0.2,(1.0, 10000.0),@@@ -174,7 -174,7 +185,7 @@@p.text(pos2(x0, y + 10.0), Align2::LEFT_CENTER, tr("Preset:"), Tokens::ui(11.5), t.text_dim);for i in 1..=5u32 {let r = Rect::from_min_size(pos2(x0 + 56.0 + (i - 1) as f32 * 26.0, y), vec2(22.0, 20.0));-- let resp = ui.interact(r, egui::Id::new(("clone-preset", i)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("clone-preset", i)), Sense::click());let on = o.clone_preset == i;p.rect_filled(r,@@@ -210,7 -210,7 +221,7 @@@.enumerate(){let r = Rect::from_min_size(pos2(x0 + i as f32 * (w / 2.0), y), vec2(18.0, 20.0));-- if widgets::checkbox(ui, r, on, &t, egui::Id::new(key)).clicked() {++ if widgets::checkbox(ui, r, on, &t, egui::Id::unique(key)).clicked() {set(app, json!({k: !on}));}p.text(pos2(r.max.x + 4.0, r.center().y), Align2::LEFT_CENTER, label, Tokens::ui(11.5), t.text_dim);@@@ -220,7 -220,7 +231,7 @@@let off = o.clone_offset.unwrap_or([0.0, 0.0]);p.text(pos2(x0, y + 9.0), Align2::LEFT_CENTER, tr("Offset:"), Tokens::ui(11.5), t.text_dim);for (d, v) in off.iter().enumerate() {-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(x0 + 56.0 + d as f32 * 64.0, y), egui::Id::new(("clone-off", d)), *v, 1.0, (-1e5, 1e5), 0, "", &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(x0 + 56.0 + d as f32 * 64.0, y), egui::Id::unique(("clone-off", d)), *v, 1.0, (-1e5, 1e5), 0, "", &t);app.auto.add(&format!("paint.cloneOffset.{d}"), r, "Clone offset");if let Some(nv) = nv {let mut no = off;@@@ -237,7 -237,7 +248,7 @@@}y += 26.0;let r = Rect::from_min_size(pos2(x0, y), vec2(18.0, 20.0));-- if widgets::checkbox(ui, r, o.show_overlay, &t, egui::Id::new("paint.showOverlay")).clicked() {++ if widgets::checkbox(ui, r, o.show_overlay, &t, egui::Id::unique("paint.showOverlay")).clicked() {set(app, json!({"showOverlay": !o.show_overlay}));}app.auto.add("paint.showOverlay", r, "Clone Source Overlay");@@@ -246,7 -246,7 +257,7 @@@set(app, json!({"overlayOpacity": nv}));}let dr = Rect::from_min_size(pos2(x0 + w - 18.0, y), vec2(18.0, 20.0));-- if widgets::checkbox(ui, dr, o.overlay_difference, &t, egui::Id::new("paint.overlayDifference")).clicked() {++ if widgets::checkbox(ui, dr, o.overlay_difference, &t, egui::Id::unique("paint.overlayDifference")).clicked() {set(app, json!({"overlayDifference": !o.overlay_difference}));}app.auto.add("paint.overlayDifference", dr, "Difference mode overlay");@@@ -287,7 -287,7 +298,7 @@@ pub fn brushes(app: &mut EffectcraftApplet cols = ((w / cell).floor() as usize).max(1);for (i, tip) in BRUSH_PRESETS.iter().enumerate() {let r = Rect::from_min_size(pos2(x0 + (i % cols) as f32 * cell, y + (i / cols) as f32 * cell), vec2(cell - 2.0, cell - 2.0));-- let resp = ui.interact(r, egui::Id::new(("brush-preset", i)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("brush-preset", i)), Sense::click());let on = o.preset == Some(i);p.rect_filled(r,@@@ -332,7 -332,7 +343,7 @@@// Spacing (checkbox in AE turns spacing on; we always space dabs, so it shows the value).p.text(pos2(x0, y + 9.0), Align2::LEFT_CENTER, tr("Spacing:"), Tokens::ui(11.5), t.text_dim);let _ = r;-- let (sr, nv, _) = widgets::hot_number_at(ui, pos2(x0 + 58.0, y), egui::Id::new("brushes-spacing"), o.spacing, 0.5, (1.0, 1000.0), 0, " %", &t);++ let (sr, nv, _) = widgets::hot_number_at(ui, pos2(x0 + 58.0, y), egui::Id::unique("brushes-spacing"), o.spacing, 0.5, (1.0, 1000.0), 0, " %", &t);app.auto.add("brushes.spacing", sr, "Spacing");if let Some(nv) = nv {set(app, json!({"spacing": nv}));diff --cc crates/ui-egui/src/panels/panel_kit.rsindex cbf28c8ac,cbf28c8ac..99554ec57--- a/crates/ui-egui/src/panels/panel_kit.rs+++ b/crates/ui-egui/src/panels/panel_kit.rs@@@ -9,7 -9,7 +9,7 @@@ use crate::{EffectcraftApp, widgets}/// A dropdown; returns the newly chosen index.pub fn dropdown(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect, auto: &str, options: &[&str], cur: usize) -> Option<usize> {let t = app.tokens;-- let id = egui::Id::new(("kit-dd", auto));++ let id = egui::Id::unique(("kit-dd", auto));let text = options.get(cur).copied().unwrap_or("");if widgets::dropdown(ui, r, text, &t, id).clicked() {widgets::open_popup(ui, id);@@@ -23,7 -23,7 +23,7 @@@pub fn checkbox(app: &mut EffectcraftApp, ui: &mut egui::Ui, at: egui::Pos2, auto: &str, text: &str, on: bool) -> bool {let t = app.tokens;let r = Rect::from_min_size(at, vec2(16.0, 16.0));-- let clicked = widgets::checkbox(ui, r, on, &t, egui::Id::new(("kit-cb", auto))).clicked();++ let clicked = widgets::checkbox(ui, r, on, &t, egui::Id::unique(("kit-cb", auto))).clicked();ui.painter().text(pos2(r.max.x + 6.0, r.center().y), Align2::LEFT_CENTER, text, Tokens::ui(12.0), t.text);let full = Rect::from_min_size(at, vec2(22.0 + text.len() as f32 * 6.5, 16.0));app.auto.add(auto, full, text);@@@ -33,7 -33,7 +33,7 @@@/// A text button; true when clicked.pub fn button(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect, auto: &str, text: &str, primary: bool) -> bool {let t = app.tokens;-- let clicked = widgets::text_button(ui, r, text, primary, &t, egui::Id::new(("kit-btn", auto))).clicked();++ let clicked = widgets::text_button(ui, r, text, primary, &t, egui::Id::unique(("kit-btn", auto))).clicked();app.auto.add(auto, r, text);clicked}@@@ -47,7 -47,7 +47,7 @@@ pub fn label(ui: &egui::Ui, at: egui::P#[allow(clippy::too_many_arguments)]pub fn number(app: &mut EffectcraftApp, ui: &mut egui::Ui, at: egui::Pos2, auto: &str, v: f64, speed: f64, range: (f64, f64), dec: usize, suffix: &str) -> f64 {let t = app.tokens;-- let (r, nv, _) = widgets::hot_number_at(ui, at, egui::Id::new(("kit-n", auto)), v, speed, range, dec, suffix, &t);++ let (r, nv, _) = widgets::hot_number_at(ui, at, egui::Id::unique(("kit-n", auto)), v, speed, range, dec, suffix, &t);app.auto.add(auto, r, &format!("{v}"));nv.unwrap_or(v)}diff --cc crates/ui-egui/src/panels/path_vr_panels.rsindex 9dba0dd59,9dba0dd59..680d9f5a0--- a/crates/ui-egui/src/panels/path_vr_panels.rs+++ b/crates/ui-egui/src/panels/path_vr_panels.rs@@@ -36,7 -36,7 +36,7 @@@ pub fn create_nulls(app: &mut Effectcralet t = app.tokens;let ctx = ui.ctx().clone();let mut ui = area(ui, rect);-- let loop_id = egui::Id::new("createNulls.loop");++ let loop_id = egui::Id::unique("createNulls.loop");let mut looping: bool = ui.data(|d| d.get_temp(loop_id)).unwrap_or(false);let ready = app.session.is_enabled("paths.nullsFollowPoints") && !app.session.state.selected_layers.is_empty();ui.label(RichText::new(tr("Select a layer with a mask or shape path (or the path property), or Puppet pins.")).color(t.text_dim).small());@@@ -70,7 -70,7 +70,7 @@@ pub fn vr_editor(app: &mut EffectcraftAui.label(RichText::new(tr("No VR environments yet. Create one with Composition ▸ VR ▸ Create VR Environment…")).color(t.text_faint));return;}-- let sel_id = egui::Id::new("vrEditor.selected");++ let sel_id = egui::Id::unique("vrEditor.selected");let active = app.session.state.active_comp.map(|c| c.0);let mut sel: u64 = ui.data(|d| d.get_temp(sel_id)).unwrap_or(0);// Default: the active comp's environment, else the first.diff --cc crates/ui-egui/src/panels/precomp.rsindex 8a40c56e9,8a40c56e9..7c1750d5e--- a/crates/ui-egui/src/panels/precomp.rs+++ b/crates/ui-egui/src/panels/precomp.rs@@@ -209,7 -209,7 +209,7 @@@ pub fn navigator(app: &mut EffectcraftA};let g = p.layout_no_wrap(label.clone(), Tokens::ui(11.5), col);let r = Rect::from_min_size(pos2(x, rect.min.y + 2.0), vec2(g.size().x + 12.0, rect.height() - 4.0));-- let resp = ui.interact(r, egui::Id::new(("comp-nav", id.0)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("comp-nav", id.0)), Sense::click());if active {p.rect_filled(r, 3.0, t.row_selected);} else if resp.hovered() {@@@ -223,7 -223,7 +223,7 @@@x = r.max.x + 2.0;}let fr = Rect::from_min_size(pos2(rect.max.x - 26.0, rect.min.y + 2.0), vec2(22.0, rect.height() - 4.0));-- if crate::widgets::icon_button(ui, fr, crate::icons::Icon::Flowchart, false, &t, egui::Id::new("comp-nav-flow"))++ if crate::widgets::icon_button(ui, fr, crate::icons::Icon::Flowchart, false, &t, egui::Id::unique("comp-nav-flow")).on_hover_text(tr("Composition Mini-Flowchart")).clicked(){@@@ -248,64 -248,64 +248,65 @@@ pub fn mini_flowchart(app: &mut Effectclet downs = downstream(&proj, cid);let mut open = None;let mut close = false;-- let area = egui::Area::new(egui::Id::new("mini-flowchart")).order(egui::Order::Foreground).constrain(true).fixed_pos(pos2(at[0], at[1])).show(ctx, |ui| {-- egui::Frame::popup(ui.style()).fill(t.panel_bg).inner_margin(egui::Margin::same(10)).show(ui, |ui| {-- let col_w = 160.0;-- let rows = ups.len().max(downs.len()).max(1) as f32;-- let h = rows * 26.0 + 8.0;-- let (rect, _) = ui.allocate_exact_size(vec2(col_w * 3.0 + 60.0, h), Sense::hover());-- let p = ui.painter().clone();-- let node = |ui: &mut egui::Ui, app: &mut EffectcraftApp, r: Rect, id: ItemId, active: bool| {-- let resp = ui.interact(r, egui::Id::new(("mfc", id.0)), Sense::click());-- p.rect_filled(-- r,-- 4.0,-- if active {-- t.accent-- } else if resp.hovered() {-- t.hover-- } else {-- t.field_bg-- },-- );-- p.text(r.center(), Align2::CENTER_CENTER, name(&proj, id), Tokens::ui(11.5), if active { Color32::WHITE } else { t.text });-- app.auto.add(&format!("flowchart.mini.{}", id.0), r, &name(&proj, id));-- resp.clicked()-- };-- let mid = Rect::from_center_size(rect.center(), vec2(col_w, 22.0));-- if node(ui, app, mid, cid, true) {-- close = true;-- }-- let col = |i: usize, n: usize, x: f32| {-- let y0 = rect.center().y - (n as f32 * 26.0) / 2.0 + 13.0;-- Rect::from_center_size(pos2(x, y0 + i as f32 * 26.0), vec2(col_w, 22.0))-- };-- let arrow = |a: egui::Pos2, b: egui::Pos2| {-- p.line_segment([a, b], Stroke::new(1.2, t.text_dim));-- let d = (b - a).normalized();-- let n = vec2(-d.y, d.x);-- p.add(egui::Shape::convex_polygon(vec![b, b - d * 7.0 + n * 3.5, b - d * 7.0 - n * 3.5], t.text_dim, Stroke::NONE));-- };-- for (i, u) in ups.iter().enumerate() {-- let r = col(i, ups.len(), rect.min.x + col_w / 2.0);-- // Upstream comps contain the active one: arrow from the nested comp up into them.-- arrow(mid.left_center(), r.right_center());-- if node(ui, app, r, *u, false) {-- open = Some(*u);++ let area =++ egui::Area::new(egui::Id::unique("mini-flowchart")).order(egui::Order::Foreground).constrain(true).fixed_pos(pos2(at[0], at[1])).show(ctx, |ui| {++ egui::Frame::popup(ui.style()).fill(t.panel_bg).inner_margin(egui::Margin::same(10)).show(ui, |ui| {++ let col_w = 160.0;++ let rows = ups.len().max(downs.len()).max(1) as f32;++ let h = rows * 26.0 + 8.0;++ let (rect, _) = ui.allocate_exact_size(vec2(col_w * 3.0 + 60.0, h), Sense::hover());++ let p = ui.painter().clone();++ let node = |ui: &mut egui::Ui, app: &mut EffectcraftApp, r: Rect, id: ItemId, active: bool| {++ let resp = ui.interact(r, egui::Id::unique(("mfc", id.0)), Sense::click());++ p.rect_filled(++ r,++ 4.0,++ if active {++ t.accent++ } else if resp.hovered() {++ t.hover++ } else {++ t.field_bg++ },++ );++ p.text(r.center(), Align2::CENTER_CENTER, name(&proj, id), Tokens::ui(11.5), if active { Color32::WHITE } else { t.text });++ app.auto.add(&format!("flowchart.mini.{}", id.0), r, &name(&proj, id));++ resp.clicked()++ };++ let mid = Rect::from_center_size(rect.center(), vec2(col_w, 22.0));++ if node(ui, app, mid, cid, true) {++ close = true;}-- }-- for (i, d) in downs.iter().enumerate() {-- let r = col(i, downs.len(), rect.max.x - col_w / 2.0);-- arrow(r.left_center(), mid.right_center());-- if node(ui, app, r, *d, false) {-- open = Some(*d);++ let col = |i: usize, n: usize, x: f32| {++ let y0 = rect.center().y - (n as f32 * 26.0) / 2.0 + 13.0;++ Rect::from_center_size(pos2(x, y0 + i as f32 * 26.0), vec2(col_w, 22.0))++ };++ let arrow = |a: egui::Pos2, b: egui::Pos2| {++ p.line_segment([a, b], Stroke::new(1.2, t.text_dim));++ let d = (b - a).normalized();++ let n = vec2(-d.y, d.x);++ p.add(egui::Shape::convex_polygon(vec![b, b - d * 7.0 + n * 3.5, b - d * 7.0 - n * 3.5], t.text_dim, Stroke::NONE));++ };++ for (i, u) in ups.iter().enumerate() {++ let r = col(i, ups.len(), rect.min.x + col_w / 2.0);++ // Upstream comps contain the active one: arrow from the nested comp up into them.++ arrow(mid.left_center(), r.right_center());++ if node(ui, app, r, *u, false) {++ open = Some(*u);++ }}-- }-- if ups.is_empty() && downs.is_empty() {-- p.text(pos2(rect.center().x, rect.max.y - 4.0), Align2::CENTER_BOTTOM, tr("No nested compositions"), Tokens::ui(10.5), t.text_faint);-- }++ for (i, d) in downs.iter().enumerate() {++ let r = col(i, downs.len(), rect.max.x - col_w / 2.0);++ arrow(r.left_center(), mid.right_center());++ if node(ui, app, r, *d, false) {++ open = Some(*d);++ }++ }++ if ups.is_empty() && downs.is_empty() {++ p.text(pos2(rect.center().x, rect.max.y - 4.0), Align2::CENTER_BOTTOM, tr("No nested compositions"), Tokens::ui(10.5), t.text_faint);++ }++ });});-- });let outside = crate::widgets::pressed_outside(ctx, &area.response);if let Some(id) = open {app.session.open_comp(id);diff --cc crates/ui-egui/src/panels/project.rsindex 89866b26c,7f66a00de..a18fe1966--- a/crates/ui-egui/src/panels/project.rs+++ b/crates/ui-egui/src/panels/project.rs@@@ -126,8 -126,8 +126,8 @@@ type PendingThumb = (u64, Arc<Mutex<Opt/// Rendered on a background thread (inline on wasm32): until the new one lands the previous/// thumbnail stays up, so selecting a big comp or editing it never stalls the panel.fn thumbnail(app: &EffectcraftApp, ctx: &egui::Context, it: &Item) -> Option<egui::TextureHandle> {-- let key = egui::Id::new(("proj-thumb", it.id.0));-- let pkey = egui::Id::new(("proj-thumb-pending", it.id.0));++ let key = egui::Id::unique(("proj-thumb", it.id.0));++ let pkey = egui::Id::unique(("proj-thumb-pending", it.id.0));let rev = app.session.revision;let cached: Option<(u64, egui::TextureHandle)> = ctx.data(|d| d.get_temp(key));let mut tex = cached.as_ref().map(|(_, t)| t.clone());@@@ -192,7 -192,7 +192,7 @@@ fn fit(r: Rect, w: f32, h: f32) -> Rec/// An inline text edit in progress: (item, field `name`|`comment`, text).type Editing = (u64, String, String);fn edit_id() -> egui::Id {-- egui::Id::new("proj-inline-edit")++ egui::Id::unique("proj-inline-edit")}/// Start renaming the selected item (Enter in the Project panel).@@@ -206,27 -206,27 +206,27 @@@ pub fn begin_rename(app: &EffectcraftAp/// Where a Shift-extended selection starts (the last item clicked or moved to without Shift).fn anchor_id() -> egui::Id {-- egui::Id::new("project-selection-anchor")++ egui::Id::unique("project-selection-anchor")}/// The item the arrow keys move from: the last item clicked or moved to.fn cursor_id() -> egui::Id {-- egui::Id::new("project-selection-cursor")++ egui::Id::unique("project-selection-cursor")}/// An item row's widget: its click / drag area, keyboard focus and accessibility node.fn row_id(item: ItemId) -> egui::Id {-- egui::Id::new(("pitem", item.0))++ egui::Id::unique(("pitem", item.0))}/// The last row drawn with keyboard focus (egui drops the focus of a row scrolled out of view).fn focused_row_id() -> egui::Id {-- egui::Id::new("project-focused-row")++ egui::Id::unique("project-focused-row")}/// The item whose selection the panel last scrolled into view.fn selection_seen_id() -> egui::Id {-- egui::Id::new("proj-sel-seen")++ egui::Id::unique("proj-sel-seen")}/// The focused widget is one of the panel's rows, or nothing has keyboard focus: the panel's keys@@@ -424,7 -424,7 +424,7 @@@ pub fn show(app: &mut EffectcraftApp, uapp.auto.add("project.details.name", r, &it.name);let ar = Rect::from_min_size(pos2(r.max.x + 1.0, name_y - 7.0), vec2(arrow_w, 14.0));let tip = crate::i18n::tr("Compositions that use this item");-- let aresp = ui.interact(ar, egui::Id::new("proj-used-in"), Sense::click()).on_hover_text(tip);++ let aresp = ui.interact(ar, egui::Id::unique("proj-used-in"), Sense::click()).on_hover_text(tip);icons::paint(&p, Rect::from_center_size(ar.center(), vec2(9.0, 9.0)), Icon::ChevronDown, if aresp.hovered() { t.text } else { t.text_dim });app.auto.add("project.details.usedIn", ar, tip);// The comma sits right after the arrow (its glyph ends short of the hit area).@@@ -506,7 -506,7 +506,7 @@@if hr.width() <= 0.0 {continue;}-- let resp = ui.interact(hr.intersect(hdr), egui::Id::new(("proj-sort", *key)), Sense::click());++ let resp = ui.interact(hr.intersect(hdr), egui::Id::unique(("proj-sort", *key)), Sense::click());hp.with_clip_rect(hr).text(pos2(*x, hdr.center().y),Align2::LEFT_CENTER,@@@ -534,7 -534,7 +534,7 @@@Some(o) => crate::i18n::tr_args("Sort by {}, {}", &[&column, &o]),None => crate::i18n::tr_args("Sort by {}", &[&column]),};-- egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name)++ egui::WidgetInfo::labeled(egui::Role::Button, true, name)});if resp.clicked() {if app.ui.project_sort == *key {@@@ -546,7 -546,7 +546,7 @@@}column_menu(app, &resp);}-- let hresp = ui.interact(Rect::from_min_max(pos2(x, hdr.min.y), hdr.max), egui::Id::new("proj-hdr-rest"), Sense::CLICK);++ let hresp = ui.interact(Rect::from_min_max(pos2(x, hdr.min.y), hdr.max), egui::Id::unique("proj-hdr-rest"), Sense::CLICK);column_menu(app, &hresp);app.auto.add("project.columns", hdr, "Columns (right-click to show or hide)");// Rows.@@@ -557,7 -557,7 +557,7 @@@// a click deselects, a drag draws a selection box, a double-click imports, as in After// Effects (File ▸ Import ▸ File...).// Not a Tab stop: the keyboard reaches the rows, and nothing else here takes a key.-- let empty = ui.interact(list, egui::Id::new("proj-empty"), Sense::CLICK | Sense::DRAG);++ let empty = ui.interact(list, egui::Id::unique("proj-empty"), Sense::CLICK | Sense::DRAG);app.auto.add("project.empty", list, "Double-click to import files; drag to select items; right-click for project actions");if overflow > 0.0 && ui.rect_contains_pointer(list) {let (dx, dy, shift) = ui.input(|i| (i.smooth_scroll_delta.x, i.smooth_scroll_delta.y, i.modifiers.shift));@@@ -648,9 -648,9 +648,8 @@@// For screen readers: a tree item named by the item and its type, with its selection,// depth and (a folder) open state. One Tab stop per row; the panel's keys then apply.let open = it.is_folder().then(|| app.ui.project_open_folders.contains(&id.0) || !app.ui.project_search.is_empty());-- resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Other, true, format!("{}, {}", it.name, crate::i18n::tr(it.type_name()))));++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::TreeItem, true, format!("{}, {}", it.name, crate::i18n::tr(it.type_name()))));ctx.accesskit_node_builder(resp.id, |n| {-- n.set_role(egui::accesskit::Role::TreeItem);n.set_selected(selected);n.set_level(depth.saturating_add(1));if let Some(open) = open {@@@ -668,10 -668,10 +667,10 @@@if it.is_folder() {let open = app.ui.project_open_folders.contains(&id.0);let tw = Rect::from_center_size(pos2(x0 + 4.0, r.center().y), vec2(12.0, 12.0));-- let tresp = widgets::twirl(ui, tw, open, egui::Id::new(("pf", id.0)), &t);++ let tresp = widgets::twirl(ui, tw, open, egui::Id::unique(("pf", id.0)), &t);tresp.widget_info(|| {let name = crate::i18n::tr_args(if open { "Close folder {}" } else { "Open folder {}" }, &[&it.name]);-- egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name)++ egui::WidgetInfo::labeled(egui::Role::Button, true, name)});if tresp.clicked() {// Alt/Cmd-click twirls every folder inside it too.@@@ -702,7 -702,7 +701,7 @@@} else {lp.rect_stroke(pr, 1.0, Stroke::new(1.0, t.text), egui::StrokeKind::Inside);}-- let presp = ui.interact(pr.expand(2.0).intersect(list), egui::Id::new(("pproxy", id.0)), Sense::click()).on_hover_text(format!(++ let presp = ui.interact(pr.expand(2.0).intersect(list), egui::Id::unique(("pproxy", id.0)), Sense::click()).on_hover_text(format!("Proxy: {} ({})",px.footage.path,if px.enabled { "in use" } else { "off" }@@@ -710,7 -710,7 +709,7 @@@app.auto.add(&format!("project.item.{}.proxy", id.0), pr, if px.enabled { "Proxy in use" } else { "Proxy off" });presp.widget_info(|| {let name = crate::i18n::tr_args(if px.enabled { "Proxy of {}: in use" } else { "Proxy of {}: off" }, &[&it.name]);-- egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name)++ egui::WidgetInfo::labeled(egui::Role::Button, true, name)});if presp.clicked() {actions.push(("file.useProxy".into(), json!({"item": id.0})));@@@ -728,7 -728,7 +727,7 @@@let m = Rect::from_center_size(pos2(r.min.x + name_w - 8.0, r.center().y), vec2(13.0, 12.0));lp.add(egui::Shape::convex_polygon(vec![m.center_top(), m.right_bottom(), m.left_bottom()], t.warning, Stroke::NONE));lp.text(m.center() + vec2(0.0, 1.5), Align2::CENTER_CENTER, "!", Tokens::semibold(9.0), Color32::BLACK);-- ui.interact(m.expand(2.0).intersect(list), egui::Id::new(("pproblem", id.0)), Sense::hover()).on_hover_text(why.as_str());++ ui.interact(m.expand(2.0).intersect(list), egui::Id::unique(("pproblem", id.0)), Sense::hover()).on_hover_text(why.as_str());app.auto.add(&format!("project.item.{}.problem", id.0), m, why);}let name_rect = Rect::from_min_max(pos2(x0 + 28.0, r.min.y + 2.0), pos2(r.min.x + name_w + 2.0, r.max.y - 2.0));@@@ -782,13 -782,13 +781,13 @@@// Label swatch: click for the label colour menu.let sw = Rect::from_center_size(pos2(label_x, r.center().y), vec2(10.0, 10.0));lp.rect_filled(sw, 2.0, t.label(it.label));-- let sresp = ui.interact(sw.expand(3.0).intersect(list), egui::Id::new(("plabel", id.0)), Sense::click());++ let sresp = ui.interact(sw.expand(3.0).intersect(list), egui::Id::unique(("plabel", id.0)), Sense::click());app.auto.add(&format!("project.item.{}.label", id.0), sw, it.label.name());sresp.widget_info(|| {let name = crate::i18n::tr_args("Label of {}: {}", &[&it.name, &app.session.prefs.label_name(it.label)]);-- egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name)++ egui::WidgetInfo::labeled(egui::Role::Button, true, name)});-- let pop = egui::Id::new(("plabel-pop", id.0));++ let pop = egui::Id::unique(("plabel-pop", id.0));if sresp.clicked() || sresp.secondary_clicked() {widgets::open_popup(ui, pop);}@@@ -813,10 -813,10 +812,10 @@@if cell_edit(app, ui, &mut actions, "comment", cr) {continue;}-- let cresp = ui.interact(cell, egui::Id::new(("pcomment", id.0)), Sense::CLICK);++ let cresp = ui.interact(cell, egui::Id::unique(("pcomment", id.0)), Sense::CLICK);app.auto.add(&format!("project.item.{}.comment", id.0), cell, &it.comment);cresp.widget_info(|| {-- egui::WidgetInfo::labeled(egui::WidgetType::Other, true, crate::i18n::tr_args("Comment of {}: {}", &[&it.name, &it.comment]))++ egui::WidgetInfo::labeled(egui::Role::Unknown, true, crate::i18n::tr_args("Comment of {}: {}", &[&it.name, &it.comment]))});if cresp.double_clicked() {ctx.data_mut(|d| d.insert_temp::<Editing>(edit_id(), (id.0, "comment".into(), it.comment.clone())));@@@ -840,7 -840,7 +839,7 @@@lp.rect_stroke(r.shrink(0.5), 0.0, Stroke::new(1.0, t.accent), egui::StrokeKind::Inside);}// Part of the row: not a second Tab stop.-- let nresp = ui.interact(name_clip, egui::Id::new(("pname", id.0)), Sense::CLICK | Sense::DRAG);++ let nresp = ui.interact(name_clip, egui::Id::unique(("pname", id.0)), Sense::CLICK | Sense::DRAG);app.auto.add(&format!("project.item.{}.name", id.0), name_clip, &it.name);let resp = resp.union(nresp);if resp.clicked() {@@@ -1003,7 -1017,7 +1016,7 @@@&& let Some(pos) = ctx.pointer_hover_pos()&& let Some(it) = app.session.project.item(ItemId(*iid)){-- let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::new("dnd-ghost")));++ let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("dnd-ghost")));let g = painter.layout_no_wrap(it.name.clone(), Tokens::ui(12.0), t.text);let r = Rect::from_min_size(pos + vec2(12.0, 8.0), g.size() + vec2(16.0, 8.0));painter.rect_filled(r, 4.0, Color32::from_rgba_premultiplied(40, 40, 40, 230));@@@ -1019,9 -1033,9 +1032,9 @@@(Icon::NewComp, "newComp", "Create a new Composition"),] {let r = Rect::from_min_size(pos2(x, foot.min.y + 3.0), vec2(22.0, 22.0));-- let resp = widgets::icon_button(ui, r, icon, false, &t, egui::Id::new(("pfoot", id))).on_hover_text(tip);++ let resp = widgets::icon_button(ui, r, icon, false, &t, egui::Id::unique(("pfoot", id))).on_hover_text(tip);app.auto.add(&format!("project.{id}"), r, tip);-- resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, crate::i18n::tr(tip)));++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, crate::i18n::tr(tip)));if resp.clicked() {let footage =app.session.state.project_selection.first().and_then(|i| app.session.project.item(*i)).is_some_and(|i| matches!(i.kind, ItemKind::Footage(_)));@@@ -1051,10 -1065,10 +1064,10 @@@}let depth = app.session.project.settings.bit_depth.label();let dr = Rect::from_min_size(pos2(x + 4.0, foot.min.y + 5.0), vec2(48.0, 18.0));-- let dresp = ui.interact(dr, egui::Id::new("bpc"), Sense::click());++ let dresp = ui.interact(dr, egui::Id::unique("bpc"), Sense::click());p.text(dr.center(), Align2::CENTER_CENTER, depth, Tokens::ui(11.5), if dresp.hovered() { t.text } else { t.text_dim });app.auto.add("project.bitDepth", dr, depth);-- dresp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, crate::i18n::tr_args("Project color depth: {}", &[&depth])));++ dresp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, crate::i18n::tr_args("Project color depth: {}", &[&depth])));// Click cycles 8/16/32 bpc; Alt-click opens Project Settings (as in After Effects).if dresp.clicked() {if ui.input(|i| i.modifiers.alt) {@@@ -1065,8 -1079,8 +1078,9 @@@}dresp.on_hover_text(crate::i18n::tr("Project color depth: click to cycle 8/16/32 bpc, Alt-click for Project Settings"));let tr = Rect::from_min_size(pos2(foot.max.x - 30.0, foot.min.y + 3.0), vec2(22.0, 22.0));-- let trash = widgets::icon_button(ui, tr, Icon::Trash, false, &t, egui::Id::new("ptrash")).on_hover_text(crate::i18n::tr("Delete selected project items"));-- trash.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, crate::i18n::tr("Delete selected project items")));++ let trash =++ widgets::icon_button(ui, tr, Icon::Trash, false, &t, egui::Id::unique("ptrash")).on_hover_text(crate::i18n::tr("Delete selected project items"));++ trash.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, crate::i18n::tr("Delete selected project items")));if trash.clicked() && !app.session.state.project_selection.is_empty() {actions.push(("project.delete".into(), json!({})));}@@@ -1091,7 -1105,7 +1105,7 @@@if empty.clicked() && !adding {app.session.state.project_selection.clear();}-- let box_id = egui::Id::new("proj-marquee");++ let box_id = egui::Id::unique("proj-marquee");if let (Some(start), Some(end)) = (ctx.input(|i| i.pointer.press_origin()), empty.interact_pointer_pos())&& empty.dragged(){diff --cc crates/ui-egui/src/panels/properties.rsindex 9f24d3484,9f24d3484..c9d759c16--- a/crates/ui-egui/src/panels/properties.rs+++ b/crates/ui-egui/src/panels/properties.rs@@@ -67,7 -67,7 +67,7 @@@ pub fn show(app: &mut EffectcraftApp, ulet ectx = EvalCtx { project: &project, comp_id: cid, comp: &comp, time: now, expr: expr.as_deref(), footage: None };let x0 = rect.min.x + PAD;let w = rect.width() - 2.0 * PAD;-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("props-scroll"), rect);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("props-scroll"), rect);let top = rect.min.y + 8.0 - scroll.offset;let mut y = top;let mut actions: Actions = vec![];@@@ -87,7 -87,7 +87,7 @@@if let Some(tr) = layer.transform().cloned() {section_header(app, ui, &p, x0, w, y, "Layer Transform", "properties.transform");let rr = Rect::from_min_size(pos2(x0 + w - 40.0, y), vec2(40.0, ROW_H));-- let resp = ui.interact(rr, egui::Id::new("props-reset"), Sense::click());++ let resp = ui.interact(rr, egui::Id::unique("props-reset"), Sense::click());p.text(rr.right_center(), Align2::RIGHT_CENTER, crate::i18n::tr("Reset"), Tokens::ui(12.0), if resp.hovered() { t.accent_hover } else { t.accent });app.auto.add("properties.transform.reset", rr, "Reset Transform");if resp.clicked() {@@@ -123,12 -123,12 +123,12 @@@// Both buttons grow with their (translated) labels; English keeps its 116 / 84 px.let text_w = |s: &str| p.layout_no_wrap(s.to_string(), Tokens::ui(12.0), t.text).size().x;let br = Rect::from_min_size(pos2(x0, y), vec2(116f32.max(text_w(crate::i18n::tr("Add Animator")) + 36.0), 24.0));-- let resp = ui.interact(br, egui::Id::new("props-add-animator"), Sense::click());++ let resp = ui.interact(br, egui::Id::unique("props-add-animator"), Sense::click());p.rect_stroke(br, 4.0, Stroke::new(1.0, if resp.hovered() { t.text_dim } else { t.field_border }), egui::StrokeKind::Inside);icons::paint(&p, Rect::from_center_size(pos2(br.min.x + 14.0, br.center().y), vec2(10.0, 10.0)), Icon::Plus, t.text);p.text(pos2(br.min.x + 26.0, br.center().y), Align2::LEFT_CENTER, crate::i18n::tr("Add Animator"), Tokens::ui(12.0), t.text);app.auto.add("properties.addAnimator", br, "Add Animator");-- let pop = egui::Id::new("props-add-animator-pop");++ let pop = egui::Id::unique("props-add-animator-pop");if resp.clicked() {widgets::open_popup(ui, pop);}@@@ -145,11 -145,11 +145,11 @@@}// Our own presets (original work, see presets/text_animators.json).let pr = Rect::from_min_size(pos2(br.max.x + 8.0, y), vec2(84f32.max(text_w(crate::i18n::tr("Presets")) + 16.0), 24.0));-- let presp = ui.interact(pr, egui::Id::new("props-text-presets"), Sense::click());++ let presp = ui.interact(pr, egui::Id::unique("props-text-presets"), Sense::click());p.rect_stroke(pr, 4.0, Stroke::new(1.0, if presp.hovered() { t.text_dim } else { t.field_border }), egui::StrokeKind::Inside);p.text(pr.center(), Align2::CENTER_CENTER, crate::i18n::tr("Presets"), Tokens::ui(12.0), t.text);app.auto.add("properties.textPresets", pr, "Text Animation Presets");-- let ppop = egui::Id::new("props-text-presets-pop");++ let ppop = egui::Id::unique("props-text-presets-pop");if presp.clicked() {widgets::open_popup(ui, ppop);}@@@ -207,7 -207,7 +207,7 @@@ fn transform_row(app: &mut EffectcraftAlet cells = [("prev", r.min.x + 4.0), ("key", r.min.x + 16.0), ("next", r.min.x + 28.0)];for (what, cx) in cells {let cr = Rect::from_center_size(pos2(cx, cy), vec2(12.0, 16.0));-- let resp = ui.interact(cr, egui::Id::new(("props-nav", uid, what)), Sense::click());++ let resp = ui.interact(cr, egui::Id::unique(("props-nav", uid, what)), Sense::click());let col = if resp.hovered() { t.text } else { t.text_dim };match what {"prev" => triangle(p, cr.center(), true, col),@@@ -237,7 -237,7 +237,7 @@@}} else {let swr = Rect::from_center_size(pos2(r.min.x + 16.0, cy), vec2(14.0, 14.0));-- let resp = ui.interact(swr, egui::Id::new(("props-sw", uid)), Sense::click());++ let resp = ui.interact(swr, egui::Id::unique(("props-sw", uid)), Sense::click());icons::paint(p, swr, Icon::Stopwatch, if resp.hovered() { t.text } else { t.text_dim });app.auto.add(&format!("{base}.stopwatch"), swr, &pr.name);if resp.clicked() {@@@ -247,7 -247,7 +247,7 @@@p.text(pos2(r.min.x + 42.0, cy), Align2::LEFT_CENTER, &pr.name, Tokens::ui(12.0), t.text);let vx = r.min.x + (r.width() * 0.5).max(130.0);let label = Rect::from_min_max(pos2(r.min.x + 42.0, r.min.y), pos2(vx - 20.0, r.max.y));-- let resp = ui.interact(label, egui::Id::new(("props-label", uid)), Sense::click());++ let resp = ui.interact(label, egui::Id::unique(("props-label", uid)), Sense::click());app.auto.add(&format!("{base}.label"), label, &pr.name);if resp.double_clicked() {app.ui.timeline.search.clear();@@@ -271,7 -271,7 +271,7 @@@match &value {Value::Scalar(v) if pr.name == "Rotation" || pr.name.ends_with(" Rotation") => {let (_, deg) = super::fx_widgets::split_angle(*v);-- let (rr, dr, nv) = super::fx_widgets::angle_field(ui, pos2(vx, cy - 9.0), egui::Id::new(("props-v", uid)), *v, decimals(deg), &t);++ let (rr, dr, nv) = super::fx_widgets::angle_field(ui, pos2(vx, cy - 9.0), egui::Id::unique(("props-v", uid)), *v, decimals(deg), &t);app.auto.add(&format!("{base}.value"), dr, &pr.name);app.auto.add(&format!("{base}.revolutions"), rr, &pr.name);if let Some(nv) = nv {@@@ -280,7 -280,7 +280,7 @@@}Value::Scalar(v) => {let range = if pr.name == "Opacity" { (0.0, 100.0) } else { (-1e9, 1e9) };-- let (vr, nv, _) = widgets::hot_number_at(ui, pos2(vx, cy - 9.0), egui::Id::new(("props-v", uid)), *v, 0.5, range, decimals(*v), suffix, &t);++ let (vr, nv, _) = widgets::hot_number_at(ui, pos2(vx, cy - 9.0), egui::Id::unique(("props-v", uid)), *v, 0.5, range, decimals(*v), suffix, &t);app.auto.add(&format!("{base}.value"), vr, &pr.name);if let Some(nv) = nv {set(actions, json!(nv));@@@ -297,7 -297,7 +297,7 @@@if linkable {// Constrain Proportions toggle, left of the values.let lr = Rect::from_center_size(pos2(x - 12.0, cy), vec2(12.0, 12.0));-- let resp = ui.interact(lr, egui::Id::new(("props-link", uid)), Sense::click()).on_hover_text(tr("Constrain Proportions"));++ let resp = ui.interact(lr, egui::Id::unique(("props-link", uid)), Sense::click()).on_hover_text(tr("Constrain Proportions"));icons::paint(p, lr, Icon::Link, if linked { t.accent } else { t.text_faint });app.auto.add(&format!("{base}.constrain"), lr, "Constrain Proportions");if resp.clicked() && !app.ui.timeline.unlinked.remove(&uid) {@@@ -306,7 -306,7 +306,7 @@@}for d in 0..n.min(c.len()) {let (vr, nv, _) =-- widgets::hot_number_at(ui, pos2(x, cy - 9.0), egui::Id::new(("props-v", uid, d)), c[d], 1.0, (-1e9, 1e9), decimals(c[d]), suffix, &t);++ widgets::hot_number_at(ui, pos2(x, cy - 9.0), egui::Id::unique(("props-v", uid, d)), c[d], 1.0, (-1e9, 1e9), decimals(c[d]), suffix, &t);app.auto.add(&format!("{base}.value.{d}"), vr, &pr.name);if let Some(nv) = nv {let mut nc = c.clone();@@@ -356,14 -356,14 +356,14 @@@ fn text_sectiony += ROW_H + 4.0;// Font family and style.let fr = Rect::from_min_size(pos2(x0, y), vec2(w, 22.0));-- let pop = egui::Id::new("props-font-pop");++ let pop = egui::Id::unique("props-font-pop");if let Some(f) = super::text_panels::font_picker(app, ui, pop, fr, &doc.font, "properties.text.font", true) {set(actions, json!({"font": f}));}y += 28.0;let sr = Rect::from_min_size(pos2(x0, y), vec2(w, 22.0));-- let spop = egui::Id::new("props-style-pop");-- if widgets::dropdown(ui, sr, &doc.style, &t, egui::Id::new("props-style")).clicked() {++ let spop = egui::Id::unique("props-style-pop");++ if widgets::dropdown(ui, sr, &doc.style, &t, egui::Id::unique("props-style")).clicked() {widgets::open_popup(ui, spop);}app.auto.add("properties.text.style", sr, "Font style");@@@ -377,7 -377,7 +377,7 @@@let col2 = x0 + w / 2.0;let field = |app: &mut EffectcraftApp, ui: &mut egui::Ui, x: f32, y: f32, glyph: &str, key: &str, v: f64, range: (f64, f64), suffix: &str| {p.text(pos2(x, y + 9.0), Align2::LEFT_CENTER, glyph, Tokens::semibold(11.0), t.text_dim);-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(x + 26.0, y), egui::Id::new(("props-text", key)), v, 0.5, range, decimals(v), suffix, &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(x + 26.0, y), egui::Id::unique(("props-text", key)), v, 0.5, range, decimals(v), suffix, &t);app.auto.add(&format!("properties.text.{key}"), r, key);nv};@@@ -394,7 -394,7 +394,7 @@@// Auto Leading: click to switch to an explicit value (120% of the size).p.text(pos2(col2, y + 9.0), Align2::LEFT_CENTER, "A", Tokens::semibold(11.0), t.text_dim);let r = Rect::from_min_size(pos2(col2 + 26.0, y), vec2(40.0, 18.0));-- let resp = ui.interact(r, egui::Id::new("props-leading-auto"), Sense::click());++ let resp = ui.interact(r, egui::Id::unique("props-leading-auto"), Sense::click());p.text(pos2(r.min.x + 2.0, r.center().y),Align2::LEFT_CENTER,@@@ -420,14 -420,14 +420,14 @@@for (i, (key, label, on, c)) in [("fill", "Fill", doc.apply_fill, doc.fill), ("stroke", "Stroke", doc.apply_stroke, doc.stroke)].into_iter().enumerate() {let ry = y + i as f32 * 24.0;let cr = Rect::from_min_size(pos2(x0, ry + 2.0), vec2(14.0, 14.0));-- if widgets::checkbox(ui, cr, on, &t, egui::Id::new(("props-apply", key))).clicked() {++ if widgets::checkbox(ui, cr, on, &t, egui::Id::unique(("props-apply", key))).clicked() {let k = if key == "fill" { "applyFill" } else { "applyStroke" };set(actions, json!({k: !on}));}app.auto.add(&format!("properties.text.{key}.enabled"), cr, label);let sw = Rect::from_min_size(pos2(x0 + 24.0, ry + 1.0), vec2(16.0, 16.0));-- let pop = egui::Id::new(("props-color-pop", key));-- if widgets::swatch(ui, sw, c, egui::Id::new(("props-color", key)), &t).clicked() {++ let pop = egui::Id::unique(("props-color-pop", key));++ if widgets::swatch(ui, sw, c, egui::Id::unique(("props-color", key)), &t).clicked() {widgets::open_popup(ui, pop);}app.auto.add(&format!("properties.text.{key}"), sw, label);@@@ -461,7 -461,7 +461,7 @@@ fn paragraph_sectionfor (i, (j, key)) in ALIGNS.into_iter().enumerate() {let r = Rect::from_min_size(pos2(x0 + i as f32 * 26.0, y), vec2(22.0, 22.0));let on = doc.justify == j;-- let resp = ui.interact(r, egui::Id::new(("props-para", key)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("props-para", key)), Sense::click());p.rect_filled(r,3.0,@@@ -516,7 -516,7 +516,7 @@@ fn paint_align_glyph(p: &egui::Painterfn more_button(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painter, x0: f32, y: f32, id: &str, auto: &str, panel: PanelKind) -> f32 {let t = app.tokens;let r = Rect::from_min_size(pos2(x0, y), vec2(64.0, 22.0));-- let resp = ui.interact(r, egui::Id::new(id), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(id), Sense::click());p.rect_filled(r, 4.0, if resp.hovered() { t.hover } else { t.field_bg });p.text(pos2(r.min.x + 8.0, r.center().y), Align2::LEFT_CENTER, "···", Tokens::semibold(12.0), t.text);p.text(pos2(r.min.x + 26.0, r.center().y), Align2::LEFT_CENTER, crate::i18n::tr("More"), Tokens::ui(12.0), t.text);diff --cc crates/ui-egui/src/panels/puppet_tool.rsindex 8299f3a34,8299f3a34..968fafaf2--- a/crates/ui-egui/src/panels/puppet_tool.rs+++ b/crates/ui-egui/src/panels/puppet_tool.rs@@@ -70,7 -70,7 +70,7 @@@ struct Cachedpub fn overlay(app: &EffectcraftApp, ctx: &egui::Context, cid: ItemId, layer: &Layer, t: Tick) -> Option<Overlay> {let fx = layer.effects()?.groups().find(|g| puppet::is_puppet(g))?;let key = (app.session.revision, cid.0, layer.id.0, t.0);-- let id = egui::Id::new(("puppet-overlay", layer.id.0));++ let id = egui::Id::unique(("puppet-overlay", layer.id.0));if let Some(c) = ctx.data(|d| d.get_temp::<Cached>(id))&& c.key == key{diff --cc crates/ui-egui/src/panels/render_queue.rsindex 73bd92e80,73bd92e80..ae5436296--- a/crates/ui-egui/src/panels/render_queue.rs+++ b/crates/ui-egui/src/panels/render_queue.rs@@@ -444,7 -444,7 +444,7 @@@ pub fn show(app: &mut EffectcraftApp, u}}let mut forms: Vec<(RenderQueueItem, String)> = Vec::new();-- let state_id = egui::Id::new("rq-ui");++ let state_id = egui::Id::unique("rq-ui");let (mut open, mut selected): (Vec<u64>, Option<u64>) = ui.data(|d| d.get_temp(state_id).unwrap_or_default());// ---------------------------------------------------------- Current Render strip@@@ -468,20 -468,20 +468,20 @@@let render_b = Rect::from_min_size(pos2(top.max.x - 12.0 - bw, top.min.y + 34.0), vec2(bw, 26.0));let stop_b = Rect::from_min_size(pos2(render_b.min.x - 8.0 - bw, render_b.min.y), vec2(bw, 26.0));let can_render = !rendering && queue.iter().any(RenderQueueItem::is_queued) && !available.is_empty();-- if widgets::text_button(ui, render_b, "Render", can_render, &t, egui::Id::new("rq-render")).clicked() && can_render {++ if widgets::text_button(ui, render_b, "Render", can_render, &t, egui::Id::unique("rq-render")).clicked() && can_render {actions.push(("renderQueue.render", json!({"wait": false})));}app.auto.add("renderQueue.render", render_b, "Render");// Notify (sound + notification when the queue finishes).let notify = app.session.project.render_prefs.notify;let nb = Rect::from_min_size(pos2(render_b.min.x - 8.0 - 2.0 * bw - 8.0, render_b.min.y + 4.0), vec2(18.0, 18.0));-- if widgets::checkbox(ui, nb, notify, &t, egui::Id::new("rq-notify")).clicked() {++ if widgets::checkbox(ui, nb, notify, &t, egui::Id::unique("rq-notify")).clicked() {actions.push(("renderQueue.setNotify", json!({"notify": !notify})));}p.text(pos2(nb.max.x + 5.0, nb.center().y), Align2::LEFT_CENTER, tr("Notify"), Tokens::ui(11.5), t.text_dim);app.auto.add("renderQueue.notify", nb, if notify { "Notify: on" } else { "Notify: off" });if rendering {-- if widgets::text_button(ui, stop_b, "Stop", false, &t, egui::Id::new("rq-stop")).clicked() {++ if widgets::text_button(ui, stop_b, "Stop", false, &t, egui::Id::unique("rq-stop")).clicked() {actions.push(("renderQueue.stop", json!({})));}app.auto.add("renderQueue.stop", stop_b, "Stop");@@@ -538,7 -538,7 +538,7 @@@// ---------------------------------------------------------- itemslet list = Rect::from_min_max(pos2(rect.min.x, head.max.y), pos2(rect.max.x, rect.max.y - FOOT_H));let lp = p.with_clip_rect(list);-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("rq-scroll"), list);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("rq-scroll"), list);// Items scroll under the header and footer: clip their widgets (and hit tests) to the list.let panel_clip = ui.clip_rect();ui.set_clip_rect(list.intersect(panel_clip));@@@ -546,7 -546,7 +546,7 @@@if queue.is_empty() {lp.text(pos2(list.center().x, list.min.y + 30.0), Align2::CENTER_CENTER, tr("The render queue is empty."), Tokens::ui(12.0), t.text_faint);}-- let editing_id = egui::Id::new("rq-edit-output");++ let editing_id = egui::Id::unique("rq-edit-output");let mut editing: Option<(u64, String)> = ui.data(|d| d.get_temp(editing_id));for (k, it) in queue.iter().enumerate() {let n = k + 1;@@@ -565,7 -565,7 +565,7 @@@t.row_alt},);-- let row_resp = ui.interact(row, egui::Id::new(("rq-row", it.id)), Sense::click());++ let row_resp = ui.interact(row, egui::Id::unique(("rq-row", it.id)), Sense::click());if row_resp.clicked() {selected = Some(it.id);app.ui.focused = crate::dock::PanelKind::RenderQueue;@@@ -592,7 -592,7 +592,7 @@@app.auto.add(&aid("row"), row, &format!("#{n}"));let is_open = open.contains(&it.id);let tw = Rect::from_center_size(pos2(cx_twirl + 8.0, row.center().y), vec2(14.0, 14.0));-- if widgets::twirl(ui, tw, is_open, egui::Id::new(("rq-twirl", it.id)), &t).clicked() {++ if widgets::twirl(ui, tw, is_open, egui::Id::unique(("rq-twirl", it.id)), &t).clicked() {if is_open {open.retain(|i| *i != it.id);} else {@@@ -601,7 -601,7 +601,7 @@@}app.auto.add(&aid("twirl"), tw, "Twirl");let cb = Rect::from_center_size(pos2(cx_render + 20.0, row.center().y), vec2(18.0, 18.0));-- if widgets::checkbox(ui, cb, it.render, &t, egui::Id::new(("rq-cb", it.id))).clicked() && !rendering {++ if widgets::checkbox(ui, cb, it.render, &t, egui::Id::unique(("rq-cb", it.id))).clicked() && !rendering {actions.push(("renderQueue.setRender", json!({"item": it.id, "render": !it.render})));}app.auto.add(&aid("render"), cb, if it.render { "Render: on" } else { "Render: off" });@@@ -619,7 -619,7 +619,7 @@@let st_rect = Rect::from_min_size(pos2(cx_status, row.min.y), vec2(w_status, ROW_H));lp.text(pos2(cx_status + 2.0, row.center().y), Align2::LEFT_CENTER, &status, Tokens::ui(12.0), status_color(&t, &it.status));if let RenderStatus::Failed(e) = &it.status {-- ui.interact(st_rect, egui::Id::new(("rq-st", it.id)), Sense::hover()).on_hover_text(e);++ ui.interact(st_rect, egui::Id::unique(("rq-st", it.id)), Sense::hover()).on_hover_text(e);}app.auto.add(&aid("status"), st_rect, &status);if let Some(s) = it.started {@@@ -651,7 -651,7 +651,7 @@@};lp.text(pos2(cx_num - 6.0, r.center().y), Align2::LEFT_CENTER, label, Tokens::ui(11.5), t.text_dim);let dd = Rect::from_min_size(pos2(ix + 70.0, r.min.y + 3.0), vec2(220.0, ROW_H - 6.0));-- let did = egui::Id::new(("rq-dd", it.id, sub));++ let did = egui::Id::unique(("rq-dd", it.id, sub));let shown: String = if summary.chars().count() > 31 { summary.chars().take(30).chain(std::iter::once('…')).collect() } else { summary.clone() };if widgets::dropdown(ui, dd, &shown, &t, did).clicked() && !rendering {widgets::open_popup(ui, did);@@@ -684,7 -684,7 +684,7 @@@// Log: Errors Only / Plus Settings / Plus Per Frame Info.let ld = Rect::from_min_size(pos2(r.max.x - 190.0, r.min.y + 3.0), vec2(150.0, ROW_H - 6.0));lp.text(pos2(ld.min.x - 6.0, r.center().y), Align2::RIGHT_CENTER, tr("Log:"), Tokens::ui(11.5), t.text_dim);-- let lid = egui::Id::new(("rq-log", it.id));++ let lid = egui::Id::unique(("rq-log", it.id));if widgets::dropdown(ui, ld, it.log.label(), &t, lid).clicked() && !rendering {widgets::open_popup(ui, lid);}@@@ -699,7 -699,7 +699,7 @@@let ox = dd.max.x + 14.0;lp.text(pos2(ox, r.center().y), Align2::LEFT_CENTER, tr("Output To:"), Tokens::ui(11.5), t.text_dim);let odd = Rect::from_min_size(pos2(ox + 62.0, r.min.y + 3.0), vec2(22.0, ROW_H - 6.0));-- let oid = egui::Id::new(("rq-out", it.id));++ let oid = egui::Id::unique(("rq-out", it.id));if widgets::dropdown(ui, odd, "", &t, oid).clicked() && !rendering {widgets::open_popup(ui, oid);}@@@ -735,7 -735,7 +735,7 @@@}} else {let shown = app.session.resolve_output(it).unwrap_or_else(|| "Not yet specified".into());-- let resp = ui.interact(path_rect, egui::Id::new(("rq-path", it.id)), Sense::click());++ let resp = ui.interact(path_rect, egui::Id::unique(("rq-path", it.id)), Sense::click());let col = if resp.hovered() { t.accent_hover } else { t.hot_text };lp.with_clip_rect(path_rect.intersect(list)).text(pos2(path_rect.min.x, r.center().y), Align2::LEFT_CENTER, &shown, Tokens::ui(11.5), col);// Clicking the file name opens the save dialog (Output Movie To); Alt-click, or adiff --cc crates/ui-egui/src/panels/roto_tool.rsindex fbd7119c8,fbd7119c8..52175899c--- a/crates/ui-egui/src/panels/roto_tool.rs+++ b/crates/ui-egui/src/panels/roto_tool.rs@@@ -64,7 -64,7 +64,7 @@@ pub fn draw_overlay(scale * 1000.0) as u32,format!("{}{:?}{:?}{}", o.view, o.overlay_color, o.boundary_color, o.overlay_opacity),);-- let id = egui::Id::new("roto-overlay");++ let id = egui::Id::unique("roto-overlay");let cached: Option<Overlay> = ctx.data(|d| d.get_temp(id));let ov = match cached {Some(c) if c.key == key => Some(c),@@@ -149,7 -149,7 +149,7 @@@ pub fn interactlet ctx = ui.ctx().clone();let mods = ui.input(|i| i.modifiers);let Some(kind) = app.ui.tool.roto_kind(mods.alt) else { return false };-- let resp = ui.interact(area, egui::Id::new("layer-panel-roto"), Sense::click_and_drag());++ let resp = ui.interact(area, egui::Id::unique("layer-panel-roto"), Sense::click_and_drag());let o = app.session.state.roto.clone();let refine = kind.starts_with("refine");let dia = if refine { o.refine_diameter } else { o.diameter };@@@ -170,7 -170,7 +170,7 @@@}// ⌘/Ctrl-drag resizes the brush (After Effects): the circle stays at the press point and its// edge follows the pointer. No stroke is painted.-- let rid = egui::Id::new("layer-panel-roto-resize");++ let rid = egui::Id::unique("layer-panel-roto-resize");if resp.drag_started()&& mods.command&& let Some(pos) = ui.input(|i| i.pointer.press_origin()).or(resp.interact_pointer_pos())@@@ -194,7 -194,7 +194,7 @@@}return true;}-- let did = egui::Id::new("layer-panel-roto-drag");++ let did = egui::Id::unique("layer-panel-roto-drag");if resp.drag_started()&& let Some(pos) = ui.input(|i| i.pointer.press_origin()).or(resp.interact_pointer_pos()){@@@ -277,8 -277,8 +277,8 @@@ pub fn span_bar(app: &mut EffectcraftApp.line_segment([pos2(cx, r.min.y), pos2(cx, r.max.y)], Stroke::new(1.0, t.timecode));p.rect_stroke(track, 2.0, Stroke::new(1.0, Color32::from_black_alpha(140)), StrokeKind::Outside);app.auto.add("layerPanel.rotoSpan", track, "Segmentation span");-- let resp = ui.interact(track, egui::Id::new("roto-span-bar"), Sense::click_and_drag());-- let hid = egui::Id::new("roto-span-handle");++ let resp = ui.interact(track, egui::Id::unique("roto-span-bar"), Sense::click_and_drag());++ let hid = egui::Id::unique("roto-span-handle");if resp.drag_started()&& let (Some(pos), Some(_)) = (resp.interact_pointer_pos(), d.base){@@@ -322,7 -322,7 +322,7 @@@ pub fn bar_buttons(app: &mut Effectcraffor (id, label) in [("alpha", tr("Alpha")), ("alphaBoundary", tr("Boundary")), ("alphaOverlay", tr("Overlay"))] {let r = Rect::from_min_size(pos2(x, bar.center().y - 10.0), vec2(66.0, 20.0));let on = view == id;-- if widgets::text_button(ui, r, label, on, &t, egui::Id::new(("roto-view", id))).clicked() {++ if widgets::text_button(ui, r, label, on, &t, egui::Id::unique(("roto-view", id))).clicked() {let v = if on { "none" } else { id };let _ = app.session.execute("roto.options", json!({"view": v}));}@@@ -337,7 -337,7 +337,7 @@@x += 8.0;let r = Rect::from_min_size(pos2(x, bar.center().y - 10.0), vec2(74.0, 20.0));let label = if frozen { tr("Unfreeze") } else { tr("Freeze") };-- if widgets::text_button(ui, r, label, frozen, &t, egui::Id::new(("roto-freeze", uid))).clicked() {++ if widgets::text_button(ui, r, label, frozen, &t, egui::Id::unique(("roto-freeze", uid))).clicked() {let id = if frozen { "roto.unfreeze" } else { "roto.freeze" };if let Err(e) = app.session.execute(id, json!({"layer": layer.id.0, "effect": uid})) {app.ui.status = e.to_string();@@@ -347,7 -347,7 +347,7 @@@x += 80.0;if running {let r = Rect::from_min_size(pos2(x, bar.center().y - 10.0), vec2(60.0, 20.0));-- if widgets::text_button(ui, r, tr("Stop"), false, &t, egui::Id::new("roto-stop")).clicked() {++ if widgets::text_button(ui, r, tr("Stop"), false, &t, egui::Id::unique("roto-stop")).clicked() {let _ = app.session.execute("roto.cancel", json!({}));}app.auto.add("layerPanel.roto.stop", r, "Stop");diff --cc crates/ui-egui/src/panels/rq_templates.rsindex f03771133,f03771133..3a8791a49--- a/crates/ui-egui/src/panels/rq_templates.rs+++ b/crates/ui-egui/src/panels/rq_templates.rs@@@ -22,7 -22,7 +22,7 @@@ struct State}fn state_id() -> egui::Id {-- egui::Id::new("rq-templates-dialog")++ egui::Id::unique("rq-templates-dialog")}/// Open the dialog for `kind` (`renderSettings` | `outputModule`).diff --cc crates/ui-egui/src/panels/scopes_panel.rsindex 6665164e2,6665164e2..c832061e8--- a/crates/ui-egui/src/panels/scopes_panel.rs+++ b/crates/ui-egui/src/panels/scopes_panel.rs@@@ -97,7 -97,7 +97,7 @@@ pub fn show(app: &mut EffectcraftApp, ulet time = app.session.time();let key = (app.session.revision, cid.0, time.0, format!("{}{}{}{}{}x{}", st.scope, st.standard, st.float, st.clamp, o.width, o.height), 0);let ctx = ui.ctx().clone();-- let id = egui::Id::new("scopes-cache");++ let id = egui::Id::unique("scopes-cache");let cached: Option<Cached> = ctx.data(|d| d.get_temp(id));let cached = match cached {Some(c) if c.key == key => c,diff --cc crates/ui-egui/src/panels/script_console.rsindex 97c30c4c4,97c30c4c4..4d0f1eb9d--- a/crates/ui-egui/src/panels/script_console.rs+++ b/crates/ui-egui/src/panels/script_console.rs@@@ -110,7 -110,7 +110,7 @@@ pub fn show(app: &mut EffectcraftApp, ulet mut run_now = false;let mut child = ui.new_child(egui::UiBuilder::new().max_rect(in_rect));let te = egui::TextEdit::multiline(&mut app.ui.script_console.input)-- .id(egui::Id::new("script-console-input"))++ .id(egui::Id::unique("script-console-input")).font(Tokens::mono(12.0)).desired_width(in_rect.width()).desired_rows(4)@@@ -124,10 -124,10 +124,10 @@@let bar = Rect::from_min_size(pos2(rect.min.x, rect.max.y - bar_h), vec2(rect.width(), bar_h));let run_r = Rect::from_min_size(pos2(bar.max.x - 64.0, bar.min.y + 2.0), vec2(56.0, 20.0));let clear_r = Rect::from_min_size(pos2(bar.max.x - 128.0, bar.min.y + 2.0), vec2(56.0, 20.0));-- let run_resp = ui.interact(run_r, egui::Id::new("script-console-run"), Sense::click());++ let run_resp = ui.interact(run_r, egui::Id::unique("script-console-run"), Sense::click());p.rect_filled(run_r, 3.0, if run_resp.hovered() { t.accent_hover } else { t.accent });p.text(run_r.center(), Align2::CENTER_CENTER, tr("Run"), Tokens::ui(12.0), egui::Color32::WHITE);-- let clear_resp = ui.interact(clear_r, egui::Id::new("script-console-clear"), Sense::click());++ let clear_resp = ui.interact(clear_r, egui::Id::unique("script-console-clear"), Sense::click());p.rect_stroke(clear_r, 3.0, egui::Stroke::new(1.0, t.field_border), egui::StrokeKind::Inside);p.text(clear_r.center(), Align2::CENTER_CENTER, tr("Clear"), Tokens::ui(12.0), t.text);app.auto.add("scriptConsole.run", run_r, "Run");diff --cc crates/ui-egui/src/panels/scriptui_view.rsindex f0a3975fc,f0a3975fc..a9fda57cc--- a/crates/ui-egui/src/panels/scriptui_view.rs+++ b/crates/ui-egui/src/panels/scriptui_view.rs@@@ -51,7 -51,7 +51,7 @@@ fn draw_children(app: &mut EffectcraftAlet tw = (tab.text.chars().count() as f32 * 7.0 + 20.0).max(48.0);let hr = Rect::from_min_size(pos2(x, r.min.y), vec2(tw, 22.0));let active = i == w.active_tab;-- let resp = ui.interact(hr, egui::Id::new(("sui-tab", win, tab.id)), Sense::click());++ let resp = ui.interact(hr, egui::Id::unique(("sui-tab", win, tab.id)), Sense::click());ui.painter().rect_filled(hr,3.0,@@@ -86,7 -86,7 +86,7 @@@ fn draw_widget(app: &mut EffectcraftApplet services = app.session.services.clone();let rect = rect_of(origin, w.bounds);register(app, win, w, rect);-- let id = egui::Id::new(("sui", win, w.id));++ let id = egui::Id::unique(("sui", win, w.id));let tip = |r: egui::Response| if w.help_tip.is_empty() { r } else { r.on_hover_text(&w.help_tip) };// onDraw: the script paints the control. Without drawOSControl() its paint replaces the// default look (buttons and toggles still respond to clicks); with it, it goes on top.@@@ -316,7 -316,7 +316,7 @@@ fn paint_draw(ui: &egui::Ui, rect: Rect/// A ScriptUIImage as a texture (decoded once and kept; `None` when it can't be read or/// decoded).fn image_texture(ctx: &egui::Context, img: &ImageRef, services: &dyn Services) -> Option<egui::TextureHandle> {-- let id = egui::Id::new(("scriptui-image", img));++ let id = egui::Id::unique(("scriptui-image", img));if let Some(cached) = ctx.data(|d| d.get_temp::<Option<egui::TextureHandle>>(id)) {return cached;}@@@ -382,7 -382,7 +382,7 @@@ fn wants_mouse(w: &Widget, depth: usize/// same control; it replaces the plain click the control reported, so a checkbox toggles once)./// Only events a listener wants are sent; none while `active` is false (a modal dialog is up).fn mouse_events(ui: &egui::Ui, origin: egui::Pos2, area: Rect, win: u32, root: &Widget, active: bool, acts: &mut Vec<Act>) {-- let id = egui::Id::new(("sui-mouse", win));++ let id = egui::Id::unique(("sui-mouse", win));if !wants_mouse(root, 0) {ui.data_mut(|d| d.remove::<MouseTrack>(id));return;@@@ -490,7 -490,7 +490,7 @@@ fn perform(app: &mut EffectcraftApp, ctOk(r) => {if let Some(e) = r.get("error").filter(|e| !e.is_null()) {let msg = e["message"].as_str().unwrap_or("script error").to_string();-- app.toast = Some((msg, ctx.input(|i| i.time)));++ app.toast = Some((msg, app.now()));} else if let Some(o) = r["output"].as_str().filter(|o| !o.is_empty()) {app.ui.status = o.lines().last().unwrap_or_default().to_string();}@@@ -512,7 -512,7 +512,7 @@@ pub fn show_windows(app: &mut Effectcralet blocked = windows.iter().any(|w| w.modal);if blocked {// A modal dialog blocks the app behind it, as in After Effects.-- let r = egui::Area::new(egui::Id::new("scriptui-modal-block")).order(egui::Order::Middle).fixed_pos(screen.min).show(ctx, |ui| {++ let r = egui::Area::new(egui::Id::unique("scriptui-modal-block")).order(egui::Order::Middle).fixed_pos(screen.min).show(ctx, |ui| {ui.allocate_exact_size(screen.size(), Sense::click_and_drag());ui.painter().rect_filled(screen, 0.0, Color32::from_black_alpha(90));});@@@ -523,7 -523,7 +523,7 @@@let mut open = true;let order = if w.modal { egui::Order::Foreground } else { egui::Order::Middle };let resp = egui::Window::new(if w.title.is_empty() { &w.script } else { &w.title })-- .id(egui::Id::new(("scriptui-window", w.id)))++ .id(egui::Id::unique(("scriptui-window", w.id))).order(order).collapsible(false).resizable(false)diff --cc crates/ui-egui/src/panels/settings.rsindex 6954e1377,8edc40b4d..a60272b4b--- a/crates/ui-egui/src/panels/settings.rs+++ b/crates/ui-egui/src/panels/settings.rs@@@ -346,7 -346,7 +346,7 @@@ fn theme_cardlet favorite = favorites.iter().any(|id| id == value);let tip = tr(if favorite { "Remove from favorites" } else { "Add to favorites" });let r = ui.add_visible(favorite || hovered, egui::Button::new("").min_size(vec2(24.0, 24.0)).frame(false)).on_hover_text(tip);-- r.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, format!("{}: {}", tip, tr(label))));++ r.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, format!("{}: {}", tip, tr(label))));reg(app, &format!("settings.appearance.favoriteThemes.{value}"), &r, tip);if favorite || hovered {crate::icons::paint(diff --cc crates/ui-egui/src/panels/shortcut_editor.rsindex 440ca6394,440ca6394..6b8e194f3--- a/crates/ui-egui/src/panels/shortcut_editor.rs+++ b/crates/ui-egui/src/panels/shortcut_editor.rs@@@ -377,7 -377,7 +377,7 @@@ pub fn show(app: &mut EffectcraftApp, c}let id = format!("shortcuts.key.{}", name.trim_start_matches('#'));app.auto.add(&id, r, label);-- let resp = ui.interact(r, egui::Id::new(("sc-key", name, r.min.x as i32)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("sc-key", name, r.min.x as i32)), Sense::click());if resp.clicked() {if let Some(i) = mod_idx {st.mods[i] = !st.mods[i];diff --cc crates/ui-egui/src/panels/templates.rsindex ec65ee6d7,ec65ee6d7..ff8778a15--- a/crates/ui-egui/src/panels/templates.rs+++ b/crates/ui-egui/src/panels/templates.rs@@@ -69,7 -69,7 +69,7 @@@ pub fn home_tab(app: &mut EffectcraftAp// Save the open project as a user template.let can_save = app.session.project.comps().next().is_some();let sr = Rect::from_min_size(pos2(area.max.x - 210.0, y - 4.0), vec2(210.0, 28.0));-- let save = widgets::text_button(ui, sr, "Save Current as Template…", false, &t, egui::Id::new("home-templates-save")).clicked();++ let save = widgets::text_button(ui, sr, "Save Current as Template…", false, &t, egui::Id::unique("home-templates-save")).clicked();app.auto.add("home.templates.saveCurrent", sr, "Save Current as Template…");if save {if can_save {@@@ -101,7 -101,7 +101,7 @@@let (cx, cy) = (full.min.x + (i % cols) as f32 * (card_w + gap), full.min.y + (i / cols) as f32 * (card_h + gap));let r = Rect::from_min_size(pos2(cx, cy), vec2(card_w, card_h));let visible = r.intersects(ui.clip_rect());-- let resp = ui.interact(r, egui::Id::new(("template-card", &tpl.id)), Sense::click()).on_hover_text(&tpl.description);++ let resp = ui.interact(r, egui::Id::unique(("template-card", &tpl.id)), Sense::click()).on_hover_text(&tpl.description);p.rect_filled(r, 8.0, if resp.hovered() { Color32::from_rgb(0x2c, 0x2e, 0x37) } else { Color32::from_rgb(0x24, 0x26, 0x2e) });let tr = Rect::from_min_size(r.min, vec2(card_w, thumb_h));let tex = if visible { thumb(app, &ctx, &tpl.id, &mut budget) } else { None };@@@ -137,7 -137,7 +137,7 @@@let mut del_hit = false;if !tpl.builtin {let dr = Rect::from_min_size(pos2(tr.max.x - 30.0, tr.min.y + 6.0), vec2(24.0, 24.0));-- let dresp = ui.interact(dr, egui::Id::new(("template-del", &tpl.id)), Sense::click()).on_hover_text(crate::i18n::tr("Delete this template"));++ let dresp = ui.interact(dr, egui::Id::unique(("template-del", &tpl.id)), Sense::click()).on_hover_text(crate::i18n::tr("Delete this template"));if resp.hovered() || dresp.hovered() {p.circle_filled(dr.center(), 12.0, if dresp.hovered() { Color32::from_rgb(0xc0, 0x3a, 0x3a) } else { Color32::from_black_alpha(170) });icons::paint(&p, dr.shrink(6.0), Icon::Close, Color32::WHITE);diff --cc crates/ui-egui/src/panels/text_panels.rsindex b3791efb7,b3791efb7..34dc4cce9--- a/crates/ui-egui/src/panels/text_panels.rs+++ b/crates/ui-egui/src/panels/text_panels.rs@@@ -63,7 -63,7 +63,7 @@@ pub fn text_target(app: &EffectcraftAppfn toggle(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painter, r: Rect, id: &str, label: &str, on: bool, bold: bool) -> bool {let t = app.tokens;-- let resp = ui.interact(r, egui::Id::new(("text-toggle", id)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("text-toggle", id)), Sense::click());p.rect_filled(r,3.0,@@@ -88,7 -88,7 +88,7 @@@ pub fn character(app: &mut EffectcraftAlet target = text_target(app);let enabled = target.is_some();let doc = target.as_ref().map(|t| t.doc.clone()).unwrap_or_default();-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("character-scroll"), rect);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("character-scroll"), rect);let top = rect.min.y + 10.0 - scroll.offset;let mut y = top;let x0 = rect.min.x + 10.0;@@@ -96,14 -96,14 +96,14 @@@let mut actions: Vec<serde_json::Value> = vec![];// Font family + style.let fr = Rect::from_min_size(pos2(x0, y), vec2(w, 22.0));-- let pop = egui::Id::new("char-font-pop");++ let pop = egui::Id::unique("char-font-pop");if let Some(f) = font_picker(app, ui, pop, fr, &doc.font, "character.font", enabled) {actions.push(json!({"font": f}));}y += 28.0;let sr = Rect::from_min_size(pos2(x0, y), vec2(w - 84.0, 22.0));-- let spop = egui::Id::new("char-style-pop");-- if widgets::dropdown(ui, sr, &doc.style, &t, egui::Id::new("char-style")).clicked() && enabled {++ let spop = egui::Id::unique("char-style-pop");++ if widgets::dropdown(ui, sr, &doc.style, &t, egui::Id::unique("char-style")).clicked() && enabled {widgets::open_popup(ui, spop);}app.auto.add("character.style", sr, "Font style");@@@ -135,7 -135,7 +135,7 @@@let fx = x0 + col as f32 * (w / 2.0);let fy = y + row as f32 * 28.0;p.text(pos2(fx, fy + 9.0), Align2::LEFT_CENTER, glyph, Tokens::semibold(11.0), t.text_dim);-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(fx + 26.0, fy), egui::Id::new(("char", key)), v, 0.5, range, 0, suffix, &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(fx + 26.0, fy), egui::Id::unique(("char", key)), v, 0.5, range, 0, suffix, &t);app.auto.add(&format!("character.{key}"), r, key);if let Some(nv) = nv&& enabled@@@ -153,8 -153,8 +153,8 @@@Kerning::Manual(v) => format!("{v:.0}"),};let kr = Rect::from_min_size(pos2(x0 + 26.0, fy), vec2((w / 2.0 - 32.0).max(50.0), 20.0));-- let kpop = egui::Id::new("char-kerning-pop");-- if widgets::dropdown(ui, kr, &label, &t, egui::Id::new("char-kerning")).clicked() && enabled {++ let kpop = egui::Id::unique("char-kerning-pop");++ if widgets::dropdown(ui, kr, &label, &t, egui::Id::unique("char-kerning")).clicked() && enabled {widgets::open_popup(ui, kpop);}app.auto.add("character.kerning", kr, "Kerning");@@@ -174,8 -174,8 +174,8 @@@let fy = y + 2.0 * 28.0;let dr = Rect::from_min_size(pos2(fx, fy), vec2(w / 2.0, 20.0));let labels = vec!["Fill Over Stroke".to_string(), "Stroke Over Fill".to_string()];-- let pop = egui::Id::new("char-stroke-order-pop");-- if widgets::dropdown(ui, dr, &labels[doc.stroke_over_fill as usize], &t, egui::Id::new("char-stroke-order")).clicked() && enabled {++ let pop = egui::Id::unique("char-stroke-order-pop");++ if widgets::dropdown(ui, dr, &labels[doc.stroke_over_fill as usize], &t, egui::Id::unique("char-stroke-order")).clicked() && enabled {widgets::open_popup(ui, pop);}app.auto.add("character.strokeOverFill", dr, "Stroke order");@@@ -188,13 -188,13 +188,13 @@@for (i, (key, label, on, c)) in [("fill", "Fill", doc.apply_fill, doc.fill), ("stroke", "Stroke", doc.apply_stroke, doc.stroke)].into_iter().enumerate() {let fx = x0 + i as f32 * (w / 2.0);let cr = Rect::from_min_size(pos2(fx, y + 3.0), vec2(14.0, 14.0));-- if widgets::checkbox(ui, cr, on, &t, egui::Id::new(("char-apply", key))).clicked() && enabled {++ if widgets::checkbox(ui, cr, on, &t, egui::Id::unique(("char-apply", key))).clicked() && enabled {actions.push(json!({if key == "fill" { "applyFill" } else { "applyStroke" }: !on}));}app.auto.add(&format!("character.{key}.enabled"), cr, label);let fs = Rect::from_min_size(pos2(fx + 20.0, y), vec2(26.0, 20.0));-- let pop = egui::Id::new(("char-color-pop", key));-- if widgets::swatch(ui, fs, c, egui::Id::new(("char-color", key)), &t).clicked() && enabled {++ let pop = egui::Id::unique(("char-color-pop", key));++ if widgets::swatch(ui, fs, c, egui::Id::unique(("char-color", key)), &t).clicked() && enabled {widgets::open_popup(ui, pop);}app.auto.add(&format!("character.{key}"), fs, label);@@@ -204,7 -204,7 +204,7 @@@}let er = Rect::from_min_size(pos2(fs.max.x + 4.0, y + 1.0), vec2(18.0, 18.0));let active = app.ui.text_color_pick.as_ref().is_some_and(|pick| pick.layer == target.as_ref().map_or(0, |tt| tt.layer) && pick.field == key);-- let eye = super::fx_widgets::eyedropper_button(ui, er, active, egui::Id::new(("char-eye", key)), &t);++ let eye = super::fx_widgets::eyedropper_button(ui, er, active, egui::Id::unique(("char-eye", key)), &t);app.auto.add(&format!("character.{key}.eyedropper"), er, &format!("{label} eyedropper"));if eye.clicked() {if active {@@@ -240,17 -240,17 +240,17 @@@y += 32.0;// Ligatures.let lr = Rect::from_min_size(pos2(x0, y), vec2(14.0, 14.0));-- if widgets::checkbox(ui, lr, doc.ligatures, &t, egui::Id::new("char-ligatures")).clicked() && enabled {++ if widgets::checkbox(ui, lr, doc.ligatures, &t, egui::Id::unique("char-ligatures")).clicked() && enabled {actions.push(json!({"ligatures": !doc.ligatures}));}app.auto.add("character.ligatures", lr, "Ligatures");p.text(pos2(x0 + 20.0, y + 7.0), Align2::LEFT_CENTER, tr("Ligatures"), Tokens::ui(11.5), t.text_dim);// OpenType: a popup with the font's layout features (like the Character panel's OpenType menu).let or = Rect::from_min_size(pos2(sr.max.x + 6.0, sr.min.y), vec2(78.0, 22.0));-- let opop = egui::Id::new("char-opentype-pop");++ let opop = egui::Id::unique("char-opentype-pop");let n_on = doc.opentype.feature_settings().len();let olabel = if n_on > 0 { format!("OT ({n_on})") } else { "OpenType".to_string() };-- if widgets::dropdown(ui, or, &olabel, &t, egui::Id::new("char-opentype")).clicked() && enabled {++ if widgets::dropdown(ui, or, &olabel, &t, egui::Id::unique("char-opentype")).clicked() && enabled {widgets::open_popup(ui, opop);}app.auto.add("character.opentype", or, "OpenType");@@@ -264,7 -264,7 +264,7 @@@.enumerate(){let cr = Rect::from_min_size(pos2(x0 + i as f32 * 120.0, y), vec2(14.0, 14.0));-- if widgets::checkbox(ui, cr, on, &t, egui::Id::new(("char-vert", key))).clicked() && enabled {++ if widgets::checkbox(ui, cr, on, &t, egui::Id::unique(("char-vert", key))).clicked() && enabled {actions.push(json!({key: !on}));}app.auto.add(&format!("character.{key}"), cr, label);@@@ -288,7 -288,7 +288,7 @@@let v = doc.variations.iter().chain(&instance).find(|(t2, _)| t2.trim_end() == tag).map(|(_, v)| *v).unwrap_or(a.default);p.text(pos2(fx, fy + 9.0), Align2::LEFT_CENTER, &tag, Tokens::semibold(10.5), t.text_dim);let (r, nv, _) =-- widgets::hot_number_at(ui, pos2(fx + 34.0, fy), egui::Id::new(("char-axis", &tag)), v as f64, 1.0, (a.min as f64, a.max as f64), 0, "", &t);++ widgets::hot_number_at(ui, pos2(fx + 34.0, fy), egui::Id::unique(("char-axis", &tag)), v as f64, 1.0, (a.min as f64, a.max as f64), 0, "", &t);app.auto.add(&format!("character.axis.{tag}"), r, &a.name);if let Some(nv) = nv&& enabled@@@ -461,7 -461,7 +461,7 @@@ pub fn paragraph(app: &mut EffectcraftAlet doc = target.as_ref().map(|t| t.doc.clone()).unwrap_or_default();let x0 = rect.min.x + 10.0;let w = rect.width() - 20.0;-- let scroll = widgets::PanelScroll::begin(ui, egui::Id::new("paragraph-scroll"), rect);++ let scroll = widgets::PanelScroll::begin(ui, egui::Id::unique("paragraph-scroll"), rect);let top = rect.min.y + 10.0 - scroll.offset;let mut y = top;let mut actions: Vec<serde_json::Value> = vec![];@@@ -469,7 -469,7 +469,7 @@@for (i, (j, key)) in ALIGNS.into_iter().enumerate() {let r = Rect::from_min_size(pos2(x0 + i as f32 * (bw + 3.0), y), vec2(bw, 24.0));let on = doc.justify == j;-- let resp = ui.interact(r, egui::Id::new(("para", key)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("para", key)), Sense::click());p.rect_filled(r,3.0,@@@ -504,7 -504,7 +504,7 @@@let fx = x0 + (i % 2) as f32 * (w / 2.0);let fy = y + (i / 2) as f32 * 28.0;p.text(pos2(fx, fy + 9.0), Align2::LEFT_CENTER, glyph, Tokens::semibold(11.0), t.text_dim);-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(fx + 26.0, fy), egui::Id::new(("para-f", key)), v, 0.5, (-5000.0, 5000.0), 0, " px", &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(fx + 26.0, fy), egui::Id::unique(("para-f", key)), v, 0.5, (-5000.0, 5000.0), 0, " px", &t);app.auto.add(&format!("paragraph.{key}"), r, key);if let Some(nv) = nv&& enabled@@@ -521,8 -521,8 +521,8 @@@if world_ready || rtl {let dr = Rect::from_min_size(pos2(x0, y), vec2(w / 2.0 - 4.0, 22.0));let dirs = vec!["Left-to-Right Text".to_string(), "Right-to-Left Text".to_string()];-- let dpop = egui::Id::new("para-direction-pop");-- if widgets::dropdown(ui, dr, &dirs[rtl as usize], &t, egui::Id::new("para-direction")).clicked() && enabled {++ let dpop = egui::Id::unique("para-direction-pop");++ if widgets::dropdown(ui, dr, &dirs[rtl as usize], &t, egui::Id::unique("para-direction")).clicked() && enabled {widgets::open_popup(ui, dpop);}app.auto.add("paragraph.direction", dr, "Text direction");@@@ -536,9 -536,9 +536,9 @@@} else {vec!["Every-line Composer".to_string(), "Single-line Composer".to_string()]};-- let cpop = egui::Id::new("para-composer-pop");++ let cpop = egui::Id::unique("para-composer-pop");let single = doc.composer == Composer::SingleLine;-- if widgets::dropdown(ui, cr, &comps[single as usize], &t, egui::Id::new("para-composer")).clicked() && enabled {++ if widgets::dropdown(ui, cr, &comps[single as usize], &t, egui::Id::unique("para-composer")).clicked() && enabled {widgets::open_popup(ui, cpop);}app.auto.add("paragraph.composer", cr, "Composer");@@@ -547,7 -547,7 +547,7 @@@}y += 30.0;let hr = Rect::from_min_size(pos2(x0, y), vec2(14.0, 14.0));-- if widgets::checkbox(ui, hr, doc.hanging_punctuation, &t, egui::Id::new("para-hanging")).clicked() && enabled {++ if widgets::checkbox(ui, hr, doc.hanging_punctuation, &t, egui::Id::unique("para-hanging")).clicked() && enabled {actions.push(json!({"hangingPunctuation": !doc.hanging_punctuation}));}app.auto.add("paragraph.hangingPunctuation", hr, "Roman Hanging Punctuation");@@@ -610,7 -610,7 +610,10 @@@ pub(super) fn font_picker(app: &mut Effsearch.request_focus();}ui.memory_mut(|m| m.set_focus_lock_filter(search_id, egui::EventFilter { vertical_arrows: true, escape: true, ..Default::default() }));-- if widgets::icon_button(ui, arrow, crate::icons::Icon::ChevronDown, false, &t, id.with("arrow")).clicked() {++ if widgets::icon_button(ui, arrow, crate::icons::Icon::ChevronDown, false, &t, id.with("arrow"))++ .on_hover_text(crate::i18n::tr("Close font search"))++ .clicked()++ {ui.data_mut(|d| {d.insert_temp(id.with("open"), false);d.remove::<FontSearch>(state_id);@@@ -697,7 -697,7 +700,7 @@@let row_width = ui.available_width();let label_width = if preview { (row_width - 100.0).max(40.0) } else { row_width };let resp = ui.add_sized([row_width, 24.0], egui::Button::selectable(index == state.selected, ""));-- resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, ui.is_enabled(), index == state.selected, &r.display));++ resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::Button, ui.is_enabled(), index == state.selected, &r.display));let label_rect = Rect::from_min_size(resp.rect.min + vec2(5.0, 0.0), vec2(label_width - 5.0, resp.rect.height()));ui.painter().with_clip_rect(label_rect.intersect(ui.clip_rect())).text(label_rect.left_center(),@@@ -713,7 -713,7 +716,7 @@@resp.scroll_to_me(None);}if preview && ui.is_rect_visible(resp.rect) {-- let key = egui::Id::new(("font-preview", &r.family));++ let key = egui::Id::unique(("font-preview", &r.family));let lines: std::sync::Arc<Vec<Vec<[f32; 2]>>> = match ui.data(|d| d.get_temp(key)) {Some(l) => l,None => {@@@ -765,7 -765,7 +768,7 @@@ pub fn align(app: &mut EffectcraftApp,p.text(pos2(x0, y + 10.0), Align2::LEFT_CENTER, tr("Align Layers to:"), Tokens::ui(11.5), t.text_dim);let dr = Rect::from_min_size(pos2(x0 + 100.0, y), vec2(110.0, 20.0));let to_sel = app.ui.align_to_selection;-- let pid = egui::Id::new("align-to-pop");++ let pid = egui::Id::unique("align-to-pop");if widgets::dropdown(ui, dr, if to_sel { "Selection" } else { "Composition" }, &t, pid.with("btn")).clicked() {widgets::open_popup(ui, pid);}@@@ -785,7 -785,7 +788,7 @@@}for (i, op) in ops.iter().enumerate() {let r = Rect::from_min_size(pos2(x0 + i as f32 * 34.0 + if i >= 3 { 12.0 } else { 0.0 }, y), vec2(30.0, 28.0));-- let resp = ui.interact(r, egui::Id::new((kind, *op)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique((kind, *op)), Sense::click());p.rect_filled(r, 3.0, if resp.hovered() { t.hover } else { t.field_bg });align_glyph(&p, r, op, row == 1, &t);let tip = align_tip(kind, op);diff --cc crates/ui-egui/src/panels/text_range_handles.rsindex bb5f01e36,bb5f01e36..6ab7ee2b8--- a/crates/ui-egui/src/panels/text_range_handles.rs+++ b/crates/ui-egui/src/panels/text_range_handles.rs@@@ -106,7 -106,7 +106,7 @@@ pub fn viewer_hook// A short grab zone around the triangle, so the line above doesn't steal the// layer's scale handles.let hr = Rect::from_two_pos(sp, sp + up * 8.0 + inward * 6.0).expand(3.0);-- let id = egui::Id::new(("viewer-text-range", pr.uid));++ let id = egui::Id::unique(("viewer-text-range", pr.uid));let on_box_handle = ctx.pointer_latest_pos().is_some_and(|p| box_handles.iter().any(|c| c.distance(p) < 9.0));let free = ctx.is_being_dragged(id) || !on_box_handle;let resp = (interactive && free).then(|| ui.interact(hr, id, Sense::drag()));diff --cc crates/ui-egui/src/panels/timeline.rsindex 7ed212cc5,2231a080f..238071bda--- a/crates/ui-egui/src/panels/timeline.rs+++ b/crates/ui-egui/src/panels/timeline.rs@@@ -123,7 -123,7 +123,7 @@@ const EXPR_MAX_LINES: usize = 100/// The text of the expression being edited (while its editor has the keyboard).fn expr_buf_id(prop: u64) -> egui::Id {-- egui::Id::new(("expr-buf", prop))++ egui::Id::unique(("expr-buf", prop))}/// Insert an expression editor row after every property that has an expression: as many lines@@@ -164,7 -164,7 +164,7 @@@ const WHIP_EXPR: u8 = 1const WHIP_PROP: u8 = 2;fn pick_whip_id() -> egui::Id {-- egui::Id::new("tl-pickwhip")++ egui::Id::unique("tl-pickwhip")}/// A pick whip at `rect`: dragging it starts a pick whip of `kind` from `layer`'s `prop` (0 for@@@ -180,7 -180,7 +180,7 @@@ fn pick_whiplabel: &str,hint: &str,) -> egui::Response {-- let resp = ui.interact(rect, egui::Id::new(("pick-whip", kind, layer, prop)), Sense::drag()).on_hover_text(hint);++ let resp = ui.interact(rect, egui::Id::unique(("pick-whip", kind, layer, prop)), Sense::drag()).on_hover_text(hint);icons::paint(p, rect.shrink(1.0), Icon::PickWhip, if resp.hovered() || resp.dragged() { app.tokens.text } else { app.tokens.text_dim });app.auto.add(auto, rect, label);if resp.drag_started() {@@@ -195,7 -195,7 +195,7 @@@type WhipTargets = (u64, Vec<(Rect, u64, u64, Vec<Rect>)>);fn whip_targets_id() -> egui::Id {-- egui::Id::new("tl-pickwhip-targets")++ egui::Id::unique("tl-pickwhip-targets")}/// While a pick whip is being dragged, `layer`'s property `prop` shown at `row` in another panel@@@ -264,13 -264,28 +264,28 @@@ fn centered_on(span: f64, duration: f64type WhipInto = (String, [usize; 2]);fn whip_into_id(prop: u64) -> egui::Id {-- egui::Id::new(("tl-pickwhip-into", prop))++ egui::Id::unique(("tl-pickwhip-into", prop))}- /// After a pick whip into the expression being edited: its editor takes the focus back, the- /// cursor this many characters before the end (just after the reference).- fn expr_refocus_id(prop: u64) -> egui::Id {- egui::Id::new(("tl-expr-refocus", prop))+ /// An expression editor to take the keyboard when it is next drawn: its property, the text to+ /// select as counts of characters before the end (so it fits the expression as it will be then)+ /// and the pass it was asked for in. After a pick whip into the expression being edited, the+ /// cursor goes just after the reference; after an Alt-click on a stopwatch adds an expression,+ /// its whole text is selected, so typing replaces it.+ #[derive(Clone, Copy, Debug)]+ struct ExprFocus {+ prop: u64,+ select: [usize; 2],+ pass: u64,+ }++ fn expr_focus_id() -> egui::Id {- egui::Id::new("tl-expr-focus")++ egui::Id::unique("tl-expr-focus")+ }++ fn focus_expression(ctx: &egui::Context, prop: u64, select: [usize; 2]) {+ let pass = ctx.cumulative_pass_nr();+ ctx.data_mut(|d| d.insert_temp(expr_focus_id(), ExprFocus { prop, select, pass }));}#[derive(Clone, Debug)]@@@ -546,7 -561,7 +561,7 @@@ fn ruler_label(fno: i64, fps_i: i64, se}fn tl_map_id() -> egui::Id {-- egui::Id::new("timeline-map")++ egui::Id::unique("timeline-map")}/// The column right of the time graph: the composition marker bin over the layers' scroll bar.@@@ -579,7 -594,7 +594,7 @@@ pub(crate) fn set_zoom(tl: &mut crate::/// `;`: from the whole comp, zoom in to frame level around the CTI; otherwise show the whole comp.pub fn toggle_frame_zoom(app: &mut EffectcraftApp, ctx: &egui::Context) {-- let Some((_, w)) = ctx.data(|d| d.get_temp::<(f32, f32)>(egui::Id::new("timeline-graph-area"))) else { return };++ let Some((_, w)) = ctx.data(|d| d.get_temp::<(f32, f32)>(egui::Id::unique("timeline-graph-area"))) else { return };let Some(comp) = app.session.active_comp_arc() else { return };let fit = fit_pps(w, &comp);if app.ui.timeline.pps.is_some_and(|p| p > fit) {@@@ -600,14 -615,14 +615,14 @@@ pub fn toggle_fit_zoom(app: &mut Effectreturn;}let Some((start, pps)) = tl.before_fit.take() else { return };-- let Some((_, w)) = ctx.data(|d| d.get_temp::<(f32, f32)>(egui::Id::new("timeline-graph-area"))) else { return };++ let Some((_, w)) = ctx.data(|d| d.get_temp::<(f32, f32)>(egui::Id::unique("timeline-graph-area"))) else { return };let Some(comp) = app.session.active_comp_arc() else { return };set_zoom(&mut app.ui.timeline, &comp, pps, fit_pps(w, &comp), start, 0.0);}/// Zoom the time ruler around the CTI.pub fn zoom(app: &mut EffectcraftApp, ctx: &egui::Context, k: f64) {-- let Some((_, w)) = ctx.data(|d| d.get_temp::<(f32, f32)>(egui::Id::new("timeline-graph-area"))) else { return };++ let Some((_, w)) = ctx.data(|d| d.get_temp::<(f32, f32)>(egui::Id::unique("timeline-graph-area"))) else { return };let Some(comp) = app.session.active_comp_arc() else { return };let fit = fit_pps(w, &comp);let pps = app.ui.timeline.pps.unwrap_or(fit);@@@ -688,18 -703,18 +703,18 @@@ fn double_click_action(layer: &Layer) -/// Open the rename field on layer `id`; it takes the keyboard focus on its first frame only.fn start_rename(ctx: &egui::Context, id: u64, name: &str) {ctx.data_mut(|d| {-- d.insert_temp(egui::Id::new("tl-rename"), (id, name.to_string()));++ d.insert_temp(egui::Id::unique("tl-rename"), (id, name.to_string()));d.insert_temp(rename_focus_id(), true);});}/// The Timeline's open group rename field: (layer, group uid, text).fn group_rename_id() -> egui::Id {-- egui::Id::new("tl-group-rename")++ egui::Id::unique("tl-group-rename")}fn rename_focus_id() -> egui::Id {-- egui::Id::new("tl-rename-focus")++ egui::Id::unique("tl-rename-focus")}fn group_visible(g: &PropGroup, layer: &Layer) -> bool {@@@ -1240,7 -1276,7 +1276,7 @@@ fn layer_icon(l: &Layer, project: &effe/// Layers being dragged to a new place in the stack (timeline rows).fn layer_drag_id() -> egui::Id {-- egui::Id::new("tl-layer-drag")++ egui::Id::unique("tl-layer-drag")}/// A keyframe drag in progress: where the pointer started, the grabbed key's comp time@@@ -1255,7 -1291,7 +1291,7 @@@ struct KeyDrag}fn key_drag_id() -> egui::Id {-- egui::Id::new("tl-key-drag")++ egui::Id::unique("tl-key-drag")}/// A Quick Offset drag of selected layer bars (Ctrl/Cmd+Alt, #1012): the bar it started on, where@@@ -1269,7 -1305,7 +1305,7 @@@ struct QuickBar}fn quick_bar_id() -> egui::Id {-- egui::Id::new("tl-quick-bar")++ egui::Id::unique("tl-quick-bar")}/// How many layers a Quick Offset of `layers` staggers (#1012): the unlocked ones, each once, if@@@ -1292,7 -1328,7 +1328,7 @@@ fn quick_offset_note(frames: i64, layer/// A Timeline drag's readout by the pointer (After Effects shows it in the Info panel).fn drag_tip(ctx: &egui::Context, t: &Tokens, ptr: Pos2, note: String) {-- let fg = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::new("tl-key-drag-tip")));++ let fg = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("tl-key-drag-tip")));let g = fg.layout_no_wrap(note, Tokens::ui(11.5), t.text);let r = Rect::from_min_size(ptr + vec2(14.0, 14.0), g.size() + vec2(10.0, 6.0));fg.rect_filled(r, 3.0, t.panel_bg);@@@ -1310,7 -1346,7 +1346,7 @@@ struct SwitchDrag}fn switch_drag_id() -> egui::Id {-- egui::Id::new("tl-switch-drag")++ egui::Id::unique("tl-switch-drag")}/// The press-and-drag gesture of the Timeline's switches and stopwatches (`switch`, on `row`,@@@ -1403,7 -1439,7 +1439,7 @@@ fn layer_switch}fn anchor_id(comp: ItemId) -> egui::Id {-- egui::Id::new(("timeline-selection-anchor", comp.0))++ egui::Id::unique(("timeline-selection-anchor", comp.0))}/// Remember `layer` as where the next Shift-click selection starts.@@@ -1436,7 -1472,7 +1472,7 @@@ fn insertion(layer_rows: &[(Rect, Layer}fn layer_drop_id() -> egui::Id {-- egui::Id::new("tl-layer-drop")++ egui::Id::unique("tl-layer-drop")}/// Whether a Project item can replace a layer's source (the same set `layer.replaceSource`@@@ -1515,7 -1551,7 +1551,7 @@@ pub fn show(app: &mut EffectcraftApp, ulet cw = cols(rect.min.x - oscroll, left_w + overflow, vis);let graph_x0 = rect.min.x + left_w + 1.0;let graph_x1 = rect.max.x - GUTTER_W;-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("timeline-graph-area"), (graph_x0, graph_x1 - graph_x0)));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("timeline-graph-area"), (graph_x0, graph_x1 - graph_x0)));let fit_pps = fit_pps(graph_x1 - graph_x0, &comp);let pps = app.ui.timeline.pps.unwrap_or(fit_pps);if app.ui.timeline.pps.is_none() {@@@ -1551,7 -1587,7 +1587,7 @@@// ---- header (left): time display, search, switches.let tc = crate::panels::timecode(&app.session, &comp, time);let tc_rect = Rect::from_min_size(pos2(rect.min.x + 12.0, top + 6.0), vec2(150.0, 24.0));-- let tc_resp = ui.interact(tc_rect, egui::Id::new("tl-timecode"), Sense::click_and_drag());++ let tc_resp = ui.interact(tc_rect, egui::Id::unique("tl-timecode"), Sense::click_and_drag());p.text(tc_rect.left_center(), Align2::LEFT_CENTER, &tc, Tokens::semibold(16.0), t.timecode);// Under it the other style (frames under timecode, timecode under frames) and the rate.let settings = &app.session.project.settings;@@@ -1577,19 -1613,19 +1613,19 @@@let _ = app.session.execute("time.set", json!({"frame": f.max(0)}));}if tc_resp.double_clicked() {-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("tl-tc-edit"), tc.clone()));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("tl-tc-edit"), tc.clone()));}-- if let Some(mut buf) = ctx.data(|d| d.get_temp::<String>(egui::Id::new("tl-tc-edit"))) {++ if let Some(mut buf) = ctx.data(|d| d.get_temp::<String>(egui::Id::unique("tl-tc-edit"))) {let mut child = ui.new_child(egui::UiBuilder::new().max_rect(tc_rect));let r = child.add(egui::TextEdit::singleline(&mut buf).font(Tokens::semibold(16.0)).desired_width(150.0));if r.lost_focus() {if !ui.input(|i| i.key_pressed(egui::Key::Escape)) {let _ = app.session.execute("time.set", json!({"timecode": buf}));}-- ctx.data_mut(|d| d.remove::<String>(egui::Id::new("tl-tc-edit")));++ ctx.data_mut(|d| d.remove::<String>(egui::Id::unique("tl-tc-edit")));} else {widgets::keep_focus(&ctx, &r, &buf);-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("tl-tc-edit"), buf));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("tl-tc-edit"), buf));}}let sr = Rect::from_min_size(pos2(tc_rect.max.x + 14.0, top + 12.0), vec2((left_w - 420.0).clamp(120.0, 220.0), 22.0));@@@ -1607,7 -1643,7 +1643,7 @@@(Icon::Flowchart, false, "flowchart", "Composition Mini-Flowchart"),] {let r = Rect::from_min_size(pos2(bx - 24.0, top + 11.0), vec2(24.0, 24.0));-- let resp = widgets::icon_button(ui, r, icon, on, &t, egui::Id::new(("tl-sw", id))).on_hover_text(tip);++ let resp = widgets::icon_button(ui, r, icon, on, &t, egui::Id::unique(("tl-sw", id))).on_hover_text(tip);app.auto.add(&format!("timeline.switch.{id}"), r, tip);if resp.clicked() {match id {@@@ -1639,7 -1675,7 +1675,7 @@@}// The middle scrolls at the current zoom; each end is a handle that moves that side of the// visible span (pulled in: zoomed in; stretched to the whole track: the whole comp).-- let nresp = ui.interact(nav, egui::Id::new("tl-nav"), Sense::drag());++ let nresp = ui.interact(nav, egui::Id::unique("tl-nav"), Sense::drag());app.auto.add("timeline.navigator", nav, "Time navigator");if nresp.dragged() {let d = nresp.drag_delta().x as f64 / nav.width() as f64 * comp.duration.seconds();@@@ -1652,7 -1688,7 +1688,7 @@@let (t0, t1) = (tm.start, tm.t(graph_x1));for (end, x) in [("start", nav_vis.min.x), ("end", nav_vis.max.x)] {let hr = Rect::from_center_size(pos2(x, nav.center().y), vec2(10.0, nav.height() + 6.0));-- let hresp = ui.interact(hr, egui::Id::new(("tl-nav", end)), Sense::drag());++ let hresp = ui.interact(hr, egui::Id::unique(("tl-nav", end)), Sense::drag());app.auto.add(&format!("timeline.navigator.{end}"), hr, if end == "start" { "Time navigator start" } else { "Time navigator end" });if hresp.hovered() || hresp.dragged() {ctx.set_cursor_icon(egui::CursorIcon::ResizeHorizontal);@@@ -1676,7 -1712,7 +1712,7 @@@p.with_clip_rect(wa_row).rect_filled(wa, 0.0, t.tl_work_area_bar);let shift = ui.input(|i| i.modifiers.shift);let bar = wa.intersect(wa_row);-- let bresp = ui.interact(bar, egui::Id::new("wa-bar"), Sense::click_and_drag());++ let bresp = ui.interact(bar, egui::Id::unique("wa-bar"), Sense::click_and_drag());app.auto.add("timeline.workArea.bar", bar, "Work area");// Right-click: the work area's commands (After Effects).crate::widgets::context_menu(&bresp, |ui| {@@@ -1686,7 -1722,7 +1722,7 @@@}actions.extend(chosen);});-- let bar_start = egui::Id::new("wa-bar-start");++ let bar_start = egui::Id::unique("wa-bar-start");if bresp.drag_started() {ctx.data_mut(|d| d.insert_temp(bar_start, wa0));}@@@ -1709,7 -1745,7 +1745,7 @@@Rect::from_min_max(pos2(hx - 4.0, wa.min.y), pos2(hx + 1.0, wa.max.y))};p.rect_filled(handle, 2.0, t.accent);-- let resp = ui.interact(hr, egui::Id::new(("wa", set)), Sense::drag());++ let resp = ui.interact(hr, egui::Id::unique(("wa", set)), Sense::drag());app.auto.add(&format!("timeline.workArea.{set}"), hr, set);if resp.dragged()&& let Some(pt) = resp.interact_pointer_pos()@@@ -1805,8 -1841,8 +1841,11 @@@}// Scrub in the ruler: the current time jumps to the pointer as soon as the button goes down// (After Effects), then follows it.-- let rresp =-- ui.interact(Rect::from_min_max(pos2(graph_x0, ruler.min.y + 12.0), pos2(bin.min.x, ruler.max.y)), egui::Id::new("tl-ruler"), Sense::click_and_drag());++ let rresp = ui.interact(++ Rect::from_min_max(pos2(graph_x0, ruler.min.y + 12.0), pos2(bin.min.x, ruler.max.y)),++ egui::Id::unique("tl-ruler"),++ Sense::click_and_drag(),++ );if ((rresp.is_pointer_button_down_on() && ui.input(|i| i.pointer.primary_down())) || rresp.clicked())&& let Some(pt) = rresp.interact_pointer_pos(){@@@ -1852,7 -1888,7 +1891,8 @@@&& ui.input(|i| i.modifiers.command)&& let Some(cid) = app.session.active_comp_id(){-- let now = ui.input(|i| i.time);++ // The app clock: the audio scrub's idle timeout compares against it in the tick.++ let now = app.now();let t = app.session.time();app.scrub_audio(cid, t, now);}@@@ -1909,7 -1945,7 +1949,7 @@@}}let hdr_rect = Rect::from_min_max(ch.min, pos2(graph_x0 - 1.0, ch.max.y));-- let hresp = ui.interact(hdr_rect, egui::Id::new("tl-colhdr"), Sense::click());++ let hresp = ui.interact(hdr_rect, egui::Id::unique("tl-colhdr"), Sense::click());app.auto.add("timeline.header", hdr_rect, "Columns (right-click)");for (id, label) in COLUMNS {if let Some(x0) = match id {@@@ -1938,10 -1974,10 +1978,10 @@@}if hresp.secondary_clicked() {let under = hresp.interact_pointer_pos().and_then(|pt| column_at(&cw, pt.x));-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("tl-colhdr-under"), under.unwrap_or("")));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("tl-colhdr-under"), under.unwrap_or("")));}crate::widgets::context_menu(&hresp, |ui| {-- let under: &str = ctx.data(|d| d.get_temp(egui::Id::new("tl-colhdr-under"))).unwrap_or("");++ let under: &str = ctx.data(|d| d.get_temp(egui::Id::unique("tl-colhdr-under"))).unwrap_or("");if !under.is_empty() && under != "name" && ui.button(crate::i18n::tr("Hide This")).clicked() {actions.push(("timeline.column".into(), json!({"column": under, "visible": false})));ui.close();@@@ -2034,9 -2083,9 +2087,9 @@@let right_clip = full_clip.intersect(Rect::from_min_max(pos2(graph_x0, rows_rect.min.y), rows_rect.max));// Registered before the rows so keys, bars and editors on top of it get the pointer first.let empty_rect = if graph_on { Rect::NOTHING } else { Rect::from_min_max(pos2(graph_x0, rows_rect.min.y), rows_rect.max) };-- let empty = ui.interact(empty_rect, egui::Id::new("tl-graph-bg"), Sense::click_and_drag());++ let empty = ui.interact(empty_rect, egui::Id::unique("tl-graph-bg"), Sense::click_and_drag());let outline_rect = Rect::from_min_max(rows_rect.min, pos2(graph_x0 - 1.0, rows_rect.max.y));-- let outline_empty = ui.interact(outline_rect, egui::Id::new("tl-layer-bg"), Sense::click_and_drag());++ let outline_empty = ui.interact(outline_rect, egui::Id::unique("tl-layer-bg"), Sense::click_and_drag());app.auto.add("timeline.layerMarquee", outline_rect, "Drag empty outline to select layers");let mut hit_rows: Vec<(Rect, Row)> = vec![];// The value fields of multi-dimension properties (per dimension), for the pick whip.@@@ -2098,7 -2147,7 +2151,7 @@@br,icon,on,-- egui::Id::new(("av", layer.id.0, i)),++ egui::Id::unique(("av", layer.id.0, i)),layer.id.0,name,true,@@@ -2113,10 -2162,10 +2166,10 @@@if vis.label {let lr = Rect::from_center_size(pos2(cw.label + 10.0, cy), vec2(12.0, 12.0));lp.rect_filled(lr, 2.0, t.label(layer.label));-- let lresp = ui.interact(lr, egui::Id::new(("label", layer.id.0)), Sense::click());++ let lresp = ui.interact(lr, egui::Id::unique(("label", layer.id.0)), Sense::click());app.auto.add(&format!("timeline.layer.{}.label", layer.id.0), lr, layer.label.name());// Click (or right-click) the swatch for the label menu (After Effects).-- let pop = egui::Id::new(("label-pop", layer.id.0));++ let pop = egui::Id::unique(("label-pop", layer.id.0));if lresp.clicked() || lresp.secondary_clicked() {widgets::open_popup(ui, pop);}@@@ -2133,13 -2182,13 +2186,13 @@@let row_x0 = if vis.num { cw.num } else { cw.name + 16.0 };let row_resp = ui.interact(Rect::from_min_max(pos2(row_x0, r.min.y), pos2(cw.name_end, r.max.y)),-- egui::Id::new(("row", layer.id.0)),++ egui::Id::unique(("row", layer.id.0)),Sense::click_and_drag(),);// Twirl + icon + name.let tw = Rect::from_center_size(pos2(cw.name + 8.0, cy), vec2(14.0, 14.0));let open = app.ui.timeline.open_layers.contains(&layer.id.0);-- if widgets::twirl(ui, tw, open, egui::Id::new(("twirl", layer.id.0)), &t).clicked() {++ if widgets::twirl(ui, tw, open, egui::Id::unique(("twirl", layer.id.0)), &t).clicked() {ui_actions.push(UiAct::ToggleLayer(layer.id.0, ui.input(|i| i.modifiers.alt || i.modifiers.command)));}app.auto.add(&format!("timeline.layer.{}.twirl", layer.id.0), tw, "twirl");@@@ -2154,7 -2203,7 +2207,7 @@@cw.name + 34.0};let name_rect = Rect::from_min_max(pos2(name_x, r.min.y), pos2(cw.name_end - 4.0, r.max.y));-- let rename_id = egui::Id::new("tl-rename");++ let rename_id = egui::Id::unique("tl-rename");let renaming: Option<(u64, String)> = ctx.data(|d| d.get_temp(rename_id));if let Some((rl, mut buf)) = renaming.filter(|(rl, _)| *rl == layer.id.0) {let mut child = ui.new_child(egui::UiBuilder::new().max_rect(name_rect.shrink2(vec2(0.0, 2.0))));@@@ -2249,7 -2298,7 +2302,7 @@@br,icon,on,-- egui::Id::new(("sw", layer.id.0, i)),++ egui::Id::unique(("sw", layer.id.0, i)),layer.id.0,name,false,@@@ -2263,9 -2312,9 +2316,9 @@@// Modes.if app.ui.timeline.show_modes && layer.source.is_av() {let mr = Rect::from_min_size(pos2(cw.mode + 2.0, cy - 9.0), vec2(80.0, 18.0));-- let mresp = widgets::dropdown(ui, mr, layer.blend_mode.label(), &t, egui::Id::new(("mode", layer.id.0)));++ let mresp = widgets::dropdown(ui, mr, layer.blend_mode.label(), &t, egui::Id::unique(("mode", layer.id.0)));app.auto.add(&format!("timeline.layer.{}.mode", layer.id.0), mr, "Mode");-- let pop = egui::Id::new(("mode-pop", layer.id.0));++ let pop = egui::Id::unique(("mode-pop", layer.id.0));if mresp.clicked() {widgets::open_popup(ui, pop);}@@@ -2278,7 -2327,7 +2331,7 @@@}let tr = Rect::from_center_size(pos2(cw.mode + 76.0 + 6.0, cy), vec2(14.0, 14.0));app.auto.add(&format!("timeline.layer.{}.preserveTransparency", layer.id.0), tr, "Preserve Transparency");-- if widgets::checkbox(ui, tr, layer.preserve_transparency, &t, egui::Id::new(("pt", layer.id.0))).clicked() {++ if widgets::checkbox(ui, tr, layer.preserve_transparency, &t, egui::Id::unique(("pt", layer.id.0))).clicked() {// The click gives the selection the state the clicked row toggles to,// whatever the first selected layer's value (as the switches do).actions.push((@@@ -2298,9 -2347,9 +2351,9 @@@};// The cell is too narrow for the mode as well: it is in the tooltip and ticked in the menu.let tip = layer.track_matte.map(|m| format!("{label} · {}", crate::i18n::tr(m.kind.label())));-- let tresp = widgets::dropdown_tip(ui, mr, &label, tip.as_deref(), &t, egui::Id::new(("trkmat", layer.id.0)));++ let tresp = widgets::dropdown_tip(ui, mr, &label, tip.as_deref(), &t, egui::Id::unique(("trkmat", layer.id.0)));app.auto.add(&format!("timeline.layer.{}.trackMatte", layer.id.0), mr, "Track Matte");-- let pop = egui::Id::new(("trk-pop", layer.id.0));++ let pop = egui::Id::unique(("trk-pop", layer.id.0));if tresp.clicked() {widgets::open_popup(ui, pop);}@@@ -2344,9 -2393,9 +2397,9 @@@);let pr_rect = Rect::from_min_size(pos2(cw.parent + 20.0, cy - 9.0), vec2(94.0, 18.0));let plabel = layer.parent.and_then(|p| comp.layer(p)).map(|l| format!("{}. {}", idx_of(l.id), l.name)).unwrap_or_else(|| "None".into());-- let presp = widgets::dropdown(ui, pr_rect, &plabel, &t, egui::Id::new(("parent", layer.id.0)));++ let presp = widgets::dropdown(ui, pr_rect, &plabel, &t, egui::Id::unique(("parent", layer.id.0)));app.auto.add(&format!("timeline.layer.{}.parent", layer.id.0), pr_rect, "Parent");-- let pop = egui::Id::new(("par-pop", layer.id.0));++ let pop = egui::Id::unique(("par-pop", layer.id.0));if presp.clicked() {widgets::open_popup(ui, pop);}@@@ -2406,7 -2455,7 +2459,7 @@@continue;}let gresp = ui-- .interact(gr, egui::Id::new(("ghost", side, layer.id.0)), Sense::click_and_drag())++ .interact(gr, egui::Id::unique(("ghost", side, layer.id.0)), Sense::click_and_drag()).on_hover_text(crate::i18n::tr("Drag to slip the source"));// Outside the bar it is empty track area: a plain click deselects.if gresp.clicked() && !ui.input(|i| i.modifiers.shift || i.modifiers.command) {@@@ -2416,7 -2465,7 +2469,7 @@@if gresp.hovered() || gresp.dragged() {ctx.set_cursor_icon(egui::CursorIcon::ResizeHorizontal);}-- let acc_id = egui::Id::new(("slip-acc", layer.id.0));++ let acc_id = egui::Id::unique(("slip-acc", layer.id.0));if gresp.dragged() {let mut acc: f32 = ctx.data(|d| d.get_temp(acc_id).unwrap_or(0.0));acc += gresp.drag_delta().x;@@@ -2439,9 -2488,9 +2492,9 @@@app.auto.add(&format!("timeline.layer.{}.bar", layer.id.0), bar, &layer.name);// Interactions: move body, trim edges.let (body_r, in_r, out_r) = trim_zones(bar);-- let body = ui.interact(body_r, egui::Id::new(("bar", layer.id.0)), Sense::click_and_drag());-- let lin = ui.interact(in_r, egui::Id::new(("bar-in", layer.id.0)), Sense::drag());-- let lout = ui.interact(out_r, egui::Id::new(("bar-out", layer.id.0)), Sense::drag());++ let body = ui.interact(body_r, egui::Id::unique(("bar", layer.id.0)), Sense::click_and_drag());++ let lin = ui.interact(in_r, egui::Id::unique(("bar-in", layer.id.0)), Sense::drag());++ let lout = ui.interact(out_r, egui::Id::unique(("bar-out", layer.id.0)), Sense::drag());app.auto.add(&format!("timeline.layer.{}.bar.in", layer.id.0), in_r, "Trim In");app.auto.add(&format!("timeline.layer.{}.bar.out", layer.id.0), out_r, "Trim Out");if lin.hovered() || lout.hovered() || lin.dragged() || lout.dragged() {@@@ -2485,7 -2534,7 +2538,7 @@@continue;}if resp.dragged() {-- let acc_id = egui::Id::new(("bar-acc", layer.id.0, kind));++ let acc_id = egui::Id::unique(("bar-acc", layer.id.0, kind));let mut acc: f32 = ctx.data(|d| d.get_temp(acc_id).unwrap_or(0.0));acc += resp.drag_delta().x;let frames = ((acc as f64 / pps) / fd).trunc() as i64;@@@ -2505,7 -2554,7 +2558,7 @@@ctx.data_mut(|d| d.insert_temp(acc_id, acc));}if resp.drag_stopped() {-- ctx.data_mut(|d| d.remove::<f32>(egui::Id::new(("bar-acc", layer.id.0, kind))));++ ctx.data_mut(|d| d.remove::<f32>(egui::Id::unique(("bar-acc", layer.id.0, kind))));ui_actions.push(UiAct::EndMerge);}}@@@ -2554,7 -2603,7 +2607,7 @@@let indent = cw.name + 6.0 + 14.0 * row.depth as f32;if *has_children {let tw = Rect::from_center_size(pos2(indent, cy), vec2(13.0, 13.0));-- if widgets::twirl(ui, tw, *open, egui::Id::new(("gtw", uid)), &t).clicked() {++ if widgets::twirl(ui, tw, *open, egui::Id::unique(("gtw", uid)), &t).clicked() {// Alt/Cmd-click twirls the whole tree under the group (as on a layer).ui_actions.push(UiAct::ToggleGroup(layer.id.0, *uid, ui.input(|i| i.modifiers.alt || i.modifiers.command)));}@@@ -2562,7 -2611,7 +2615,7 @@@}if let Some(en) = fx {let fr_ = Rect::from_center_size(pos2(cw.switches + SW * 3.0 + SW / 2.0, cy), vec2(16.0, 16.0));-- if widgets::icon_toggle(ui, fr_, Icon::Fx, *en, &t, egui::Id::new(("gfx", uid)), Sense::click()).clicked() {++ if widgets::icon_toggle(ui, fr_, Icon::Fx, *en, &t, egui::Id::unique(("gfx", uid)), Sense::click()).clicked() {actions.push(("effect.toggle".into(), json!({"layer": layer.id.0, "effect": uid})));}app.auto.add(&format!("timeline.group.{uid}.fx"), fr_, name);@@@ -2571,7 -2620,7 +2624,7 @@@// Layer style eye switch in the A/V column, like AE.let er = Rect::from_center_size(pos2(cw.av + 10.0, cy), vec2(15.0, 15.0));lp.rect_stroke(er.shrink(1.5), 2.0, Stroke::new(1.0, t.separator), StrokeKind::Inside);-- if widgets::icon_toggle(ui, er, Icon::Eye, *en, &t, egui::Id::new(("geye", uid)), Sense::click()).clicked() {++ if widgets::icon_toggle(ui, er, Icon::Eye, *en, &t, egui::Id::unique(("geye", uid)), Sense::click()).clicked() {actions.push(("layer.style.toggle".into(), json!({"layer": layer.id.0, "style": uid})));}app.auto.add(&format!("timeline.group.{uid}.eye"), er, name);@@@ -2602,7 -2651,7 +2655,7 @@@if *uid == GEOM_BIT | layer.id.0 {let lr = lp.text(pos2(cw.switches + 6.0, cy), Align2::LEFT_CENTER, crate::i18n::tr("Change Renderer…"), Tokens::ui(11.5), t.accent);let resp = ui-- .interact(lr, egui::Id::new(("tl-change-renderer", layer.id.0)), Sense::click())++ .interact(lr, egui::Id::unique(("tl-change-renderer", layer.id.0)), Sense::click()).on_hover_text(crate::i18n::tr("Composition Settings ▸ 3D Renderer"));if resp.hovered() {ctx.set_cursor_icon(egui::CursorIcon::PointingHand);@@@ -2618,8 -2667,8 +2671,8 @@@&& let GroupKind::Mask { mode, inverted, .. } = g.kind{let mr = Rect::from_min_size(pos2(cw.switches + 4.0, cy - 9.0), vec2(80.0, 18.0));-- let pop = egui::Id::new(("maskmode", uid));-- if widgets::dropdown(ui, mr, mode.label(), &t, egui::Id::new(("mm", uid))).clicked() {++ let pop = egui::Id::unique(("maskmode", uid));++ if widgets::dropdown(ui, mr, mode.label(), &t, egui::Id::unique(("mm", uid))).clicked() {widgets::open_popup(ui, pop);}let opts: Vec<String> = effectcraft_engine::project::MaskMode::ALL.iter().map(|m| m.label().to_string()).collect();@@@ -2627,13 -2676,13 +2680,13 @@@actions.push(("layer.setMask".into(), json!({"layer": layer.id.0, "mask": uid, "mode": opts[i]})));}let ir = Rect::from_min_size(pos2(mr.max.x + 8.0, cy - 8.0), vec2(16.0, 16.0));-- if widgets::checkbox(ui, ir, inverted, &t, egui::Id::new(("minv", uid))).clicked() {++ if widgets::checkbox(ui, ir, inverted, &t, egui::Id::unique(("minv", uid))).clicked() {actions.push(("layer.setMask".into(), json!({"layer": layer.id.0, "mask": uid, "inverted": !inverted})));}lp.text(pos2(ir.max.x + 4.0, cy), Align2::LEFT_CENTER, crate::i18n::tr("Inverted"), Tokens::ui(11.0), t.text_dim);}let gr_rect = Rect::from_min_max(pos2(indent + 8.0, r.min.y), pos2(cw.switches, r.max.y));-- let gr = ui.interact(gr_rect, egui::Id::new(("grow", uid)), Sense::click());++ let gr = ui.interact(gr_rect, egui::Id::unique(("grow", uid)), Sense::click());app.auto.add(&format!("timeline.group.{uid}.name"), gr_rect, name);if gr.clicked() && uid & (WAVE_BIT | GEOM_BIT) == 0 {actions.push(("prop.select".into(), json!({"layer": layer.id.0, "prop": uid, "selectKeys": false})));@@@ -2672,7 -2721,7 +2725,7 @@@RowKind::Expr { uid, lines } => {let Some(prop) = layer.props.find(*uid) else { continue };let Some(ex) = prop.expr.clone() else { continue };-- let (buf_id, edit_id) = (expr_buf_id(*uid), egui::Id::new(("expr-edit", uid)));++ let (buf_id, edit_id) = (expr_buf_id(*uid), egui::Id::unique(("expr-edit", uid)));// The same background as its property's row, selection included.let sel_prop = app.session.state.selected_props.contains(&(layer.id, *uid));lp.rect_filled(@@@ -2691,7 -2740,7 +2744,7 @@@lp.text(pos2(indent + 82.0, cy), Align2::LEFT_CENTER, &prop.name, Tokens::ui(11.5), t.text);// "=" enable switch and the property pick whip (AE's expression controls).let en_r = Rect::from_center_size(pos2(cw.switches + 10.0, cy), vec2(16.0, 16.0));-- let en = ui.interact(en_r, egui::Id::new(("expr-en", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Enable Expression"));++ let en = ui.interact(en_r, egui::Id::unique(("expr-en", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Enable Expression"));lp.rect_stroke(en_r.shrink(1.0), 2.0, Stroke::new(1.0, t.separator), StrokeKind::Inside);let expr_col = t.expr_text;lp.text(@@@ -2740,11 -2789,11 +2793,11 @@@{let wr = Rect::from_center_size(pos2(cw.switches + 50.0, cy), vec2(14.0, 14.0));lp.text(wr.center(), Align2::CENTER_CENTER, "⚠", Tokens::ui(12.0), Color32::from_rgb(0xf0, 0xa0, 0x30));-- let _ = ui.interact(wr, egui::Id::new(("expr-err", uid)), Sense::hover()).on_hover_text(e);++ let _ = ui.interact(wr, egui::Id::unique(("expr-err", uid)), Sense::hover()).on_hover_text(e);}// ⓕ: the Expression Language menu inserts at the cursor.let lang_r = Rect::from_center_size(pos2(cw.switches + 70.0, cy), vec2(16.0, 16.0));-- let lang = ui.interact(lang_r, egui::Id::new(("expr-lang", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Expression Language Menu"));++ let lang = ui.interact(lang_r, egui::Id::unique(("expr-lang", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Expression Language Menu"));lp.circle_stroke(lang_r.center(), 6.5, Stroke::new(1.0, if lang.hovered() { t.text } else { t.text_dim }));lp.text(lang_r.center(), Align2::CENTER_CENTER, "f", Tokens::semibold(10.0), if lang.hovered() { t.text } else { t.text_dim });app.auto.add(&format!("timeline.prop.{uid}.exprLanguage"), lang_r, "Expression Language Menu");@@@ -2796,7 -2848,7 +2852,7 @@@app.auto.add(&format!("timeline.prop.{uid}.expression"), er, &prop.name);// Its bottom edge drags to set its height in whole lines, as in After Effects.let edge = Rect::from_min_max(pos2(er.min.x, r.max.y - 4.0), pos2(er.max.x, r.max.y));-- let eresp = ui.interact(edge, egui::Id::new(("expr-edge", uid)), Sense::drag());++ let eresp = ui.interact(edge, egui::Id::unique(("expr-edge", uid)), Sense::drag());app.auto.add(&format!("timeline.prop.{uid}.expressionHeight"), edge, "Expression field height");if eresp.hovered() || eresp.dragged() {ctx.set_cursor_icon(egui::CursorIcon::ResizeVertical);@@@ -2852,17 -2904,17 +2908,17 @@@kc,Stroke::new(1.0, t.text_dim),));-- if ui.interact(prev, egui::Id::new(("kprev", uid)), Sense::click()).clicked()++ if ui.interact(prev, egui::Id::unique(("kprev", uid)), Sense::click()).clicked()&& let Some(k) = prop.keys.iter().rev().find(|k| layer.comp_time(k.time).0 < time.0 - fr.frame_duration().0 / 2){ui_actions.push(UiAct::SetTime(layer.comp_time(k.time)));}-- if ui.interact(next, egui::Id::new(("knext", uid)), Sense::click()).clicked()++ if ui.interact(next, egui::Id::unique(("knext", uid)), Sense::click()).clicked()&& let Some(k) = prop.keys.iter().find(|k| layer.comp_time(k.time).0 > time.0 + fr.frame_duration().0 / 2){ui_actions.push(UiAct::SetTime(layer.comp_time(k.time)));}-- if ui.interact(mid, egui::Id::new(("kmid", uid)), Sense::click()).clicked() {++ if ui.interact(mid, egui::Id::unique(("kmid", uid)), Sense::click()).clicked() {actions.push(("prop.toggleKey".into(), json!({"layer": layer.id.0, "prop": uid})));}app.auto.add(&format!("timeline.prop.{uid}.addKey"), mid, "Add or remove keyframe");@@@ -2871,7 -2923,7 +2927,7 @@@// dragging on over other stopwatches gives them the same state (#284).if !prop.static_only {let swr = Rect::from_center_size(pos2(indent, cy), vec2(15.0, 15.0));-- let resp = ui.interact(swr, egui::Id::new(("stopwatch", uid)), Sense::click_and_drag());++ let resp = ui.interact(swr, egui::Id::unique(("stopwatch", uid)), Sense::click_and_drag());let col = if prop.is_animated() {t.hot_text} else if resp.hovered() {@@@ -2899,14 -2960,14 +2964,14 @@@let pname = if prop.has_expression() { format!("{base} =") } else { base };lp.text(pos2(name_x, cy), Align2::LEFT_CENTER, &pname, Tokens::ui(12.0), if prop.has_expression() { t.expr_text } else { t.text });let name_rect = Rect::from_min_max(pos2(name_x, r.min.y), pos2(cw.switches - 2.0, r.max.y));-- let name_resp = ui.interact(name_rect, egui::Id::new(("pname", uid)), Sense::click_and_drag());++ let name_resp = ui.interact(name_rect, egui::Id::unique(("pname", uid)), Sense::click_and_drag());app.auto.add(&format!("timeline.prop.{uid}.name"), name_rect, &prop.name);if name_resp.drag_started() {// Drop on the Essential Graphics panel to expose the property.egui::DragAndDrop::set_payload(&ctx, crate::panels::DragPayload::Property { layer: layer.id.0, prop: *uid });}if name_resp.dragged() {-- egui::Tooltip::always_open(ctx.clone(), ui.layer_id(), egui::Id::new("prop-drag-tip"), egui::PopupAnchor::Pointer)++ egui::Tooltip::always_open(ctx.clone(), ui.layer_id(), egui::Id::unique("prop-drag-tip"), egui::PopupAnchor::Pointer).show(|ui| ui.label(&prop.name));}if name_resp.clicked() {@@@ -2973,7 -3034,7 +3038,7 @@@icons::keyframe(&gp, c, 11.0, icon.left, icon.right, kcol);}let kr = Rect::from_center_size(c, vec2(12.0, 14.0));-- let kresp = ui.interact(kr, egui::Id::new(("key", uid, k.time.0)), Sense::click_and_drag());++ let kresp = ui.interact(kr, egui::Id::unique(("key", uid, k.time.0)), Sense::click_and_drag());app.auto.add(&format!("timeline.key.{uid}.{}", fr.frame_at(ct)), kr, &format!("{} key", prop.name));// Exact (layer-time ticks): keys a Quick Offset puts on subframes can share a frame.app.auto.add(&format!("timeline.keyAt.{uid}.{}", k.time.0), kr, &format!("{} key", prop.name));@@@ -3143,12 -3204,12 +3208,12 @@@let box_rect = Rect::from_two_pos(start, end).intersect(outline_rect);lp.rect_filled(box_rect, 0.0, t.accent.gamma_multiply(0.12));lp.rect_stroke(box_rect, 0.0, Stroke::new(1.0, t.accent), StrokeKind::Inside);-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("tl-layer-box"), box_rect));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("tl-layer-box"), box_rect));}if outline_empty.drag_stopped()-- && let Some(box_rect) = ctx.data(|d| d.get_temp::<Rect>(egui::Id::new("tl-layer-box")))++ && let Some(box_rect) = ctx.data(|d| d.get_temp::<Rect>(egui::Id::unique("tl-layer-box"))){-- ctx.data_mut(|d| d.remove::<Rect>(egui::Id::new("tl-layer-box")));++ ctx.data_mut(|d| d.remove::<Rect>(egui::Id::unique("tl-layer-box")));let layers: Vec<u64> = hit_rows.iter().filter(|(r, row)| matches!(row.kind, RowKind::Layer) && r.intersects(box_rect))@@@ -3161,7 -3222,7 +3226,7 @@@// or a property's, also over a property in Effect Controls).if let Some((kind, src_layer, src_prop, start)) = ctx.data(|d| d.get_temp::<PickWhip>(pick_whip_id())) {let ptr = ctx.input(|i| i.pointer.latest_pos()).unwrap_or(start);-- let fg = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::new("tl-pickwhip-line")));++ let fg = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::unique("tl-pickwhip-line")));fg.line_segment([start, ptr], Stroke::new(1.5, t.accent));fg.circle_stroke(ptr, 4.0, Stroke::new(1.5, t.accent));let target = hit_rows.iter().find(|(r, _)| r.contains(ptr)).map(|(r, row)| (*r, row.clone()));@@@ -3236,7 -3297,7 +3301,7 @@@let br = Rect::from_two_pos(origin, cur);gp.rect_filled(br, 0.0, t.accent.gamma_multiply(0.12));gp.rect_stroke(br, 0.0, Stroke::new(1.0, t.accent), StrokeKind::Middle);-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("tl-box"), br));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("tl-box"), br));}// Layer reorder drag: a line where the layers will land; the release moves them there.if let Some(moving) = ctx.data(|d| d.get_temp::<Vec<u64>>(layer_drag_id())) {@@@ -3334,9 -3395,9 +3399,9 @@@}}if empty.drag_stopped()-- && let Some(br) = ctx.data(|d| d.get_temp::<Rect>(egui::Id::new("tl-box")))++ && let Some(br) = ctx.data(|d| d.get_temp::<Rect>(egui::Id::unique("tl-box"))){-- ctx.data_mut(|d| d.remove::<Rect>(egui::Id::new("tl-box")));++ ctx.data_mut(|d| d.remove::<Rect>(egui::Id::unique("tl-box")));let mut keys = vec![];let mut yy = rows_rect.min.y - app.ui.timeline.scroll_y;for row in &rows {@@@ -3396,7 -3457,7 +3461,7 @@@app.ui.timeline.scroll_y = widgets::scroll_bar(ui, &mut app.auto, "timeline.scroll", track, app.ui.timeline.scroll_y, max_scroll, &t);}let tgl = Rect::from_min_size(pos2(footer.min.x + 10.0, footer.min.y + 3.0), vec2(150.0, 18.0));-- let tresp = ui.interact(tgl, egui::Id::new("tl-toggle-modes"), Sense::click());++ let tresp = ui.interact(tgl, egui::Id::unique("tl-toggle-modes"), Sense::click());p.text(tgl.left_center(),Align2::LEFT_CENTER,@@@ -3427,7 -3488,7 +3492,7 @@@(Icon::MountainLarge, 16.0, zs.max.x + 14.0, "timeline.zoomInButton", "Zoom In (Time)", ZOOM_STEP),] {let r = Rect::from_center_size(pos2(cx, footer.center().y), vec2(20.0, 20.0));-- let resp = ui.interact(r, egui::Id::new(id), Sense::click()).on_hover_text(crate::i18n::tr(tip));++ let resp = ui.interact(r, egui::Id::unique(id), Sense::click()).on_hover_text(crate::i18n::tr(tip));icons::paint(&p, Rect::from_center_size(r.center(), vec2(size, size)), icon, if resp.hovered() { t.text } else { t.text_dim });app.auto.add(id, r, tip);if resp.clicked() {@@@ -3440,7 -3501,7 +3505,7 @@@let knob = pos2(zs.min.x + zs.width() * frac, zs.center().y);p.circle_filled(knob, 6.0, t.text);// Drag the knob, or click the track to jump there.-- let zresp = ui.interact(zs.expand2(vec2(6.0, 8.0)), egui::Id::new("tl-zoom"), Sense::click_and_drag());++ let zresp = ui.interact(zs.expand2(vec2(6.0, 8.0)), egui::Id::unique("tl-zoom"), Sense::click_and_drag());app.auto.add("timeline.zoomSlider", zs, "Zoom");if (zresp.dragged() || zresp.clicked())&& let Some(pt) = zresp.interact_pointer_pos()@@@ -3460,7 -3521,7 +3525,7 @@@// keys and markers there).if super::space_hand(&ctx) {let area = Rect::from_min_max(pos2(graph_x0, ruler.min.y), pos2(rect.max.x, rows_rect.max.y));-- let hand = ui.interact(area, egui::Id::new("tl-hand"), Sense::drag());++ let hand = ui.interact(area, egui::Id::unique("tl-hand"), Sense::drag());app.auto.add("timeline.hand", area, "Hand (hold Spacebar)");if hand.hovered() || hand.dragged() {ctx.set_cursor_icon(if hand.dragged() { egui::CursorIcon::Grabbing } else { egui::CursorIcon::Grab });@@@ -3658,7 -3719,7 +3723,7 @@@ fn layer_cellslet lid = layer.id.0;if cw.vis.comment {let cr = Rect::from_min_max(pos2(cw.comment + 4.0, r.min.y + 1.0), pos2(cw.comment + COMMENT_W - 4.0, r.max.y - 1.0));-- let edit_id = egui::Id::new("tl-comment-edit");++ let edit_id = egui::Id::unique("tl-comment-edit");let editing: Option<(u64, String)> = ctx.data(|d| d.get_temp(edit_id));app.auto.add(&format!("timeline.layer.{lid}.comment"), cr, &layer.comment);if let Some((el, mut buf)) = editing.filter(|(el, _)| *el == lid) {@@@ -3674,7 -3735,7 +3739,8 @@@ctx.data_mut(|d| d.insert_temp(edit_id, (el, buf)));}} else {-- let resp = ui.interact(cr, egui::Id::new(("tl-comment", lid)), Sense::click()).on_hover_text(crate::i18n::tr("Double-click to edit the comment"));++ let resp =++ ui.interact(cr, egui::Id::unique(("tl-comment", lid)), Sense::click()).on_hover_text(crate::i18n::tr("Double-click to edit the comment"));lp.with_clip_rect(cr.intersect(lp.clip_rect())).text(pos2(cr.min.x + 2.0, cy), Align2::LEFT_CENTER, &layer.comment, Tokens::ui(11.5), t.text_dim);if resp.double_clicked() {ctx.data_mut(|d| d.insert_temp(edit_id, (lid, layer.comment.clone())));@@@ -3692,14 -3753,18 +3758,18 @@@continue;}let cr = Rect::from_min_max(pos2(x + 2.0, r.min.y + 1.0), pos2(x + TIME_W - 2.0, r.max.y - 1.0));- let tc = crate::panels::timecode(&app.session, comp, Tick::from_seconds_f64(secs) - if kind == "duration" { comp.display_start } else { Tick(0) });- let resp = ui.interact(cr, egui::Id::new(("tl-cell", kind, lid)), Sense::drag()).on_hover_text(crate::i18n::tr("Drag to change"));+ let tc = if kind == "duration" {+ crate::panels::duration(&app.session, comp, Tick::from_seconds_f64(secs))+ } else {+ crate::panels::timecode(&app.session, comp, Tick::from_seconds_f64(secs))+ };- let resp = ui.interact(cr, egui::Id::new(("tl-cell", kind, lid)), Sense::drag()).on_hover_text(crate::i18n::tr("Drag to change"));++ let resp = ui.interact(cr, egui::Id::unique(("tl-cell", kind, lid)), Sense::drag()).on_hover_text(crate::i18n::tr("Drag to change"));lp.text(pos2(cr.min.x + 4.0, cy), Align2::LEFT_CENTER, &tc, Tokens::mono(11.0), if resp.hovered() || resp.dragged() { t.hot_text } else { t.timecode });app.auto.add(&format!("timeline.layer.{lid}.{kind}"), cr, &tc);if resp.hovered() || resp.dragged() {ctx.set_cursor_icon(egui::CursorIcon::ResizeHorizontal);}-- let acc_id = egui::Id::new(("tl-cell-acc", kind, lid));++ let acc_id = egui::Id::unique(("tl-cell-acc", kind, lid));if resp.dragged() {let mut acc: f32 = ctx.data(|d| d.get_temp(acc_id).unwrap_or(0.0));acc += resp.drag_delta().x;@@@ -3724,7 -3789,7 +3794,7 @@@if cw.vis.stretch {let cr = Rect::from_min_max(pos2(cw.stretch + 2.0, r.min.y + 1.0), pos2(cw.stretch + STRETCH_W - 2.0, r.max.y - 1.0));let label = format!("{:.1}%", layer.stretch * 100.0);-- let resp = ui.interact(cr, egui::Id::new(("tl-stretch", lid)), Sense::click()).on_hover_text(crate::i18n::tr("Time Stretch…"));++ let resp = ui.interact(cr, egui::Id::unique(("tl-stretch", lid)), Sense::click()).on_hover_text(crate::i18n::tr("Time Stretch…"));lp.text(pos2(cr.min.x + 4.0, cy), Align2::LEFT_CENTER, &label, Tokens::ui(11.5), if resp.hovered() { t.hot_text } else { t.text });app.auto.add(&format!("timeline.layer.{lid}.stretch"), cr, &label);if resp.clicked() {@@@ -3781,7 -3846,7 +3851,7 @@@ fn dash_buttons[("+", "shape.dashes.add", "Add a Dash or Gap"), ("\u{2212}", "shape.dashes.remove", "Remove a Dash or Gap")].into_iter().enumerate(){let r = Rect::from_center_size(pos2(x + 12.0 + i as f32 * 20.0, cy), vec2(16.0, 16.0));-- let resp = ui.interact(r, egui::Id::new(("tl-dash", uid, i)), Sense::click()).on_hover_text(tip);++ let resp = ui.interact(r, egui::Id::unique(("tl-dash", uid, i)), Sense::click()).on_hover_text(tip);p.rect_stroke(r.shrink(1.0), 2.0, Stroke::new(1.0, t.separator), StrokeKind::Inside);p.text(r.center(), Align2::CENTER_CENTER, sym, Tokens::ui(12.0), if resp.hovered() { t.text } else { t.text_dim });app.auto.add(&format!("timeline.group.{uid}.{}", if i == 0 { "addDash" } else { "removeDash" }), r, tip);@@@ -3842,10 -3907,10 +3912,10 @@@ fn shape_add_popupp.text(pos2(x + 6.0, cy), Align2::LEFT_CENTER, crate::i18n::tr("Add:"), Tokens::ui(11.5), t.text_dim);let br = Rect::from_center_size(pos2(x + 40.0, cy), vec2(16.0, 16.0));let resp =-- ui.interact(br, egui::Id::new(("tl-shapeadd", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Add a shape, fill, stroke or path operation"));++ ui.interact(br, egui::Id::unique(("tl-shapeadd", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Add a shape, fill, stroke or path operation"));icons::paint(p, br.shrink(3.0), Icon::ChevronRight, if resp.hovered() { t.text } else { t.text_dim });app.auto.add(&format!("timeline.group.{uid}.add"), br, "Add:");-- let pop = egui::Id::new(("tl-shapeadd-pop", uid));++ let pop = egui::Id::unique(("tl-shapeadd-pop", uid));if resp.clicked() {widgets::open_popup(ui, pop);}@@@ -3891,14 -3956,14 +3961,14 @@@ fn text_anim_popups};p.text(pos2(x + 6.0, cy), Align2::LEFT_CENTER, label, Tokens::ui(11.5), t.text_dim);let br = Rect::from_center_size(pos2(x + 6.0 + if key == "add" { 34.0 } else { 62.0 }, cy), vec2(16.0, 16.0));-- let resp = ui.interact(br, egui::Id::new(("tl-textanim", uid)), Sense::click()).on_hover_text(if key == "add" {++ let resp = ui.interact(br, egui::Id::unique(("tl-textanim", uid)), Sense::click()).on_hover_text(if key == "add" {"Add property or selector"} else {"Animate text"});icons::paint(p, br.shrink(3.0), Icon::ChevronRight, if resp.hovered() { t.text } else { t.text_dim });app.auto.add(&format!("timeline.group.{uid}.{key}"), br, label);-- let pop = egui::Id::new(("tl-textanim-pop", uid));++ let pop = egui::Id::unique(("tl-textanim-pop", uid));if resp.clicked() {widgets::open_popup(ui, pop);}@@@ -4274,7 -4339,7 +4344,7 @@@ fn value_editor_ => (-1e9, 1e9, 1, 1.0),};if matches!(prop.ui, ParamUi::Angle) {-- let (rr, dr, nv) = super::fx_widgets::angle_field(ui, pos2(x, y), egui::Id::new(("v", uid, 0)), *v, 1, &t);++ let (rr, dr, nv) = super::fx_widgets::angle_field(ui, pos2(x, y), egui::Id::unique(("v", uid, 0)), *v, 1, &t);app.auto.add(&format!("timeline.prop.{uid}.value"), dr, &prop.name);app.auto.add(&format!("timeline.prop.{uid}.revolutions"), rr, &prop.name);if let Some(nv) = nv {@@@ -4284,7 -4349,7 +4354,7 @@@// A Range Selector's Start, End and Offset count characters with Units = Index (#1814).let pct = (matches!(prop.ui, ParamUi::Percent) || prop.match_id == "opacity") && !effectcraft_engine::render::text::in_index_units(layer, uid);let suffix = if pct { "%" } else { "" };-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(x, y), egui::Id::new(("v", uid, 0)), *v, speed, (min, max), dec.max(1), suffix, &t);++ let (r, nv, _) = widgets::hot_number_at(ui, pos2(x, y), egui::Id::unique(("v", uid, 0)), *v, speed, (min, max), dec.max(1), suffix, &t);app.auto.add(&format!("timeline.prop.{uid}.value"), r, &prop.name);if let Some(nv) = nv {set(actions, json!(nv));@@@ -4303,7 -4368,7 +4373,7 @@@let linked = linkable && !app.ui.timeline.unlinked.contains(&uid);if linkable {let lr = Rect::from_center_size(pos2(x + 7.0, at.y), vec2(14.0, 14.0));-- let resp = ui.interact(lr, egui::Id::new(("tl-link", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Constrain Proportions"));++ let resp = ui.interact(lr, egui::Id::unique(("tl-link", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Constrain Proportions"));icons::paint(p, lr, Icon::Link, if linked { t.accent } else { t.text_faint });app.auto.add(&format!("timeline.prop.{uid}.link"), lr, "Constrain Proportions");if resp.clicked() && !app.ui.timeline.unlinked.remove(&uid) {@@@ -4313,7 -4378,7 +4383,8 @@@}for d in 0..n.min(c.len()) {let suffix = if pct && d + 1 == n { "%" } else { "" };-- let (r, nv, _) = widgets::hot_number_at(ui, pos2(x, y), egui::Id::new(("v", uid, d)), c[d], if pct { 0.5 } else { 1.0 }, range, 1, suffix, &t);++ let (r, nv, _) =++ widgets::hot_number_at(ui, pos2(x, y), egui::Id::unique(("v", uid, d)), c[d], if pct { 0.5 } else { 1.0 }, range, 1, suffix, &t);app.auto.add(&format!("timeline.prop.{uid}.value.{d}"), r, &prop.name);dims.push(r);if let Some(nv) = nv {@@@ -4342,9 -4407,9 +4413,9 @@@}Value::Color(c) => {let r = Rect::from_min_size(pos2(x, at.y - 7.0), vec2(26.0, 14.0));-- let resp = widgets::swatch(ui, r, [c[0] as f32, c[1] as f32, c[2] as f32, 1.0], egui::Id::new(("sw", uid)), &t);++ let resp = widgets::swatch(ui, r, [c[0] as f32, c[1] as f32, c[2] as f32, 1.0], egui::Id::unique(("sw", uid)), &t);app.auto.add(&format!("timeline.prop.{uid}.value"), r, &prop.name);-- let pop = egui::Id::new(("cpop", uid));++ let pop = egui::Id::unique(("cpop", uid));if resp.clicked() {widgets::open_popup(ui, pop);}@@@ -4352,7 -4417,7 +4423,7 @@@// Stroke colours, text and effect colours), as in After Effects' Timeline (#633).let er = Rect::from_center_size(pos2(r.max.x + 12.0, at.y), vec2(16.0, 16.0));let active = app.ui.fx_pick.as_ref().is_some_and(|k| k.prop == uid && k.kind == "color");-- if super::fx_widgets::eyedropper_button(ui, er, active, egui::Id::new(("tl-eye", uid)), &t)++ if super::fx_widgets::eyedropper_button(ui, er, active, egui::Id::unique(("tl-eye", uid)), &t).on_hover_text(crate::i18n::tr("Eyedropper: click, then click in the Composition panel")).clicked(){@@@ -4366,7 -4431,7 +4437,7 @@@}Value::Bool(b) => {let r = Rect::from_min_size(pos2(x, at.y - 8.0), vec2(16.0, 16.0));-- if widgets::checkbox(ui, r, *b, &t, egui::Id::new(("cb", uid))).clicked() {++ if widgets::checkbox(ui, r, *b, &t, egui::Id::unique(("cb", uid))).clicked() {set(actions, json!(!b));}app.auto.add(&format!("timeline.prop.{uid}.value"), r, &prop.name);@@@ -4382,8 -4447,8 +4453,8 @@@if let ParamUi::Popup { options } = ui_opts.as_ref().unwrap_or(&prop.ui) {let r = Rect::from_min_size(pos2(x, at.y - 9.0), vec2(150.0, 18.0));let label = options.get(*i as usize).cloned().unwrap_or_default();-- let pop = egui::Id::new(("epop", uid));-- if widgets::dropdown(ui, r, &label, &t, egui::Id::new(("en", uid))).clicked() {++ let pop = egui::Id::unique(("epop", uid));++ if widgets::dropdown(ui, r, &label, &t, egui::Id::unique(("en", uid))).clicked() {widgets::open_popup(ui, pop);}app.auto.add(&format!("timeline.prop.{uid}.value"), r, &prop.name);@@@ -4399,18 -4464,21 +4470,21 @@@}Value::Text(_) => {}Value::Layer(l) => {- p.text(- pos2(x, at.y),- Align2::LEFT_CENTER,- l.map(|l| crate::i18n::tr_args("Layer {}", &[&l])).unwrap_or(crate::i18n::tr("None").into()),- Tokens::ui(12.0),- t.hot_text,- );+ // Layer references (a light's Source, a Displacement Map's layer…) pick from the+ // comp's layers, as in Effect Controls; the choice is written through the same+ // undoable prop.set as the other value arms.+ let r = Rect::from_min_size(pos2(x, at.y - 9.0), vec2(150.0, 18.0));+ if let Some(comp) = app.session.active_comp_arc()- && let Some(chosen) = widgets::layer_picker(ui, r, &comp.layers, *l, &t, egui::Id::new(("tl-lay", uid)))++ && let Some(chosen) = widgets::layer_picker(ui, r, &comp.layers, *l, &t, egui::Id::unique(("tl-lay", uid)))+ {+ set(actions, chosen.map(|id| json!(id)).unwrap_or(serde_json::Value::Null));+ }+ app.auto.add(&format!("timeline.prop.{uid}.value"), r, &prop.name);}Value::Gradient(_) => {// Opens the Gradient Editor at the current time (#612).let r = p.text(pos2(x, at.y), Align2::LEFT_CENTER, crate::i18n::tr("Edit Gradient…"), Tokens::ui(12.0), t.hot_text);-- let resp = ui.interact(r.expand(2.0), egui::Id::new(("gradient-edit", uid)), Sense::click());++ let resp = ui.interact(r.expand(2.0), egui::Id::unique(("gradient-edit", uid)), Sense::click());if resp.hovered() {ui.ctx().set_cursor_icon(egui::CursorIcon::PointingHand);}diff --cc crates/ui-egui/src/panels/tracker.rsindex bd54625b8,bd54625b8..2013d4daf--- a/crates/ui-egui/src/panels/tracker.rs+++ b/crates/ui-egui/src/panels/tracker.rs@@@ -52,7 -52,7 +52,7 @@@ fn current(app: &EffectcraftApp) -> Opt}fn source_id() -> egui::Id {-- egui::Id::new("tracker-motion-source")++ egui::Id::unique("tracker-motion-source")}/// Motion Source: the current track's layer, the chosen source, or the selected layer.@@@ -88,7 -88,7 +88,7 @@@ fn button(app: &mut EffectcraftApp, uiui.painter().text(r.center(), Align2::CENTER_CENTER, text, Tokens::medium(12.0), t.text_faint);return false;}-- widgets::text_button(ui, r, text, false, &t, egui::Id::new(id)).clicked()++ widgets::text_button(ui, r, text, false, &t, egui::Id::unique(id)).clicked()}fn run(app: &mut EffectcraftApp, ctx: &egui::Context, cmd: &str, p: serde_json::Value) {@@@ -170,7 -170,7 +170,7 @@@ pub fn show(app: &mut EffectcraftApp, ucomp.layers.iter().enumerate().filter(|(_, l)| trackable(l)).map(|(i, l)| (l.id, format!("{}. {}", i + 1, l.name))).collect();let dd = Rect::from_min_size(pos2(field_x, y), vec2(field_w, 20.0));let name = source.and_then(|s| srcs.iter().find(|(l, _)| *l == s)).map(|(_, n)| n.clone()).unwrap_or_else(|| "None".into());-- let did = egui::Id::new("tracker-source-dd");++ let did = egui::Id::unique("tracker-source-dd");if widgets::dropdown(ui, dd, &name, &t, did).clicked() {widgets::open_popup(ui, did);}@@@ -195,7 -195,7 +195,7 @@@source.and_then(|s| comp.layer(s)).map(|l| l.trackers().map(|(g, _)| (g.uid, g.name.clone())).collect()).unwrap_or_default();let dd = Rect::from_min_size(pos2(field_x, y), vec2(field_w, 20.0));let cname = cur.and_then(|(_, u)| trackers.iter().find(|(g, _)| *g == u)).map(|(_, n)| n.clone()).unwrap_or_else(|| "None".into());-- let did = egui::Id::new("tracker-current-dd");++ let did = egui::Id::unique("tracker-current-dd");if widgets::dropdown(ui, dd, &cname, &t, did).clicked() && !trackers.is_empty() {widgets::open_popup(ui, did);}@@@ -226,7 -226,7 +226,7 @@@label(&p, pos2(x0, y + 10.0), "Track Type:", &t);let dd = Rect::from_min_size(pos2(field_x, y), vec2(field_w, 20.0));let kind = settings.as_ref().map(|s| s.kind).unwrap_or_default();-- let did = egui::Id::new("tracker-type-dd");++ let did = egui::Id::unique("tracker-type-dd");if widgets::dropdown(ui, dd, if enabled { kind.label() } else { "" }, &t, did).clicked() && enabled {widgets::open_popup(ui, did);}@@@ -246,7 -246,7 +246,7 @@@("scale", "Scale", settings.as_ref().is_some_and(|s| s.scale)),] {let cr = Rect::from_min_size(pos2(xx, y + 2.0), vec2(16.0, 16.0));-- let resp = widgets::checkbox(ui, cr, on && transformish, &t, egui::Id::new(("tracker-cb", key)));++ let resp = widgets::checkbox(ui, cr, on && transformish, &t, egui::Id::unique(("tracker-cb", key)));app.auto.add(&format!("tracker.{key}"), cr, text);p.text(pos2(cr.max.x + 4.0, cr.center().y), Align2::LEFT_CENTER, text, Tokens::ui(12.0), if transformish { t.text } else { t.text_faint });if resp.clicked() && transformish {@@@ -294,7 -294,7 +294,7 @@@(effectcraft_engine::tracking::Direction::FrameForward, true, true, "frameForward", "Analyze 1 frame forward"),] {let r = Rect::from_min_size(pos2(bx, y), vec2(30.0, 22.0));-- let resp = ui.interact(r, egui::Id::new(("tracker-analyze", id)), Sense::click()).on_hover_text(tip);++ let resp = ui.interact(r, egui::Id::unique(("tracker-analyze", id)), Sense::click()).on_hover_text(tip);let stop = tracking && running_dir == Some(dir) && !frame;let on = enabled && (!tracking || stop);p.rect_filled(r, 4.0, if resp.hovered() && on { t.hover } else { t.field_bg });@@@ -366,7 -366,7 +366,7 @@@ fn mask_mode(app: &mut EffectcraftApp,label(p, pos2(x0, y + 10.0), "Method:", &t);let method = app.session.state.mask_track_method;let dd = Rect::from_min_size(pos2(field_x, y), vec2(field_w, 20.0));-- let did = egui::Id::new("tracker-mask-method-dd");++ let did = egui::Id::unique("tracker-mask-method-dd");if widgets::dropdown(ui, dd, method.label(), &t, did).clicked() {widgets::open_popup(ui, did);}@@@ -387,7 -387,7 +387,7 @@@(effectcraft_engine::tracking::Direction::FrameForward, true, true, "frameForward", "Track selected masks 1 frame forward"),] {let r = Rect::from_min_size(pos2(bx, y), vec2(30.0, 22.0));-- let resp = ui.interact(r, egui::Id::new(("tracker-mask-track", id)), Sense::click()).on_hover_text(tip);++ let resp = ui.interact(r, egui::Id::unique(("tracker-mask-track", id)), Sense::click()).on_hover_text(tip);let stop = running && running_dir == Some(dir) && !frame;let on = !running || stop;p.rect_filled(r, 4.0, if resp.hovered() && on { t.hover } else { t.field_bg });diff --cc crates/ui-egui/src/panels/viewer.rsindex 61e7336f9,ce15f9222..f43518bab--- a/crates/ui-egui/src/panels/viewer.rs+++ b/crates/ui-egui/src/panels/viewer.rs@@@ -38,7 -38,7 +38,7 @@@ impl ViewerMap}fn map_id() -> egui::Id {-- egui::Id::new("viewer-map")++ egui::Id::unique("viewer-map")}pub fn comp_to_screen(ctx: &egui::Context, p: [f32; 2]) -> Option<Pos2> {@@@ -53,7 -53,7 +53,7 @@@ pub fn screen_to_comp(ctx: &egui::Conte/// The fit magnification from the last frame.pub fn last_fit(ctx: &egui::Context) -> f32 {-- ctx.data(|d| d.get_temp::<f32>(egui::Id::new("viewer-fit"))).unwrap_or(0.5)++ ctx.data(|d| d.get_temp::<f32>(egui::Id::unique("viewer-fit"))).unwrap_or(0.5)}/// What a drag in the viewer is doing.@@@ -207,7 -207,7 +207,7 @@@ enum Gesture/// Pen tool path in progress: (layer, mask uid).fn pen_id() -> egui::Id {-- egui::Id::new("viewer-pen")++ egui::Id::unique("viewer-pen")}use super::viewer_overlays::{self as ov, VertexHit};@@@ -610,7 -610,7 +610,7 @@@ fn aux_views(app.session.revision, cid.0, t.0, i, scale.to_bits(), format!("{cam:?}")).hash(&mut h);h.finish()};-- let id = egui::Id::new(("viewer-aux", i));++ let id = egui::Id::unique(("viewer-aux", i));let cached: Option<(u64, egui::TextureHandle)> = ctx.data(|d| d.get_temp(id));let tex = match cached {Some((k, tex)) if k == key => tex,@@@ -662,7 -662,7 +662,7 @@@fn pane_selector(app: &mut EffectcraftApp, ui: &mut egui::Ui, pane: usize, area: Rect, current: View3D) -> Option<View3D> {let t = app.tokens;let r = Rect::from_min_size(area.min + vec2(6.0, 6.0), vec2(124.0, 20.0));-- let pid = egui::Id::new(("viewer-pane-view", pane));++ let pid = egui::Id::unique(("viewer-pane-view", pane));let response = widgets::dropdown(ui, r, crate::i18n::tr(current.label()), &t, pid);if response.clicked() {let open = widgets::popup_is_open(ui, pid);@@@ -717,7 -717,7 +717,7 @@@ fn locked_pane(app: &mut EffectcraftApp(app.session.revision, lv.comp.0, t.0, scale.to_bits(), dc_key).hash(&mut h);h.finish()};-- let id = egui::Id::new("viewer-locked");++ let id = egui::Id::unique("viewer-locked");let cached: Option<(u64, egui::TextureHandle)> = ctx.data(|d| d.get_temp(id));let tex = match cached {Some((k, tex)) if k == key => tex,@@@ -744,7 -744,7 +744,7 @@@app.auto.add("viewer.locked", r, &label);// Close the locked viewer.let close = Rect::from_min_size(pos2(r.max.x - 26.0, r.min.y + 4.0), vec2(20.0, 20.0));-- let resp = ui.interact(close, egui::Id::new("viewer-locked-close"), Sense::click());++ let resp = ui.interact(close, egui::Id::unique("viewer-locked-close"), Sense::click());p.text(close.center(), Align2::CENTER_CENTER, "\u{00d7}", Tokens::ui(14.0), if resp.hovered() { Color32::WHITE } else { Color32::from_white_alpha(170) });app.auto.add("viewer.locked.close", close, "Close Locked Viewer");if resp.clicked() {@@@ -793,7 -793,7 +793,7 @@@ pub fn show(app: &mut EffectcraftApp, ulet name = app.session.project.item(oc).map(|i| i.name.clone()).unwrap_or_default();let g = p.layout_no_wrap(name.clone(), Tokens::ui(11.5), t.text);let r = Rect::from_min_size(pos2(x, nav.min.y + 3.0), vec2(g.size().x + 16.0, 18.0));-- let resp = ui.interact(r, egui::Id::new(("nav", oc.0)), Sense::click());++ let resp = ui.interact(r, egui::Id::unique(("nav", oc.0)), Sense::click());let active = oc == cid;p.rect_filled(r,@@@ -835,7 -835,7 +835,7 @@@let fit = ((area.width() - 40.0) / cw).min((area.height() - 40.0) / ch).max(0.01);// Fit up to 100% follows the panel's size like Fit does, and stops at 100%.let fit = if app.ui.viewer.fit_up_to_100 { fit.min(1.0 / ctx.pixels_per_point()) } else { fit };-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("viewer-fit"), fit));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("viewer-fit"), fit));let zoom = app.ui.viewer.zoom.unwrap_or(fit);let center = area.center() + vec2(app.ui.viewer.pan[0], app.ui.viewer.pan[1]);// On the physical pixel grid, so at 100 % every comp pixel covers exactly one screen pixel@@@ -856,7 -856,7 +856,7 @@@// Queue the frame on screen before any prefetch.app.request_frame_urgent(cid, comp.frame_rate.frame_at(app.session.time()), scale);}-- crate::tick_playback(app, &ctx, scale);++ crate::note_viewer_scale(app, scale);let time = app.session.time();let frame = comp.frame_rate.frame_at(time);let key = app.frame_key(cid, frame, scale);@@@ -1271,8 -1274,8 +1274,8 @@@super::viewer_drop::show(app, ui, &painter, &map, &ectx);// Interaction.-- let resp = ui.interact(area, egui::Id::new("viewer-interact"), Sense::click_and_drag());-- let menu_hits_id = egui::Id::new(("viewer-menu-hits", cid.0));++ let resp = ui.interact(area, egui::Id::unique("viewer-interact"), Sense::click_and_drag());++ let menu_hits_id = egui::Id::unique(("viewer-menu-hits", cid.0));if resp.secondary_clicked()&& let Some(pos) = resp.interact_pointer_pos(){@@@ -1340,7 -1343,7 +1343,7 @@@let reach = vertex_grab_radius(pos, handle_hits.iter().map(|(_, _, h, _)| *h));vertex_hits.iter().rev().filter(|h| h.tangent.is_some() == tangents).find(|h| h.pos.distance(pos) < reach).copied()};-- let gid = egui::Id::new("viewer-gesture");++ let gid = egui::Id::unique("viewer-gesture");// An overlay on top of the viewer (e.g. the camera tracker points) takes the hover, but the pointer is still over the viewer: keep wheel zoom working.let hover_pos = resp.hover_pos().or_else(|| if resp.contains_pointer() { ui.input(|i| i.pointer.hover_pos()) } else { None });if let Some(hp) = hover_pos {@@@ -1368,7 -1371,7 +1371,7 @@@Tool::ObjectMatte => {// The tool draws its own crosshair (and the layer it would matte) while no box// is being dragged.-- if ui.data(|d| d.get_temp::<Gesture>(egui::Id::new("viewer-gesture"))).is_none() {++ if ui.data(|d| d.get_temp::<Gesture>(egui::Id::unique("viewer-gesture"))).is_none() {super::object_matte_tool::hover(app, &painter, &map, &ectx, hp);}egui::CursorIcon::None@@@ -1428,10 -1431,10 +1431,10 @@@}// A pen click (press + release without a drag) ends its tangent gesture on release.if ui.input(|i| i.pointer.primary_released())-- && matches!(ui.data(|d| d.get_temp::<Gesture>(egui::Id::new("viewer-gesture"))), Some(Gesture::Pen { .. }))++ && matches!(ui.data(|d| d.get_temp::<Gesture>(egui::Id::unique("viewer-gesture"))), Some(Gesture::Pen { .. }))&& !resp.drag_stopped(){-- ui.data_mut(|d| d.remove::<Gesture>(egui::Id::new("viewer-gesture")));++ ui.data_mut(|d| d.remove::<Gesture>(egui::Id::unique("viewer-gesture")));}// On-canvas text editing (Type tool, double-click a text layer) owns its clicks and drags.let text_owns = super::viewer_text::hook(app, ui, &painter, &map, &ectx, &resp, space_pan);@@@ -1651,7 -1654,7 +1654,7 @@@let gesture: Option<Gesture> = ui.data(|d| d.get_temp(gid));if let (Some(g), Some(pos)) = (gesture.clone(), resp.interact_pointer_pos()) {let cpt = map.to_comp(pos);-- let merge = format!("viewer-drag-{}", ui.data(|d| d.get_temp::<u64>(egui::Id::new("viewer-drag-n")).unwrap_or(0)));++ let merge = format!("viewer-drag-{}", ui.data(|d| d.get_temp::<u64>(egui::Id::unique("viewer-drag-n")).unwrap_or(0)));match g {Gesture::Pan { start_pan } => {// No total drag on the release frame: keep the pan reached so far (it used to@@@ -1919,8 -1922,8 +1922,8 @@@}ui.data_mut(|d| {d.remove::<Gesture>(gid);-- let n: u64 = d.get_temp(egui::Id::new("viewer-drag-n")).unwrap_or(0);-- d.insert_temp(egui::Id::new("viewer-drag-n"), n + 1);++ let n: u64 = d.get_temp(egui::Id::unique("viewer-drag-n")).unwrap_or(0);++ d.insert_temp(egui::Id::unique("viewer-drag-n"), n + 1);});}if resp.clicked()@@@ -2079,7 -2082,7 +2082,7 @@@let r = Rect::from_min_size(area.min + vec2(10.0, 10.0), vec2(330.0, 22.0));painter.rect_filled(r, 11.0, Color32::from_black_alpha(190));painter.text(r.center(), Align2::CENTER_CENTER, crate::i18n::tr("Video preview is off (Preview panel): audio only"), Tokens::ui(11.5), t.timecode);-- ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("viewer-video-off-chip"), r));++ ui.ctx().data_mut(|d| d.insert_temp(egui::Id::unique("viewer-video-off-chip"), r));}vt::draw_snap(&ctx, &painter, &map, &ectx);@@@ -2258,7 -2261,7 +2261,7 @@@ fn pen_cursor(ctx: &egui::Context, at:Icon::PenConvert => vec2(8.0, 3.5),_ => vec2(8.0, 1.8),};-- let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::new("viewer-pen-cursor")));++ let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("viewer-pen-cursor")));let rect = Rect::from_min_size(at - tip, vec2(16.0, 16.0));for d in [vec2(-1.0, 0.0), vec2(1.0, 0.0), vec2(0.0, -1.0), vec2(0.0, 1.0)] {crate::icons::paint(&painter, rect.translate(d), icon, Color32::BLACK);@@@ -2278,7 -2281,7 +2281,7 @@@ fn pen_pressmods: egui::Modifiers,) {use effectcraft_engine::project::LayerSource;-- let gid = egui::Id::new("viewer-gesture");++ let gid = egui::Id::unique("viewer-gesture");let current: Option<(LayerId, u64)> = ui.data(|d| d.get_temp(pen_id()));let c0 = map.to_comp(pos);let corr = vt::snap(app, ui.ctx(), ectx, map, &[], &[c0], mods);@@@ -2604,12 -2607,12 +2607,12 @@@ fn empty_state(app: &mut EffectcraftApplet c = rect.center();p.text(c - vec2(0.0, 40.0), Align2::CENTER_CENTER, crate::i18n::tr("Composition"), Tokens::semibold(16.0), t.text);let b1 = Rect::from_center_size(c + vec2(0.0, 0.0), vec2(220.0, 30.0));-- if widgets::text_button(ui, b1, "New Composition", true, &t, egui::Id::new("empty-newcomp")).clicked() {++ if widgets::text_button(ui, b1, "New Composition", true, &t, egui::Id::unique("empty-newcomp")).clicked() {crate::panels::dialogs::open_new_comp(app);}app.auto.add("viewer.empty.newComp", b1, "New Composition");let b2 = Rect::from_center_size(c + vec2(0.0, 40.0), vec2(220.0, 30.0));-- if widgets::text_button(ui, b2, "New Composition From Footage", false, &t, egui::Id::new("empty-fromfootage")).clicked() {++ if widgets::text_button(ui, b2, "New Composition From Footage", false, &t, egui::Id::unique("empty-fromfootage")).clicked() {let _ = crate::menus::invoke(app, &ui.ctx().clone(), "file.import", json!({}));}app.auto.add("viewer.empty.import", b2, "New Composition From Footage");diff --cc crates/ui-egui/src/panels/viewer_overlays.rsindex 9117103d5,9117103d5..fea6bf78b--- a/crates/ui-egui/src/panels/viewer_overlays.rs+++ b/crates/ui-egui/src/panels/viewer_overlays.rs@@@ -394,7 -394,7 +394,7 @@@ pub(crate) fn motion_path// ---------------------------------------------------------------- free transformfn ft_id() -> egui::Id {-- egui::Id::new("viewer-free-transform")++ egui::Id::unique("viewer-free-transform")}/// Enter Free Transform on a path (double-click a path with the Selection tool).diff --cc crates/ui-egui/src/panels/viewer_text.rsindex 57b34b29d,c7169f416..cef0cefb8--- a/crates/ui-egui/src/panels/viewer_text.rs+++ b/crates/ui-egui/src/panels/viewer_text.rs@@@ -14,7 -14,7 +14,7 @@@//! Every change runs an engine command (`text.*`, `layer.setText`, `edit.*`), so it's undoable and//! agents can do the same over the control channel.--use effectcraft_engine::commands::text_edit::layer_doc;++use effectcraft_engine::commands::text_edit::{ImeSurrounding, MAX_IME_TEXT_BYTES, ime_surrounding, layer_doc};use effectcraft_engine::geom::{Mat3, vec2 as gv2};use effectcraft_engine::keyframe::{Kerning, TextDoc};use effectcraft_engine::project::{Layer, LayerId, LayerSource};@@@ -41,10 -41,10 +41,576 @@@ enum Drag}fn drag_id() -> egui::Id {-- egui::Id::new("viewer-text-drag")++ egui::Id::unique("viewer-text-drag")}fn focus_id() -> egui::Id {-- egui::Id::new("viewer-text-focus")++ egui::Id::unique("viewer-text-focus")++}++++/// The immutable identity of one text-edit IME target.++///++/// The layer and the edit-session token are the whole owner. Caret, selection, text, revision++/// and geometry are deliberately absent: ordinary IME edits keep this identity. Application caret++/// changes interrupt the composition separately, without replacing this immutable target.++#[derive(Clone, Copy, Debug, PartialEq, Eq)]++struct ImeOwner {++ layer: LayerId,++ session: u64,++}++++/// Last accepted selection for this viewport, separate from immutable target identity.++/// IME deletes/commits advance it; application changes invalidate a live composition first.++#[derive(Clone, Copy, Debug, PartialEq, Eq)]++struct ImeSelection {++ owner: ImeOwner,++ anchor: usize,++ caret: usize,++}++++/// One viewport's visible IME pre-edit.++///++/// The text is only a drawing preview; it never enters the document. Its owner identifies the++/// composition that produced it, so a preview can never survive a target switch.++#[derive(Clone, Debug)]++struct Preedit {++ owner: ImeOwner,++ text: String,++}++++/// The input-method composition currently in flight for one viewport.++///++/// `TerminalPending` is an observed empty pre-edit: the input method cleared the visible++/// composition, but its terminal commit/delete is a separate event and may still arrive. Keeping++/// the owner means a target switch turns that state into `Stale`, so the pending old terminal event++/// is rejected instead of being applied to the replacement.++///++/// `Stale` rejects an interrupted composition until its exact request-bound completion. Old++/// terminals, empty/nonempty preedit and idle frames never acknowledge cancellation.++#[derive(Clone, Copy, Debug, PartialEq, Eq)]++enum ImeComposition {++ Active(ImeOwner),++ TerminalPending(ImeOwner),++ Stale,++}++++#[derive(Clone, Copy, Debug, PartialEq, Eq)]++struct OutputContext(egui::Id, u64, egui::IMEPurpose);++++impl From<&egui::output::IMEOutput> for OutputContext {++ fn from(output: &egui::output::IMEOutput) -> Self {++ Self(output.owner, output.context_generation, output.purpose)++ }++}++++#[derive(Clone, Debug)]++struct ResetGuard {++ request: Option<egui::ImeResetId>,++ destination: Option<ImeSelection>,++ committed: egui::ImeMutationStamp,++ output: Option<OutputContext>,++ suspended: bool,++}++++fn reset_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("effectcraft.ime.reset", viewport))++}++fn mode_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("effectcraft.ime.ui-pass", viewport))++}++fn committed_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("effectcraft.ime.committed", viewport))++}++fn input_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("effectcraft.ime.input-frame", viewport))++}++fn admission_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("effectcraft.ime.can-request", viewport))++}++++fn set_admission(ctx: &egui::Context, allowed: bool) {++ let id = admission_id(ctx.viewport_id());++ ctx.data_mut(|data| data.insert_temp(id, allowed));++}++++fn window_available(ctx: &egui::Context) -> bool {++ ctx.input(|input| {++ input.focused && input.viewport().focused.unwrap_or(true) && input.viewport().minimized != Some(true) && input.viewport().occluded != Some(true)++ })++}++++pub(crate) fn install_hooks(ctx: &egui::Context) {++ let id = egui::Id::unique("effectcraft.ime.hooks-installed");++ let first = ctx.data_mut(|data| {++ if data.get_temp::<bool>(id).unwrap_or(false) {++ false++ } else {++ data.insert_temp(id, true);++ true++ }++ });++ if !first {++ return;++ }++ ctx.on_begin_pass(++ "EffectCraft IME pass begin",++ std::sync::Arc::new(|ui| {++ let id = mode_id(ui.ctx().viewport_id());++ ui.ctx().data_mut(|data| data.insert_temp(id, true));++ }),++ );++ ctx.on_end_pass(++ "EffectCraft IME pass end",++ std::sync::Arc::new(|ui| {++ let id = mode_id(ui.ctx().viewport_id());++ ui.ctx().data_mut(|data| data.insert_temp(id, false));++ }),++ );++}++++fn read_reset(ctx: &egui::Context) -> Option<ResetGuard> {++ let id = reset_id(ctx.viewport_id());++ ctx.data(|data| data.get_temp(id))++}++++fn request_reset_with_output(app: &EffectcraftApp, ctx: &egui::Context, output: Option<OutputContext>) {++ let viewport = ctx.viewport_id();++ let allowed = ctx.data(|data| data.get_temp::<bool>(admission_id(viewport)).unwrap_or(false));++ let request = if allowed { ctx.request_ime_reset(viewport) } else { None };++ let guard = ResetGuard { request, destination: ime_selection(app), committed: ime_stamp(app, ctx), output, suspended: !allowed };++ ctx.data_mut(|data| {++ data.insert_temp(reset_id(viewport), guard);++ data.insert_temp(ime_composition_id(viewport), ImeComposition::Stale);++ });++}++++fn request_reset(app: &EffectcraftApp, ctx: &egui::Context) {++ let output = read_reset(ctx).and_then(|guard| guard.output);++ request_reset_with_output(app, ctx, output);++}++++fn sync_reset(app: &EffectcraftApp, ctx: &egui::Context) {++ if let Some(guard) = read_reset(ctx)++ && !guard.suspended++ && (guard.destination != ime_selection(app) || guard.committed != ime_stamp(app, ctx))++ {++ request_reset(app, ctx);++ }++}++++fn suspend_reset(ctx: &egui::Context) {++ if let Some(mut guard) = read_reset(ctx) {++ guard.request = None;++ guard.suspended = true;++ let id = reset_id(ctx.viewport_id());++ ctx.data_mut(|data| data.insert_temp(id, guard));++ }++}++++fn complete_reset(app: &EffectcraftApp, ui: &egui::Ui, request: egui::ImeResetId) {++ if !read_reset(ui.ctx()).is_some_and(|guard| !guard.suspended && guard.request == Some(request)) {++ return;++ }++ sync_ime_target(ui, app);++ sync_ime_selection(ui, app);++ let ctx = ui.ctx();++ let viewport = ctx.viewport_id();++ if read_reset(ctx).is_some_and(|guard| {++ !guard.suspended++ && guard.request == Some(request)++ && request.viewport_id() == viewport++ && guard.destination == ime_selection(app)++ && guard.committed == ime_stamp(app, ctx)++ }) {++ ctx.data_mut(|data| data.remove::<ResetGuard>(reset_id(viewport)));++ set_ime_composition(ui, None);++ clear_preedit(ui);++ remember_ime_selection(ui, app);++ }++}++++fn unavailable_controls(ui: &egui::Ui) {++ suspend_reset(ui.ctx());++ // No custom mutation route runs here, so controls can only be obsolete. Stock text/keys++ // remain in place for their actual TextEdit owner.++ ui.ctx().input_mut(|input| input.events.retain(|event| !matches!(event, egui::Event::ImeResetCompleted { .. })));++}++++pub(crate) fn begin_ui(ctx: &egui::Context) {++ set_admission(ctx, false);++ let id = ime_geometry_id(ctx.viewport_id());++ ctx.data_mut(|data| data.remove::<ImeGeometry>(id));++}++++pub(crate) fn finish_logic(app: &EffectcraftApp, ctx: &egui::Context) {++ let id = mode_id(ctx.viewport_id());++ if !ctx.data(|data| data.get_temp::<bool>(id).unwrap_or(false)) {++ set_admission(ctx, false);++ sync_reset(app, ctx);++ suspend_reset(ctx);++ }++}++++type ImeGeometry = (u64, egui::Rect, egui::Rect);++type SurroundingKey = (u64, u64, u64, u64, usize, usize, i64);++++#[derive(Clone, Debug)]++struct SurroundingCache {++ key: SurroundingKey,++ value: Option<ImeSurrounding>,++}++++fn ime_preedit_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-preedit", viewport))++}++fn ime_composition_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-ime-composition", viewport))++}++fn ime_geometry_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-ime-geometry", viewport))++}++fn ime_seen_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-seen", viewport))++}++fn ime_target_seen_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-ime-target", viewport))++}++fn ime_selection_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-ime-selection", viewport))++}++fn ime_last_context_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-ime-last-context", viewport))++}++fn ime_surrounding_cache_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-ime-surrounding", viewport))++}++fn typing_key_id(viewport: egui::ViewportId) -> egui::Id {++ egui::Id::unique(("viewer-text-typing", viewport))++}++++/// The immutable IME owner of the current edit session.++///++/// The comp/layer target identity survives ordinary edits and caret moves. The edit session++/// token distinguishes a target that reuses the same numeric ids (a restarted edit, a reopened++/// project, undo that recreates the layer); a different comp or layer is a different owner. No++/// caret, selection, text, document position or view geometry takes part.++fn ime_target(app: &EffectcraftApp) -> Option<egui::ImeTarget> {++ let comp = app.session.active_comp_id()?;++ let edit = app.session.state.text_edit.as_ref()?;++ Some(egui::ImeTarget::new(egui::Id::unique(("effectcraft-ime-text", comp.0, edit.layer.0)), edit.session))++}++++fn ime_owner(app: &EffectcraftApp) -> Option<ImeOwner> {++ let edit = app.session.state.text_edit.as_ref()?;++ Some(ImeOwner { layer: edit.layer, session: edit.session })++}++++/// The bounded committed snapshot used by an IME receipt.++///++/// The cached value is keyed by the exact state that can change it. Repeated observations in++/// one pass/frame (receipts and the final descriptor) therefore reuse one bounded snapshot++/// instead of evaluating an animated Source Text or scanning the document each time.++fn ime_surrounding_cached(app: &EffectcraftApp, ctx: &egui::Context) -> Option<ImeSurrounding> {++ let viewport = ctx.viewport_id();++ let edit = app.session.state.text_edit.as_ref();++ let key = (++ app.session.revision,++ app.session.active_comp_id().map_or(0, |c| c.0),++ edit.map_or(0, |e| e.layer.0),++ edit.map_or(0, |e| e.session),++ edit.map_or(0, |e| e.anchor),++ edit.map_or(0, |e| e.caret),++ app.session.time().0,++ );++ if let Some(cache) = ctx.data(|d| d.get_temp::<SurroundingCache>(ime_surrounding_cache_id(viewport)))++ && cache.key == key++ {++ return cache.value;++ }++ let value = ime_surrounding(&app.session);++ ctx.data_mut(|d| d.insert_temp(ime_surrounding_cache_id(viewport), SurroundingCache { key, value: value.clone() }));++ value++}++++fn ime_stamp(app: &EffectcraftApp, ctx: &egui::Context) -> egui::ImeMutationStamp {++ match ime_surrounding_cached(app, ctx) {++ Some(w) => egui::ImeMutationStamp::from_committed(&w.text, w.cursor, w.anchor, None),++ None => egui::ImeMutationStamp::unavailable_at_revision(app.session.revision),++ }++}++++/// Record an accepted IME commit/delete mutation for this viewport and frame.++///++/// Call it only after the command succeeded and actually changed the committed text (`before`++/// and `after` are captured immediately around that mutation). Rejected events, no-ops and++/// failed commands earn no receipt.++fn note_ime_receipt(app: &mut EffectcraftApp, ctx: &egui::Context, before: egui::ImeMutationStamp, after: egui::ImeMutationStamp) {++ let Some(target) = ime_target(app) else { return };++ let viewport = ctx.viewport_id();++ let frame = ctx.cumulative_frame_nr_for(viewport);++ app.ime_tracker.note_input_method_apply(viewport, frame, target, before, after);++}++++/// Record an application edit only when it actually changed the committed snapshot.++///++/// A no-op (Backspace at the start of the document, a failed command) must not poison a later++/// accepted IME commit in the same frame.++fn note_ime_application_edit(app: &mut EffectcraftApp, ctx: &egui::Context, before: egui::ImeMutationStamp) {++ if ime_stamp(app, ctx) != before {++ note_ime_application_change(app, ctx);++ }++}++++/// Record application-origin work (typing, paste, undo, automatic correction, ...) so `Other`++/// dominates every remaining pass of the frame.++fn note_ime_application_change(app: &mut EffectcraftApp, ctx: &egui::Context) {++ let Some(target) = ime_target(app) else { return };++ let viewport = ctx.viewport_id();++ let frame = ctx.cumulative_frame_nr_for(viewport);++ app.ime_tracker.note_application_change(viewport, frame, target);++}++++fn clear_preedit(ui: &egui::Ui) {++ let viewport = ui.ctx().viewport_id();++ ui.data_mut(|d| d.remove::<Preedit>(ime_preedit_id(viewport)));++}++++fn read_ime_composition(ui: &egui::Ui) -> Option<ImeComposition> {++ let viewport = ui.ctx().viewport_id();++ ui.data(|d| d.get_temp::<ImeComposition>(ime_composition_id(viewport)))++}++++fn set_ime_composition(ui: &egui::Ui, composition: Option<ImeComposition>) {++ let viewport = ui.ctx().viewport_id();++ ui.data_mut(|d| match composition {++ Some(composition) => {++ d.insert_temp(ime_composition_id(viewport), composition);++ }++ None => d.remove::<ImeComposition>(ime_composition_id(viewport)),++ });++}++++/// Mark the composition in flight as interrupted by application work.++///++/// A live visible composition (`Active`) or an observed empty pre-edit whose terminal event is++/// still pending (`TerminalPending`) needs a tombstone; there is no lingering event to reject when++/// no pre-edit was seen. Repeated hidden passes retire an already guarded activation without++/// allocating again; reactivation requests a new fence. Missing acknowledgement stays closed.++fn invalidate_ime_composition(ui: &egui::Ui, app: &EffectcraftApp) {++ if matches!(read_ime_composition(ui), Some(ImeComposition::Active(_) | ImeComposition::TerminalPending(_))) {++ set_ime_composition(ui, Some(ImeComposition::Stale));++ request_reset(app, ui.ctx());++ }++}++++/// Keep the composition lifecycle aligned with the current edit target.++///++/// A target change or the end of the edit invalidates a visible composition or an observed empty++/// pre-edit with a still-pending terminal event, and clears the visible preview. The tombstone is++/// kept across arbitrary idle frames until the exact request-bound completion is observed.++fn sync_ime_target(ui: &egui::Ui, app: &EffectcraftApp) {++ let viewport = ui.ctx().viewport_id();++ let current = ime_owner(app);++ let previous = ui.data(|d| d.get_temp::<Option<ImeOwner>>(ime_target_seen_id(viewport))).flatten();++ if previous == current {++ return;++ }++ if previous.is_some() {++ // The previous target was replaced or the editor ended. Any composition it had is now++ // stale, including one whose next pre-edit/commit arrives in a later raw batch.++ invalidate_ime_composition(ui, app);++ }++ // The preview belongs to the previous target even when the new one has the same numeric ids.++ clear_preedit(ui);++ ui.data_mut(|d| d.insert_temp(ime_target_seen_id(viewport), current));++}++++fn ime_selection(app: &EffectcraftApp) -> Option<ImeSelection> {++ let edit = app.session.state.text_edit.as_ref()?;++ Some(ImeSelection { owner: ime_owner(app)?, anchor: edit.anchor, caret: edit.caret })++}++++/// Accept the selection resulting from an IME event without cancelling its remaining events.++fn remember_ime_selection(ui: &egui::Ui, app: &EffectcraftApp) {++ let viewport = ui.ctx().viewport_id();++ let selection = ime_selection(app);++ ui.data_mut(|d| d.insert_temp(ime_selection_id(viewport), selection));++ let stamp = ime_stamp(app, ui.ctx());++ ui.data_mut(|d| d.insert_temp(committed_id(viewport), stamp));++}++++/// An application caret/selection change cannot inherit the old composition's mutations.++/// Run before IME dispatch, and after application events, while the old selection is still++/// recorded. Accepted IME events update that record separately: their own delete must not++/// invalidate the commit that follows it.++fn sync_ime_selection(ui: &egui::Ui, app: &EffectcraftApp) {++ let viewport = ui.ctx().viewport_id();++ let previous = ui.data(|d| d.get_temp::<Option<ImeSelection>>(ime_selection_id(viewport))).flatten();++ let committed = ui.data(|data| data.get_temp::<egui::ImeMutationStamp>(committed_id(viewport)));++ let changed = previous != ime_selection(app) || committed.is_some_and(|previous| previous != ime_stamp(app, ui.ctx()));++ if changed && matches!(read_ime_composition(ui), Some(ImeComposition::Active(_) | ImeComposition::TerminalPending(_))) {++ invalidate_ime_composition(ui, app);++ clear_preedit(ui);++ }++ sync_reset(app, ui.ctx());++ remember_ime_selection(ui, app);++}++++fn bounded_preedit(mut text: String) -> String {++ if text.len() > MAX_IME_TEXT_BYTES {++ let mut end = MAX_IME_TEXT_BYTES;++ while end > 0 && !text.is_char_boundary(end) {++ end -= 1;++ }++ text.truncate(end);++ }++ text++}++++fn read_preedit(ui: &egui::Ui) -> Option<Preedit> {++ let viewport = ui.ctx().viewport_id();++ ui.data(|d| d.get_temp::<Preedit>(ime_preedit_id(viewport)))++}++++/// Clear a preview that belongs to `owner`, leaving any other viewport's guard untouched.++fn clear_current_preedit(ui: &egui::Ui, owner: ImeOwner) {++ if read_preedit(ui).is_some_and(|p| p.owner == owner) {++ clear_preedit(ui);++ }++}++++/// Whether an incoming IME mutation belongs to the currently edited composition.++///++/// With no composition a direct commit/delete (platforms may send one without a preview) is++/// accepted. Once a composition is visible or has an observed empty pre-edit awaiting its terminal++/// event, only its matching owner and uninterrupted selection may mutate the document. A target++/// switch or application caret change leaves a tombstone rejecting the interrupted composition.++fn ime_event_is_stale(ui: &egui::Ui, owner: ImeOwner) -> bool {++ match read_ime_composition(ui) {++ Some(ImeComposition::Stale) => true,++ Some(ImeComposition::Active(active) | ImeComposition::TerminalPending(active)) => active != owner,++ None => false,++ }++}++++fn visible_preedit(ui: &egui::Ui, app: &EffectcraftApp) -> Option<String> {++ let owner = ime_owner(app)?;++ let p = read_preedit(ui)?;++ (p.owner == owner && !p.text.is_empty()).then_some(p.text)++}++++/// Publish the settled descriptor for one completed viewport pass.++///++/// This runs at the very end of a root pass (after dock actions, ScriptUI, learn and dialogs)++/// and at the end of each panel-window pass after that window's actions. The overlay only++/// records geometry; it never publishes early with a snapshot that a later action can replace.++pub(crate) fn finish_ime(app: &mut EffectcraftApp, ui: &egui::Ui) {++ let ctx = ui.ctx();++ let viewport = ctx.viewport_id();++ let frame = ctx.cumulative_frame_nr_for(viewport);++ let pass = ctx.cumulative_pass_nr_for(viewport);++ let geometry = ctx.data(|d| d.get_temp::<ImeGeometry>(ime_geometry_id(viewport))).filter(|(p, _, _)| *p == pass);++ // The window itself must be focused too: a forced hidden-window UI pass keeps egui's widget++ // focus, but no input method may target it. `None` is "unknown" (tests, some platforms).++ let window_focused = window_available(ctx);++ let focused = geometry.is_some() && window_focused && ui.is_enabled() && app.dialog.is_none() && ctx.memory(|m| m.has_focus(focus_id()));++ // Resolve availability, but withhold admission from the synchronizers: they may retire a++ // guard and must not allocate before this pass's actual output is known. Otherwise a++ // destination change in sync could allocate one ID and the output-identity check below a++ // second ID in the same pass.++ set_admission(ctx, false);++ sync_ime_target(ui, app);++ sync_ime_selection(ui, app);++ let update = match (ime_target(app).filter(|_| focused), geometry) {++ (Some(target), Some((_, _rect, _cursor_rect))) => {++ let window = ime_surrounding_cached(app, ctx);++ let committed = window.as_ref().map(|w| egui::CommittedText::new(&w.text, w.cursor, w.anchor));++ app.ime_tracker.observe(viewport, Some(egui::ImeObservation::new(frame, pass, target).committed(committed)))++ }++ _ => {++ app.ime_tracker.observe(viewport, None);++ // Losing custom publication retires the old ID. Returning to the same editor must++ // request a new fence rather than await a discarded or foreign descriptor's ID.++ invalidate_ime_composition(ui, app);++ clear_preedit(ui);++ None++ }++ };++ let custom = update.as_ref().map(|update| OutputContext(update.owner, update.context_generation, update.purpose));++ if let Some(update) = update {++ let key = (update.owner, update.context_generation);++ let previous = ctx.data(|d| d.get_temp::<(egui::Id, u64)>(ime_last_context_id(viewport)));++ // A new owner or replacement epoch on the same widget focus must cancel the platform's++ // composition too; waiting for egui's focus change is not enough on Windows/macOS/X11.++ let interrupt = previous.is_some_and(|p| p != key);++ if interrupt {++ ctx.memory_mut(|m| m.interrupt_ime());++ }++ ctx.data_mut(|d| d.insert_temp(ime_last_context_id(viewport), key));++ ctx.output_mut(|o| {++ o.ime = Some(egui::output::IMEOutput {++ owner: update.owner,++ context_generation: update.context_generation,++ purpose: update.purpose,++ rect: geometry.map_or(egui::Rect::NOTHING, |(_, r, _)| r),++ cursor_rect: geometry.map_or(egui::Rect::NOTHING, |(_, _, c)| c),++ should_interrupt_composition: interrupt,++ reset_request: None,++ change_cause: update.change_cause,++ surrounding_text: update.surrounding_text,++ });++ });++ } else {++ // Clear only this custom editor's descriptor. A stock TextEdit that drew later in the++ // same pass owns `output.ime` now and must keep it.++ let previous = ctx.data(|d| d.get_temp::<(egui::Id, u64)>(ime_last_context_id(viewport)));++ ctx.output_mut(|o| {++ if previous.is_some_and(|(owner, _)| o.ime.as_ref().is_some_and(|ime| ime.owner == owner)) {++ o.ime = None;++ }++ });++ }++ // `ctx.output` here is the descriptor this function just wrote, not proof that the host++ // accepted it. On the publishing path `actual == custom` is true by construction, so it is++ // only a defensive no-update check (there `custom.is_none()` already decides). The real++ // foreign/stock protection is the owner check in the no-update branch above, not this test.++ let actual = ctx.output(|output| output.ime.as_ref().map(OutputContext::from));++ let eligible = focused && custom.is_some() && actual == custom;++ set_admission(ctx, eligible);++ if !eligible {++ unavailable_controls(ui);++ } else if let Some(guard) = read_reset(ctx) {++ // The confirmed eligible finalizer makes the one destination/output-aware allocation++ // for this pass. A suspended or superseded guard was retired locally by the++ // synchronizers; only here is a new request put into core Memory, carrying the output++ // context actually published above.++ if guard.suspended || guard.destination != ime_selection(app) || guard.output.is_some_and(|old| Some(old) != custom) {++ request_reset_with_output(app, ctx, custom);++ } else if let Some(mut guard) = read_reset(ctx) {++ guard.output = custom;++ ctx.data_mut(|data| data.insert_temp(reset_id(viewport), guard));++ }++ }++}++++/// Release one native viewport's IME data and tracker state.++pub(crate) fn end_viewport(app: &mut EffectcraftApp, ctx: &egui::Context, viewport: egui::ViewportId) {++ ctx.data_mut(|d| {++ d.remove::<Preedit>(ime_preedit_id(viewport));++ d.remove::<ImeComposition>(ime_composition_id(viewport));++ d.remove::<ImeGeometry>(ime_geometry_id(viewport));++ d.remove::<Option<(u64, u64)>>(ime_seen_id(viewport));++ d.remove::<Option<ImeOwner>>(ime_target_seen_id(viewport));++ d.remove::<Option<ImeSelection>>(ime_selection_id(viewport));++ d.remove::<(egui::Id, u64)>(ime_last_context_id(viewport));++ d.remove::<SurroundingCache>(ime_surrounding_cache_id(viewport));++ d.remove::<u64>(typing_key_id(viewport));++ d.remove::<ResetGuard>(reset_id(viewport));++ d.remove::<egui::ImeMutationStamp>(committed_id(viewport));++ d.remove::<u64>(input_id(viewport));++ d.remove::<bool>(mode_id(viewport));++ d.remove::<bool>(admission_id(viewport));++ });++ app.ime_tracker.end_viewport(viewport);}/// The geometry of an edited text layer.@@@ -158,13 -158,13 +724,17 @@@ fn keeps_text_edit(p: PanelKind) -> boopub fn panel_clicked(app: &mut EffectcraftApp, ctx: &egui::Context, p: PanelKind) {if app.session.state.text_edit.is_some() && !keeps_text_edit(p) {exec(app, "text.endEdit", json!({}));++ // `viewport_id()` takes the context's lock itself, so resolve it before entering++ // `data_mut`; nesting the two calls deadlocks.++ let viewport = ctx.viewport_id();++ ctx.data_mut(|d| d.remove::<Preedit>(ime_preedit_id(viewport)));ctx.memory_mut(|m| m.surrender_focus(focus_id()));}}/// Typing merge key: consecutive keystrokes fold into one undo step until the caret moves.fn typing_key(ui: &egui::Ui, bump: bool) -> String {-- let id = egui::Id::new("viewer-text-typing");++ let id = typing_key_id(ui.ctx().viewport_id());let mut n: u64 = ui.data(|d| d.get_temp(id)).unwrap_or(0);if bump {n += 1;@@@ -186,7 -186,7 +756,9 @@@ pub fn hook) -> bool {let tool = app.ui.tool;let type_tool = matches!(tool, Tool::Type | Tool::TypeVertical);-- let last_tool_id = egui::Id::new("viewer-text-last-tool");++ sync_ime_target(ui, app);++ sync_ime_selection(ui, app);++ let last_tool_id = egui::Id::unique("viewer-text-last-tool");let last_tool = ui.data(|d| d.get_temp::<Tool>(last_tool_id));ui.data_mut(|d| d.insert_temp(last_tool_id, tool));if last_tool.is_some_and(|previous| matches!(previous, Tool::Type | Tool::TypeVertical) && !type_tool) {@@@ -204,7 -204,7 +776,20 @@@let mut owns = false;let mut drag: Option<Drag> = ui.data(|d| d.get_temp(drag_id()));let (pressed, down, released, mods) = ui.input(|i| (i.pointer.primary_pressed(), i.pointer.primary_down(), i.pointer.primary_released(), i.modifiers));-- let press = ui.input(|i| i.pointer.press_origin());++ // The latest primary press of this frame. `press_origin` is already cleared when a press and++ // release arrive in one frame; the input events retain the latest press even after release.++ // An invalid latest press++ // must not become an earlier click or a release-position click.++ let press = ui.input(|i| {++ let latest = i.events.iter().rev().find_map(|event| match event {++ egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: true, .. } => Some(*pos),++ _ => None,++ });++ match latest {++ Some(pos) => pos.is_finite().then_some(pos),++ None => i.pointer.press_origin().filter(|pos| pos.is_finite()),++ }++ });let pointer = ui.input(|i| i.pointer.interact_pos());let handle_hit = |e: &Edited, s: Pos2| e.handles().iter().position(|h| e.to_screen(map, *h).distance(s) < 7.0);@@@ -214,6 -214,6 +799,7 @@@&& resp.hovered()&& !matches!(tool, Tool::Hand | Tool::Zoom)&& let Some(pos) = press++ && resp.rect.intersect(ui.clip_rect()).contains(pos){let mut handled = false;if let Some(e) = &cur {@@@ -352,6 -352,6 +938,10 @@@}// ---- keyboard++ // Pointer handling above may have started or switched a text target: leave the previous++ // composition's identity as a stale guard before this pass's IME events are read.++ sync_ime_target(ui, app);++ sync_ime_selection(ui, app);if app.session.state.text_edit.is_some() && app.dialog.is_none() && ui.is_enabled() {// Register after pointer handling so new edits take focus in this frame. An inactive// editor must not take Tab focus and immediately surrender it before viewer controls.@@@ -360,12 -360,12 +950,12 @@@m.set_focus_lock_filter(focus_id(), egui::EventFilter { tab: true, horizontal_arrows: true, vertical_arrows: true, escape: true });});// A session started elsewhere (menu, agent, Properties) takes the keyboard once…-- let seen = egui::Id::new("viewer-text-seen");-- let key = app.session.state.text_edit.as_ref().map(|e| e.layer.0);++ let seen = ime_seen_id(ui.ctx().viewport_id());++ let key = app.session.state.text_edit.as_ref().map(|e| (e.layer.0, e.session));// …and gets it back when a click in the viewer or a formatting panel left nothing holding// it; not merely because nothing has the focus (#831).let regain = ui.memory(|m| m.focused().is_none()) && keeps_text_edit(app.ui.focused);-- if ui.data(|d| d.get_temp::<Option<u64>>(seen)).flatten() != key || regain {++ if ui.data(|d| d.get_temp::<Option<(u64, u64)>>(seen)).flatten() != key || regain {ui.data_mut(|d| d.insert_temp(seen, key));ui.memory_mut(|m| m.request_focus(focus_id()));}@@@ -373,7 -373,7 +963,12 @@@keyboard(app, ui, resp.rect);}} else {-- ui.data_mut(|d| d.insert_temp::<Option<u64>>(egui::Id::new("viewer-text-seen"), None));++ // Resolve the viewport before taking the data lock: `viewport_id()`++ // acquires the same context lock that `data_mut` holds.++ let viewport = ui.ctx().viewport_id();++ ui.data_mut(|d| d.insert_temp::<Option<(u64, u64)>>(ime_seen_id(viewport), None));++ invalidate_ime_composition(ui, app);++ clear_preedit(ui);if ui.memory(|m| m.has_focus(focus_id())) {ui.memory_mut(|m| m.surrender_focus(focus_id()));}@@@ -384,6 -384,6 +979,8 @@@&& let Some(e) = edited(app, ectx, s.layer){draw(app, ui, painter, map, &e, s.range(), s.caret);++ // `draw` records the caret geometry for this pass. The descriptor is published once at++ // the end of the whole pass, after dock/script actions have had their say.}owns}@@@ -392,23 -392,23 +989,144 @@@/// panel it lands in decides (after this frame's panels) whether the edit ends, so the keys after/// it in this frame are neither typed nor run as shortcuts (#831).fn keyboard(app: &mut EffectcraftApp, ui: &mut egui::Ui, viewer: Rect) {++ let viewport = ui.ctx().viewport_id();++ let frame = ui.ctx().cumulative_frame_nr_for(viewport);++ let first = ui.data_mut(|data| {++ if data.get_temp::<u64>(input_id(viewport)) == Some(frame) {++ false++ } else {++ data.insert_temp(input_id(viewport), frame);++ true++ }++ });++ if !first {++ return;++ }++ if !window_available(ui.ctx()) {++ set_admission(ui.ctx(), false);++ unavailable_controls(ui);++ return;++ }++ set_admission(ui.ctx(), true);++ sync_ime_selection(ui, app);let events = ui.input(|i| i.events.clone());let ctx = ui.ctx().clone();++ // This clone is the exclusive ordered owner of controls. Removing only those controls from++ // the shared vector does not acknowledge them or move them ahead of preceding mutations.++ ctx.input_mut(|input| input.events.retain(|event| !matches!(event, egui::Event::ImeResetCompleted { .. })));++ let mut custom_mutations = app.session.state.text_edit.is_some();for ev in events {-- let Some(sel) = app.session.state.text_edit.clone() else { return };++ if let egui::Event::ImeResetCompleted { request_id } = &ev {++ if custom_mutations {++ complete_reset(app, ui, *request_id);++ }++ continue;++ }++ sync_ime_target(ui, app);++ sync_ime_selection(ui, app);++ if matches!(&ev, egui::Event::PointerButton { pos, pressed: true, .. } if !viewer.contains(*pos)) {++ // The press already proves this custom route is leaving (or deferring to the panel++ // that owns the click). Disable admission before invalidating, so retiring the old++ // guard cannot put a new, undeliverable ID into core Memory. The finalizer allocates++ // the one replacement only after it confirms this pass's actual custom output is++ // eligible. A previously issued ID may still be queued in core (which has no cancel)++ // and attach to a later stock field; the suspended local guard ignores its completion.++ set_admission(&ctx, false);++ invalidate_ime_composition(ui, app);++ clear_preedit(ui);++ suspend_reset(&ctx);++ custom_mutations = false;++ continue;++ }++ if !custom_mutations {++ continue;++ }++ let Some(sel) = app.session.state.text_edit.clone() else {++ suspend_reset(&ctx);++ custom_mutations = false;++ continue;++ };++ let owner = ImeOwner { layer: sel.layer, session: sel.session };++ let from_ime = matches!(&ev, egui::Event::Ime(_));match ev {-- egui::Event::PointerButton { pos, pressed: true, .. } if !viewer.contains(pos) => return,egui::Event::Text(t) if !t.chars().any(char::is_control) => {++ clear_current_preedit(ui, owner);let k = typing_key(ui, false);-- exec(app, "text.insert", json!({"text": t, "merge": k}));++ let before = ime_stamp(app, &ctx);++ if exec(app, "text.insert", json!({"text": t, "merge": k})).is_some() {++ note_ime_application_edit(app, &ctx, before);++ }}-- egui::Event::Ime(egui::ImeEvent::Commit(t)) if !t.is_empty() => {-- let k = typing_key(ui, false);-- exec(app, "text.insert", json!({"text": t, "merge": k}));-- ui.data_mut(|d| d.remove::<String>(egui::Id::new("viewer-text-preedit")));++ egui::Event::Ime(egui::ImeEvent::Commit(t)) => {++ // Old terminal payloads cannot acknowledge the request or admit a later suffix.++ if ime_event_is_stale(ui, owner) {++ continue;++ }++ // An accepted commit is the terminal event of its composition (or a direct commit++ // that never had a pre-edit).++ set_ime_composition(ui, None);++ // An empty commit (the tail of a deletion-only batch) changes no text, so it earns++ // no receipt; it still ends the composed preview.++ if !t.is_empty() {++ let k = typing_key(ui, false);++ // The receipt covers only this accepted insertion: AutoCorrect and every++ // other application transformation stays outside it.++ let before = ime_stamp(app, &ctx);++ if exec(app, "text.insert", json!({"text": t, "merge": k})).is_some() {++ let after = ime_stamp(app, &ctx);++ note_ime_receipt(app, &ctx, before, after);++ }++ }++ clear_preedit(ui);}egui::Event::Ime(egui::ImeEvent::Preedit { text, .. }) => {-- ui.data_mut(|d| d.insert_temp(egui::Id::new("viewer-text-preedit"), text));++ if text.is_empty() {++ // An empty pre-edit only clears the visible composition. Keep its owner as++ // terminal-pending: the commit/delete for this composition is a separate++ // event and a target switch must reject it. Only the matching fence can++ // lift an already interrupted guard.++ if !ime_event_is_stale(ui, owner) {++ set_ime_composition(ui, Some(ImeComposition::TerminalPending(owner)));++ }++ clear_preedit(ui);++ } else if ime_event_is_stale(ui, owner) {++ // This pre-edit belongs to the composition whose target was replaced; an++ // input method can emit further non-empty pre-edits before its final commit.++ // Do not revive the old composition on the replacement target, and keep the++ // tombstone past this batch: the old composition may commit in a later frame.++ set_ime_composition(ui, Some(ImeComposition::Stale));++ } else {++ set_ime_composition(ui, Some(ImeComposition::Active(owner)));++ ui.data_mut(|d| d.insert_temp(ime_preedit_id(viewport), Preedit { owner, text: bounded_preedit(text) }));++ }++ }++ // An input method replacing text around the selection (W26/W27 `Done` batches on++ // Wayland/Windows, E21): delete exactly the reported characters/bytes. The commit++ // that follows shares this typing key, so replacement stays one undo step.++ egui::Event::Ime(egui::ImeEvent::DeleteSurrounding { before_chars, after_chars }) => {++ if ime_event_is_stale(ui, owner) {++ // A delete-surrounding is not terminal by itself: its paired commit/text++ // follows in the same composition. Its delete and commit stay rejected++ // until the request-bound completion.++ continue;++ }++ let before = ime_stamp(app, &ctx);++ if ime_delete(app, ui, before_chars, after_chars, false) {++ let after = ime_stamp(app, &ctx);++ note_ime_receipt(app, &ctx, before, after);++ }++ }++ egui::Event::Ime(egui::ImeEvent::DeleteSurroundingBytes { before_bytes, after_bytes }) => {++ if ime_event_is_stale(ui, owner) {++ // Its paired commit/text still belongs to the replaced composition; keep the++ // guard until the actual matching completion.++ continue;++ }++ let before = ime_stamp(app, &ctx);++ if ime_delete(app, ui, before_bytes, after_bytes, true) {++ let after = ime_stamp(app, &ctx);++ note_ime_receipt(app, &ctx, before, after);++ }}egui::Event::Copy => {if let Some(v) = exec(app, "edit.copy", json!({}))@@@ -418,15 -418,15 +1136,20 @@@}}egui::Event::Cut => {++ let before = ime_stamp(app, &ctx);if let Some(v) = exec(app, "edit.cut", json!({}))&& let Some(t) = v["text"].as_str(){ctx.copy_text(t.to_string());++ note_ime_application_edit(app, &ctx, before);}typing_key(ui, true);}egui::Event::Paste(t) => {-- exec(app, "edit.paste", json!({"text": t}));++ let before = ime_stamp(app, &ctx);++ if exec(app, "edit.paste", json!({"text": t})).is_some() {++ note_ime_application_edit(app, &ctx, before);++ }typing_key(ui, true);}egui::Event::Key { key, pressed: true, modifiers: m, .. } => {@@@ -466,31 -466,35 +1189,50 @@@Key::End => mv(app, if cmd { "end" } else { "lineEnd" }),Key::Backspace => {let k = typing_key(ui, false);-- exec(app, "text.delete", json!({"word": cmd || m.alt, "merge": k}));++ let before = ime_stamp(app, &ctx);++ if exec(app, "text.delete", json!({"word": cmd || m.alt, "merge": k})).is_some() {++ note_ime_application_edit(app, &ctx, before);++ }}Key::Delete => {let k = typing_key(ui, false);-- exec(app, "text.delete", json!({"direction": "forward", "word": cmd || m.alt, "merge": k}));++ let before = ime_stamp(app, &ctx);++ if exec(app, "text.delete", json!({"direction": "forward", "word": cmd || m.alt, "merge": k})).is_some() {++ note_ime_application_edit(app, &ctx, before);++ }}Key::Enter if cmd => {exec(app, "text.endEdit", json!({}));}Key::Enter => {let k = typing_key(ui, false);-- exec(app, "text.insert", json!({"text": "\n", "merge": k}));++ let before = ime_stamp(app, &ctx);++ if exec(app, "text.insert", json!({"text": "\n", "merge": k})).is_some() {++ note_ime_application_edit(app, &ctx, before);++ }}Key::Tab => {let k = typing_key(ui, false);-- exec(app, "text.insert", json!({"text": "\t", "merge": k}));++ let before = ime_stamp(app, &ctx);++ if exec(app, "text.insert", json!({"text": "\t", "merge": k})).is_some() {++ note_ime_application_edit(app, &ctx, before);++ }}Key::Escape => {exec(app, "text.endEdit", json!({}));}- Key::A if cmd => {+ // The editor owns exactly Cmd/Ctrl+A (Select All) and Cmd/Ctrl+Z with or+ // without Shift (Undo, Redo). Other modifiers on those keys aren't editing+ // chords, so they fall through to the binding match below: Shift+A is+ // Deselect All's default, and Alt variants are free for a rebound one.+ Key::A if cmd && !m.shift && !m.alt => {exec(app, "text.setSelection", json!({"select": "all"}));}- Key::Z if cmd => {- let _ = crate::menus::invoke(app, &ctx, if m.shift { "edit.redo" } else { "edit.undo" }, json!({}));+ Key::Z if cmd && !m.alt => {- let _ = crate::menus::invoke(app, &ctx, if m.shift { "edit.redo" } else { "edit.undo" }, json!({}));++ let before = ime_stamp(app, &ctx);++ if crate::menus::invoke(app, &ctx, if m.shift { "edit.redo" } else { "edit.undo" }, json!({})).is_ok() {++ note_ime_application_edit(app, &ctx, before);++ }}Key::Comma | Key::Period if cmd && m.shift => {let doc = layer_doc(&app.session, sel.layer).unwrap_or_default();@@@ -507,9 -521,9 +1259,38 @@@}_ => {}}++ let route_ended = app.session.state.text_edit.is_none() || app.dialog.is_some();++ if route_ended {++ set_admission(&ctx, false);++ }++ if from_ime {++ remember_ime_selection(ui, app);++ } else {++ // Arrow/Home/End/Select All (or another application event) may have moved the++ // selection before a queued IME delete/commit later in this same raw batch.++ sync_ime_selection(ui, app);++ }++ if route_ended {++ suspend_reset(&ctx);++ custom_mutations = false;++ }+ }+}+++/// Delete the text an IME marks for replacement around the editor's selection.++///++/// `before`/`after` count UTF-8 bytes (`DeleteSurroundingBytes`, what winit reports) or++/// characters (`DeleteSurrounding`). The engine command keeps the selected text — the following++/// `Commit` replaces it — and leaves a character a byte count only partly covers; the deletion++/// and the commit share this typing key, so a replacement stays one undo step.++fn ime_delete(app: &mut EffectcraftApp, ui: &egui::Ui, before: usize, after: usize, bytes: bool) -> bool {++ if (before == 0 && after == 0) || app.session.state.text_edit.is_none() {++ return false;+ }++ let k = typing_key(ui, false);++ exec(app, "text.deleteSurrounding", json!({"before": before, "after": after, "bytes": bytes, "merge": k})).is_some()+ }+fn draw(app: &mut EffectcraftApp, ui: &mut egui::Ui, painter: &egui::Painter, map: &ViewerMap, e: &Edited, sel: std::ops::Range<usize>, caret: usize) {let t = app.tokens;let to_s = |p: Point| e.to_screen(map, (p.x, p.y));@@@ -545,8 -559,8 +1326,8 @@@let (a, b) = (anim(a), anim(b));let (sa, sb) = (to_s(a), to_s(b));let now = ui.input(|i| i.time);-- let preedit: Option<String> = ui.data(|d| d.get_temp(egui::Id::new("viewer-text-preedit")));-- if let Some(pe) = preedit.filter(|s| !s.is_empty()) {++ let preedit = visible_preedit(ui, app);++ if let Some(pe) = preedit {let h = (sb - sa).length().max(10.0);let g = painter.layout_no_wrap(pe, egui::FontId::proportional(h * 0.7), Color32::WHITE);let r = Rect::from_min_size(sa, g.size());@@@ -564,7 -578,7 +1345,620 @@@let rect = Rect::from_points(&quad);app.auto.add("viewer.textEdit", rect, &format!("Editing {}", e.layer.name));let cursor_rect = Rect::from_two_pos(sa, sb).expand2(vec2(1.0, 0.0));-- ui.ctx().output_mut(|o| {-- o.ime = Some(egui::output::IMEOutput { purpose: egui::IMEPurpose::Normal, rect, cursor_rect, should_interrupt_composition: false });-- });++ // The outgoing IME descriptor is published by the pass-end finalizer, with this actual++ // caret geometry and the edited layer's committed `TextDoc` (never the bidi or pre-edit++ // display text). An available-empty document stays distinct from unavailable.++ let viewport = ui.ctx().viewport_id();++ let pass = ui.ctx().cumulative_pass_nr_for(viewport);++ ui.data_mut(|d| d.insert_temp(ime_geometry_id(viewport), (pass, rect, cursor_rect)));++}++++#[cfg(test)]++mod tests {++ //! Incoming IME edits on the custom text editor (the Type tool's own session, not a stock++ //! `TextEdit`). Winit reports the bytes around the selection *before* the commit it belongs++ //! to, so the deletion and the insert must share one undo step.++++ use super::*;++ use effectcraft_engine::Session;++ use effectcraft_engine::commands::text_edit::TextEdit;++ use serde_json::json;++++ fn editor(text: &str, anchor: usize, caret: usize) -> (EffectcraftApp, LayerId) {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "IME", "width": 160, "height": 90, "duration": 1})).unwrap();++ let layer = s.execute("layer.newText", json!({"text": text})).unwrap()["layer"].as_u64().unwrap();++ let lid = LayerId(layer);++ s.state.text_edit = Some(TextEdit { layer: lid, anchor, caret, ..Default::default() });++ (EffectcraftApp::new(s), lid)++ }++++ fn doc_text(app: &EffectcraftApp, lid: LayerId) -> String {++ layer_doc(&app.session, lid).map(|d| d.text).unwrap_or_default()++ }++++ fn feed(app: &mut EffectcraftApp, events: Vec<egui::Event>) {++ let ctx = egui::Context::default();++ let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(320.0, 180.0))), events, ..Default::default() };++ let mut out = ctx.run_ui(raw, |ui| keyboard(app, ui, egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(320.0, 180.0))));++ out.textures_delta.clear();++ }++++ #[test]++ fn preedit_preview_is_bounded_on_a_character_boundary() {++ let text = "é".repeat(MAX_IME_TEXT_BYTES);++ let capped = bounded_preedit(text);++ assert!(capped.len() <= MAX_IME_TEXT_BYTES);++ assert!(capped.is_char_boundary(capped.len()));++ assert_eq!(capped.len() % "é".len(), 0, "the cap never leaves half a character");++ }++++ /// Ending the edit from another panel clears this viewport's pre-edit. The production path++ /// used to resolve `viewport_id()` (a context read lock) inside `data_mut` (a write lock);++ /// that nested context access deadlocked every pass that drew the viewer.++ #[test]++ fn ending_an_edit_from_another_panel_clears_the_preedit() {++ let (mut app, lid) = editor("abc", 0, 0);++ let session = app.session.state.text_edit.as_ref().map_or(1, |e| e.session);++ let ctx = egui::Context::default();++ let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {++ let viewport = ui.ctx().viewport_id();++ let preedit = Preedit { owner: ImeOwner { layer: lid, session }, text: "x".into() };++ ui.data_mut(|d| d.insert_temp(ime_preedit_id(viewport), preedit));++ panel_clicked(&mut app, ui.ctx(), PanelKind::Timeline);++ let viewport = ui.ctx().viewport_id();++ assert!(ui.data(|d| d.get_temp::<Preedit>(ime_preedit_id(viewport))).is_none(), "the ended edit leaves no preview behind");++ });++ out.textures_delta.clear();++ assert!(app.session.state.text_edit.is_none(), "a click in the Timeline ends the text edit");++ }++++ #[test]++ fn ime_delete_surrounding_bytes_and_the_commit_are_one_undo_step() {++ // "café😀": the last character is four bytes, so a byte-count deletion that treated bytes++ // as characters would corrupt the document.++ let (mut app, lid) = editor("café😀", 5, 5);++ feed(++ &mut app,++ vec![++ egui::Event::Ime(egui::ImeEvent::DeleteSurroundingBytes { before_bytes: 4, after_bytes: 0 }),++ egui::Event::Ime(egui::ImeEvent::Commit("X".into())),++ ],++ );++ assert_eq!(doc_text(&app, lid), "caféX", "the emoji is replaced by the committed text");++ app.session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(doc_text(&app, lid), "café😀", "the replacement is one undo step");++ }++++ #[test]++ fn ime_delete_surrounding_chars_keeps_the_selection_for_the_commit() {++ // Stock egui deletes the characters around the selection, not the selection itself: the++ // commit that follows replaces "bcd", it does not insert next to a deleted document.++ let (mut app, lid) = editor("abcdef", 1, 4);++ feed(&mut app, vec![egui::Event::Ime(egui::ImeEvent::DeleteSurrounding { before_chars: 1, after_chars: 99 })]);++ assert_eq!(doc_text(&app, lid), "bcd", "one character before and everything after go");++ let sel = app.session.state.text_edit.clone().expect("editing continues");++ assert_eq!(sel.range(), 0..3, "the selected text is still selected");++ // A deletion-only batch (no commit) leaves "bcd", not an empty document.++ app.session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(doc_text(&app, lid), "abcdef", "clamped deletion is still one undo step");++++ // Delete surround + commit: the commit replaces the kept selection.++ let (mut app, lid) = editor("abcdef", 1, 4);++ feed(++ &mut app,++ vec![++ egui::Event::Ime(egui::ImeEvent::DeleteSurrounding { before_chars: 1, after_chars: 99 }),++ egui::Event::Ime(egui::ImeEvent::Commit("XY".into())),++ ],++ );++ assert_eq!(doc_text(&app, lid), "XY", "the commit replaces the selection");++ app.session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(doc_text(&app, lid), "abcdef", "the deletion and its commit are one undo step");++ }++++ /// One UI pass with the editor focused, events applied, and the overlay's observation.++ struct ImePass {++ ctx: egui::Context,++ viewport: egui::ViewportId,++ rect: egui::Rect,++ }++++ impl ImePass {++ fn new(viewport: egui::ViewportId) -> Self {++ let ctx = egui::Context::default();++ install_hooks(&ctx);++ Self { ctx, viewport, rect: egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(320.0, 180.0)) }++ }++++ /// Run one `Context` frame. `overlay` is false for a pass in which the viewer (and so++ /// the edit overlay) never drew; `discard` forces a second pass of the same frame.++ fn frame(&mut self, app: &mut EffectcraftApp, events: Vec<egui::Event>, overlay: bool, discard: bool) -> Option<egui::output::IMEOutput> {++ let ctx = self.ctx.clone();++ let rect = self.rect;++ let viewport = self.viewport;++ let mut viewports = egui::ViewportIdMap::default();++ viewports.insert(self.viewport, egui::ViewportInfo::default());++ let raw = egui::RawInput { viewport_id: self.viewport, viewports, screen_rect: Some(rect), events, ..Default::default() };++ let mut asked = false;++ let mut out = ctx.run_ui(raw, |ui| {++ begin_ui(ui.ctx());++ ui.interact(rect, focus_id(), egui::Sense::focusable_noninteractive());++ ui.memory_mut(|m| m.request_focus(focus_id()));++ sync_ime_target(ui, app);++ keyboard(app, ui, rect);++ if overlay {++ let pass = ui.ctx().cumulative_pass_nr_for(viewport);++ ui.data_mut(|d| d.insert_temp(ime_geometry_id(viewport), (pass, rect, rect)));++ }++ finish_ime(app, ui);++ if discard && !asked {++ asked = true;++ ui.ctx().request_discard("ime pass test");++ }++ });++ out.textures_delta.clear();++ out.platform_output.ime++ }++ }++++ fn ime_text(ime: &egui::output::IMEOutput) -> (&str, usize, usize) {++ let p = ime.surrounding_text.available().expect("committed surrounding text");++ (p.text.as_str(), p.cursor, p.anchor)++ }++++ #[test]++ fn discarded_custom_request_then_home_rearms_the_identical_caret() {++ let (mut app, lid) = editor("abcd", 4, 4);++ app.ui.start_screen = false;++ app.ui.tool = Tool::Type;++ app.ui.focused = PanelKind::Composition;++ let ctx = egui::Context::default();++ install_hooks(&ctx);++ let mut frame = eframe::Frame::_new_kittest();++ let raw = || egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1200.0, 800.0))), ..Default::default() };++ for _ in 0..3 {++ let mut output = ctx.run_ui(raw(), |ui| {++ eframe::App::logic(&mut app, ui.ctx(), &mut frame);++ app.draw(ui, &frame);++ });++ output.textures_delta.clear();++ }++ let mut input = raw();++ input.events.push(egui::Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ let mut output = ctx.run_ui(input, |ui| {++ eframe::App::logic(&mut app, ui.ctx(), &mut frame);++ app.draw(ui, &frame);++ });++ output.textures_delta.clear();++ assert!(output.platform_output.ime.is_some());++ app.session.execute("text.setSelection", json!({"caret": 1})).unwrap();++ let selection = app.session.state.text_edit.clone();++ let mut passes = 0;++ let mut discarded = None;++ let mut output = ctx.run_ui(raw(), |ui| {++ passes += 1;++ if passes > 1 {++ app.ui.start_screen = true;++ }++ eframe::App::logic(&mut app, ui.ctx(), &mut frame);++ app.draw(ui, &frame);++ if passes == 1 {++ assert!(ui.ctx().output(|output| output.ime.is_some()));++ discarded = read_reset(ui.ctx()).and_then(|guard| guard.request);++ ui.ctx().request_discard("custom IME descriptor discarded before Home");++ }++ });++ output.textures_delta.clear();++ assert!(passes >= 2);++ let first = discarded.expect("the actual discarded custom pass requested a fence");++ assert!(output.platform_output.ime.is_none());++ assert!(read_reset(&ctx).unwrap().suspended);++ assert!(read_reset(&ctx).unwrap().request.is_none());++ assert_eq!(app.session.state.text_edit, selection, "Home did not move the model caret");++ app.ui.start_screen = false;++ let mut output = ctx.run_ui(raw(), |ui| {++ eframe::App::logic(&mut app, ui.ctx(), &mut frame);++ app.draw(ui, &frame);++ });++ output.textures_delta.clear();++ let second = output.platform_output.ime.unwrap().reset_request.expect("same caret reactivation publishes a new real ID");++ assert_ne!(first, second);++ let mut output = ctx.run_ui(raw(), |ui| {++ eframe::App::logic(&mut app, ui.ctx(), &mut frame);++ app.draw(ui, &frame);++ });++ output.textures_delta.clear();++ assert!(output.platform_output.ime.unwrap().reset_request.is_none());++ let mut input = raw();++ input.events.extend([++ egui::Event::ImeResetCompleted { request_id: first },++ egui::Event::Ime(egui::ImeEvent::Commit("X".into())),++ egui::Event::ImeResetCompleted { request_id: second },++ egui::Event::Ime(egui::ImeEvent::Preedit { text: "が".into(), active_range_chars: None }),++ egui::Event::Ime(egui::ImeEvent::Commit("が".into())),++ ]);++ let mut output = ctx.run_ui(input, |ui| {++ eframe::App::logic(&mut app, ui.ctx(), &mut frame);++ app.draw(ui, &frame);++ });++ output.textures_delta.clear();++ assert_eq!(doc_text(&app, lid), "aがbcd");++ }++++ #[test]++ fn viewport_fences_and_duplicate_completion_keep_their_exact_lifetime() {++ let (mut app, lid) = editor("abcd", 4, 4);++ let mut root = ImePass::new(egui::ViewportId::ROOT);++ let mut detached = ImePass::new(egui::ViewportId::from_hash_of("effect-ime-detached"));++ let preview = || egui::Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None });++ root.frame(&mut app, vec![preview()], true, false);++ detached.frame(&mut app, vec![preview()], true, false);++ app.session.execute("text.setSelection", json!({"caret": 1})).unwrap();++ let first = root.frame(&mut app, vec![], true, false).unwrap().reset_request.unwrap();++ let second = detached.frame(&mut app, vec![], true, false).unwrap().reset_request.unwrap();++ assert_ne!(first, second);++ detached.frame(&mut app, vec![egui::Event::ImeResetCompleted { request_id: first }, egui::Event::Ime(egui::ImeEvent::Commit("X".into()))], true, false);++ assert_eq!(doc_text(&app, lid), "abcd");++ let pending = detached.ctx.data(|data| data.get_temp::<ResetGuard>(reset_id(detached.viewport))).unwrap().request;++ assert_eq!(pending, Some(second), "a root marker cannot release the detached viewport's full ID");++ let output = detached++ .frame(++ &mut app,++ vec![++ egui::Event::ImeResetCompleted { request_id: second },++ preview(),++ egui::Event::ImeResetCompleted { request_id: second },++ egui::Event::Ime(egui::ImeEvent::Commit("が".into())),++ ],++ true,++ false,++ )++ .unwrap();++ assert_eq!(doc_text(&app, lid), "aがbcd");++ assert!(output.reset_request.is_none(), "a duplicate control cannot reconstruct the cleared guard");++ // An actual context-generation change at unchanged selection still supersedes a wait.++ root.frame(&mut app, vec![], true, false);++ let replaced = root.frame(&mut app, vec![], false, false);++ assert!(replaced.is_none());++ let replacement = root.frame(&mut app, vec![], true, false).unwrap().reset_request.unwrap();++ assert_ne!(first, replacement);++ }++++ #[test]++ fn ime_descriptor_sends_committed_text_and_preserves_a_reversed_selection() {++ let (mut app, _) = editor("café😀", 2, 5);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let first = pass.frame(&mut app, vec![], true, false).expect("the focused editor owns IME");++ assert_eq!(first.owner, ime_target(&app).expect("an edit target").owner);++ assert!(first.context_generation > 0);++ assert_eq!(ime_text(&first), ("café😀", 9, 2), "UTF-8 bytes, with the caret's direction kept");++ assert_eq!(first.change_cause, egui::ImeChangeCause::Other, "starting a context is application origin");++ assert_eq!((first.rect, first.cursor_rect), (pass.rect, pass.rect), "the real caret geometry");++++ let again = pass.frame(&mut app, vec![], true, false).expect("still editing");++ assert_eq!(again.context_generation, first.context_generation, "an unchanged pass keeps the context");++ assert_eq!(again.surrounding_text, first.surrounding_text);++ }++++ #[test]++ fn accepted_ime_commit_is_input_method_and_ordinary_typing_is_other() {++ let (mut app, lid) = editor("ab", 2, 2);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let first = pass.frame(&mut app, vec![], true, false).expect("editing");++ let generation = first.context_generation;++++ let commit = pass.frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Commit("日".into()))], true, false).expect("still editing");++ assert_eq!(doc_text(&app, lid), "ab日");++ assert_eq!(ime_text(&commit), ("ab日", 5, 5));++ assert_eq!(commit.change_cause, egui::ImeChangeCause::InputMethod, "only the accepted commit earns it");++ assert_eq!(commit.context_generation, generation, "an ordinary text change is not a new context");++++ let typed = pass.frame(&mut app, vec![egui::Event::Text("x".into())], true, false).expect("still editing");++ assert_eq!(doc_text(&app, lid), "ab日x");++ assert_eq!(typed.change_cause, egui::ImeChangeCause::Other, "typing is application work");++ assert_eq!(typed.context_generation, generation);++ }++++ #[test]++ fn ime_delete_and_commit_chain_is_input_method_with_a_reversed_selection() {++ let (mut app, lid) = editor("abcdef", 4, 1);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ pass.frame(&mut app, vec![], true, false).expect("editing");++++ let deleted = pass++ .frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::DeleteSurrounding { before_chars: 1, after_chars: 1 })], true, false)++ .expect("still editing");++ assert_eq!(doc_text(&app, lid), "bcdf", "one character goes before and one after the selection");++ assert_eq!(ime_text(&deleted), ("bcdf", 0, 3), "the selected text and its reversed direction stay");++ assert_eq!(deleted.change_cause, egui::ImeChangeCause::InputMethod);++++ let committed = pass.frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Commit("X".into()))], true, false).expect("still editing");++ assert_eq!(doc_text(&app, lid), "Xf", "the commit replaces the kept selection");++ assert_eq!(committed.change_cause, egui::ImeChangeCause::InputMethod, "the delete and commit are one accepted chain");++ app.session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(doc_text(&app, lid), "abcdef", "the replacement is one undo step");++ }++++ #[test]++ fn an_application_edit_in_the_same_frame_dominates_the_ime_cause() {++ // Application edit before the IME commit.++ let (mut app, lid) = editor("ab", 2, 2);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ pass.frame(&mut app, vec![], true, false).expect("editing");++ let mixed = pass++ .frame(&mut app, vec![egui::Event::Text("x".into()), egui::Event::Ime(egui::ImeEvent::Commit("日".into()))], true, false)++ .expect("still editing");++ assert_eq!(doc_text(&app, lid), "abx日");++ assert_eq!(mixed.change_cause, egui::ImeChangeCause::Other, "the earlier application edit dominates");++++ // Application edit after the IME commit.++ let (mut app, lid) = editor("ab", 2, 2);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ pass.frame(&mut app, vec![], true, false).expect("editing");++ let mixed = pass++ .frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Commit("日".into())), egui::Event::Text("x".into())], true, false)++ .expect("still editing");++ assert_eq!(doc_text(&app, lid), "ab日x");++ assert_eq!(mixed.change_cause, egui::ImeChangeCause::Other, "the later application edit dominates");++ }++++ #[test]++ fn preedit_is_excluded_from_the_committed_snapshot_and_keeps_the_context() {++ let (mut app, lid) = editor("ab", 2, 2);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let first = pass.frame(&mut app, vec![], true, false).expect("editing");++++ let preview = pass++ .frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Preedit { text: "に".into(), active_range_chars: None })], true, false)++ .expect("still editing");++ assert_eq!(doc_text(&app, lid), "ab", "the pre-edit never enters the document");++ assert_eq!(ime_text(&preview), ("ab", 2, 2), "only committed text is sent");++ assert_eq!(preview.context_generation, first.context_generation, "pre-edit updates keep the composition");++++ let commit = pass.frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Commit("に".into()))], true, false).expect("still editing");++ assert_eq!(doc_text(&app, lid), "abに");++ assert_eq!(commit.change_cause, egui::ImeChangeCause::InputMethod, "clearing the pre-edit and committing is IME work");++ assert_eq!(commit.context_generation, first.context_generation);++ }++++ #[test]++ fn empty_and_unavailable_surrounding_text_are_distinct() {++ let (mut app, _) = editor("", 0, 0);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let empty = pass.frame(&mut app, vec![], true, false).expect("editing");++ assert_eq!(ime_text(&empty), ("", 0, 0), "an available-empty document is not unavailable");++++ let text = "a".repeat(5000);++ let (mut app, _) = editor(&text, 0, 5000);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let wide = pass.frame(&mut app, vec![], true, false).expect("editing");++ assert!(matches!(wide.surrounding_text, egui::output::IMESurroundingText::Unavailable), "a selection wider than the limit is unavailable");++ assert_eq!(wide.owner, ime_target(&app).expect("an edit target").owner, "identity survives unavailable text");++ }++++ #[test]++ fn replaced_edit_session_and_hidden_passes_start_a_new_context() {++ let (mut app, _) = editor("text", 4, 4);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let before = pass.frame(&mut app, vec![], true, false).expect("editing");++ if let Some(edit) = app.session.state.text_edit.as_mut() {++ edit.session = edit.session.wrapping_add(1);++ }++ let replaced = pass.frame(&mut app, vec![], true, false).expect("editing");++ assert!(replaced.context_generation > before.context_generation, "a recreated target does not inherit the old context");++ assert_eq!(replaced.change_cause, egui::ImeChangeCause::Other);++ assert!(replaced.should_interrupt_composition, "a new replacement epoch cancels the platform composition");++++ let (mut app, _) = editor("abc", 3, 3);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let visible = pass.frame(&mut app, vec![], true, false).expect("editing");++ assert!(pass.frame(&mut app, vec![], false, false).is_none(), "a hidden editor reports no IME owner");++ let back = pass.frame(&mut app, vec![], true, false).expect("editing again");++ assert!(back.context_generation > visible.context_generation, "reappearing starts exactly one new context");++ }++++ #[test]++ fn preedit_from_a_replaced_target_cannot_commit_into_the_new_session() {++ let (mut app, first) = editor("A", 1, 1);++ let second = app.session.execute("layer.newText", json!({"text": "B"})).unwrap()["layer"].as_u64().unwrap();++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ pass.frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Preedit { text: "か".into(), active_range_chars: None })], true, false)++ .expect("editing the first layer");++++ app.session.execute("text.edit", json!({"layer": second, "caret": 1})).unwrap();++ let switched = pass.frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Commit("日".into()))], true, false).expect("editing the second layer");++ assert_eq!(doc_text(&app, LayerId(second)), "B", "a delayed commit from the old composition is ignored");++ assert_eq!(doc_text(&app, first), "A", "the old layer is not changed either");++ assert_eq!(switched.owner, ime_target(&app).expect("second target").owner);++ assert!(switched.should_interrupt_composition, "the target switch interrupts the old composition");++ }++++ #[test]++ fn hidden_pass_clears_this_viewports_preedit_preview() {++ let (mut app, _) = editor("ab", 2, 2);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ pass.frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Preedit { text: "に".into(), active_range_chars: None })], true, false).expect("editing");++ assert!(pass.ctx.data(|d| d.get_temp::<Preedit>(ime_preedit_id(pass.viewport))).is_some());++ assert!(pass.frame(&mut app, vec![], false, false).is_none());++ assert!(pass.ctx.data(|d| d.get_temp::<Preedit>(ime_preedit_id(pass.viewport))).is_none(), "a pass without the overlay clears this viewport's preview");++ }++++ #[test]++ fn a_discarded_pass_keeps_the_frame_cause_and_the_context() {++ let (mut app, lid) = editor("ab", 2, 2);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let first = pass.frame(&mut app, vec![], true, false).expect("editing");++ let committed = pass.frame(&mut app, vec![egui::Event::Ime(egui::ImeEvent::Commit("日".into()))], true, true).expect("the final pass of the frame");++ assert_eq!(doc_text(&app, lid), "ab日", "the discarded pass did not replay the event");++ assert_eq!(committed.change_cause, egui::ImeChangeCause::InputMethod, "an unchanged later pass keeps the frame's cause");++ assert_eq!(committed.context_generation, first.context_generation, "both passes are one context");++ }++++ #[test]++ fn two_viewports_keep_independent_ime_contexts() {++ let (mut app, _) = editor("ab", 2, 2);++ let mut first = ImePass::new(egui::ViewportId::ROOT);++ let mut second = ImePass::new(egui::ViewportId::from_hash_of("ime-test-second-viewport"));++ let one = first.frame(&mut app, vec![], true, false).expect("editing in the first viewport");++ let two = second.frame(&mut app, vec![], true, false).expect("editing in the second viewport");++ assert_ne!(one.context_generation, two.context_generation, "each viewport has its own generation");++ let again = first.frame(&mut app, vec![], true, false).expect("editing in the first viewport");++ assert_eq!(again.context_generation, one.context_generation, "the second viewport did not disturb the first");++ }++++ /// Draw one real `EffectcraftApp::draw` pass, so `draw`'s all-exit finalizer runs.++ fn draw_app_pass(app: &mut EffectcraftApp, ctx: &egui::Context, frame: &eframe::Frame, events: Vec<egui::Event>) -> egui::FullOutput {++ let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 800.0))), events, ..Default::default() };++ let mut out = ctx.run_ui(raw, |ui| app.draw(ui, frame));++ out.textures_delta.clear();++ out++ }++++ /// One headless pass with the custom viewer and a real stock `TextEdit` side by side.++ ///++ /// The first call focuses the custom editor before `keyboard` (the outside press arrives++ /// there). The second call leaves the stock field's focus alone, so the stock descriptor++ /// is published by the same `output.ime` writer that an unrelated field would use.++ fn stock_pass(++ pass: &mut ImePass,++ app: &mut EffectcraftApp,++ events: Vec<egui::Event>,++ stock: &mut String,++ custom_focus: bool,++ ) -> Option<egui::output::IMEOutput> {++ let ctx = pass.ctx.clone();++ let viewport = pass.viewport;++ let custom = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(160.0, 90.0));++ let stock_rect = egui::Rect::from_min_size(egui::pos2(180.0, 30.0), egui::vec2(120.0, 24.0));++ let stock_id = egui::Id::unique("effectcraft-ime-test-stock");++ let mut viewports = egui::ViewportIdMap::default();++ viewports.insert(viewport, egui::ViewportInfo::default());++ let raw = egui::RawInput { viewport_id: viewport, viewports, screen_rect: Some(pass.rect), events, ..Default::default() };++ let mut out = ctx.run_ui(raw, |ui| {++ begin_ui(ui.ctx());++ if custom_focus {++ ui.interact(custom, focus_id(), egui::Sense::focusable_noninteractive());++ ui.memory_mut(|m| m.request_focus(focus_id()));++ sync_ime_target(ui, app);++ keyboard(app, ui, custom);++ } else {++ // The stock field holds focus after the outside press; keep that ownership while++ // the second pass publishes the actual stock descriptor.++ ui.memory_mut(|m| m.request_focus(stock_id));++ }++ let _ = ui.put(stock_rect, egui::TextEdit::singleline(stock).id(stock_id));++ finish_ime(app, ui);++ });++ out.textures_delta.clear();++ out.platform_output.ime++ }++++ #[test]++ fn outside_pointer_to_stock_allocates_no_new_request_and_defers_the_replacement() {++ let (mut app, lid) = editor("abcd", 4, 4);++ let mut pass = ImePass::new(egui::ViewportId::ROOT);++ let preview = || egui::Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None });++ pass.frame(&mut app, vec![preview()], true, false).expect("the custom editor starts a composition");++ app.session.execute("text.setSelection", json!({"caret": 1})).unwrap();++ let first = pass.frame(&mut app, vec![], true, false).expect("the caret change publishes a request").reset_request.expect("the real request ID");++ // Complete the first interruption, then start a fresh composition with no waiting guard.++ pass.frame(&mut app, vec![egui::Event::ImeResetCompleted { request_id: first }], true, false);++ let active = pass.frame(&mut app, vec![preview()], true, false).expect("a fresh composition");++ assert!(active.reset_request.is_none(), "a fresh composition does not wait on an old request");++ assert_eq!(doc_text(&app, lid), "abcd");++++ // The press outside the viewer also gives the stock field focus. It must not allocate a++ // new request: core would attach that request to the stock descriptor next pass.++ let outside = egui::pos2(240.0, 42.0);++ let mut stock = String::new();++ stock_pass(++ &mut pass,++ &mut app,++ vec![++ egui::Event::PointerMoved(outside),++ egui::Event::PointerButton { pos: outside, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE },++ ],++ &mut stock,++ true,++ );++ let guard = pass.ctx.data(|d| d.get_temp::<ResetGuard>(reset_id(pass.viewport))).expect("the custom guard is retired locally");++ assert!(guard.suspended && guard.request.is_none(), "the outside press retires the old request without allocating another");++ let stock_ime = stock_pass(&mut pass, &mut app, vec![], &mut stock, false).expect("the actual stock field owns IME");++ assert_ne!(stock_ime.owner, ime_target(&app).expect("the custom target is still live").owner);++ assert!(stock_ime.reset_request.is_none(), "a new outside-press request would surface on the stock output");++ assert_eq!(doc_text(&app, lid), "abcd");++++ // Returning to a confirmed eligible custom output allocates the one replacement.++ let replacement = pass.frame(&mut app, vec![], true, false).expect("the custom editor owns IME again").reset_request.expect("the deferred replacement");++ assert_ne!(first, replacement);++ assert!(pass.frame(&mut app, vec![], true, false).expect("still editing").reset_request.is_none(), "the replacement is one-shot");++ }++++ #[test]++ fn fonts_and_device_loss_all_exit_finalizers_suspend_without_allocating() {++ let (mut app, _lid) = editor("abcd", 1, 1);++ app.ui.start_screen = false;++ app.ui.tool = Tool::Type;++ app.ui.focused = PanelKind::Composition;++ app.show_panel(PanelKind::Composition);++ let ctx = egui::Context::default();++ install_hooks(&ctx);++ let frame = eframe::Frame::_new_kittest();++ let preview = || egui::Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None });++ // The first pass installs fonts and the next draws the real viewer.++ for _ in 0..3 {++ draw_app_pass(&mut app, &ctx, &frame, vec![]);++ }++ draw_app_pass(&mut app, &ctx, &frame, vec![preview()]);++ app.session.execute("text.setSelection", json!({"caret": 2})).unwrap();++ let first = draw_app_pass(&mut app, &ctx, &frame, vec![])++ .platform_output++ .ime++ .expect("the normal pass publishes the custom descriptor")++ .reset_request++ .expect("one request for the caret interruption");++++ // A real font-install pass draws nothing, but `draw` still reaches the finalizer.++ app.styled = false;++ let fonts = draw_app_pass(&mut app, &ctx, &frame, vec![]);++ assert!(!app.is_ready(), "the font-install pass cannot draw");++ assert!(fonts.platform_output.ime.is_none(), "no custom descriptor is published");++ let guard = ctx.data(|d| d.get_temp::<ResetGuard>(reset_id(egui::ViewportId::ROOT))).expect("the waiting guard");++ assert!(guard.suspended && guard.request.is_none(), "the all-exit finalizer retired it without allocating");++ let second = draw_app_pass(&mut app, &ctx, &frame, vec![])++ .platform_output++ .ime++ .expect("returning to a drawing pass publishes the custom descriptor")++ .reset_request++ .expect("the deferred request");++ assert_ne!(first, second);++++ // The device-loss early return is the other all-exit path. Preset the close bookkeeping++ // so this test does not autosave; the pass must still retire the waiting guard.++ app.gpu_failure_applied = Some(true);++ app.device_lost_close = Some(true);++ let lost = draw_app_pass(&mut app, &ctx, &frame, vec![]);++ assert!(lost.platform_output.ime.is_none(), "a lost renderer publishes no descriptor");++ let guard = ctx.data(|d| d.get_temp::<ResetGuard>(reset_id(egui::ViewportId::ROOT))).expect("the waiting guard");++ assert!(guard.suspended && guard.request.is_none(), "the device-loss finalizer retired it without allocating");++ app.gpu_failure_applied = None;++ let third = draw_app_pass(&mut app, &ctx, &frame, vec![])++ .platform_output++ .ime++ .expect("a drawing pass publishes the custom descriptor again")++ .reset_request++ .expect("the deferred request is one-shot");++ assert_ne!(third, second);++ }++++ #[test]++ fn ime_delete_without_a_session_or_with_an_empty_range_does_nothing() {++ let (mut app, lid) = editor("abc", 1, 1);++ feed(&mut app, vec![egui::Event::Ime(egui::ImeEvent::DeleteSurroundingBytes { before_bytes: 0, after_bytes: 0 })]);++ assert_eq!(doc_text(&app, lid), "abc");++ app.session.state.text_edit = None;++ feed(&mut app, vec![egui::Event::Ime(egui::ImeEvent::DeleteSurroundingBytes { before_bytes: 2, after_bytes: 0 })]);++ assert_eq!(doc_text(&app, lid), "abc");++ }}diff --cc crates/ui-egui/src/panels/viewer_tools.rsindex d229f272f,d229f272f..bde1869fd--- a/crates/ui-egui/src/panels/viewer_tools.rs+++ b/crates/ui-egui/src/panels/viewer_tools.rs@@@ -25,7 -25,7 +25,7 @@@ pub(crate) const SNAP_PX: f64 = 8.0const SNAP_COLOR: Color32 = Color32::from_rgb(0xff, 0xd2, 0x3c);fn snap_id() -> egui::Id {-- egui::Id::new("viewer-snap")++ egui::Id::unique("viewer-snap")}/// Layer snapping is on: the Snapping checkbox (View ▸ Snapping), inverted while Cmd/Ctrl is held.@@@ -226,10 -226,10 +226,10 @@@ pub(crate) fn rulers(app: &mut Effectcrp.line_segment([corner.center() - vec2(4.0, 0.0), corner.center() + vec2(4.0, 0.0)], tick);p.line_segment([corner.center() - vec2(0.0, 4.0), corner.center() + vec2(0.0, 4.0)], tick);let cr = ui-- .interact(corner, egui::Id::new("vw-ruler-origin"), Sense::click_and_drag())++ .interact(corner, egui::Id::unique("vw-ruler-origin"), Sense::click_and_drag()).on_hover_text(crate::i18n::tr("Ruler zero point (drag to move, double-click to reset)"));app.auto.add("viewer.ruler.origin", corner, "Ruler zero point");-- let fg = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::new("vw-ruler-fg")));++ let fg = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::unique("vw-ruler-fg")));if cr.dragged()&& let Some(hp) = cr.interact_pointer_pos(){@@@ -248,7 -248,7 +248,7 @@@// Guides dragged out of the rulers: the top ruler makes horizontal guides, the left one// vertical guides.for (r, vertical, id) in [(top, false, "top"), (left, true, "left")] {-- let resp = ui.interact(r, egui::Id::new(("vw-ruler", id)), Sense::drag()).on_hover_text(crate::i18n::tr("Drag to create a guide"));++ let resp = ui.interact(r, egui::Id::unique(("vw-ruler", id)), Sense::drag()).on_hover_text(crate::i18n::tr("Drag to create a guide"));app.auto.add(&format!("viewer.ruler.{id}"), r, if vertical { "Vertical ruler" } else { "Horizontal ruler" });if resp.hovered() {ui.ctx().set_cursor_icon(if vertical { egui::CursorIcon::ResizeHorizontal } else { egui::CursorIcon::ResizeVertical });@@@ -320,11 -320,11 +320,11 @@@ pub(crate) fn proportional_grid(app: &E/// Remember the region of interest the displayed texture was rendered with.pub(crate) fn set_texture_roi(ctx: &egui::Context, roi: Option<[f64; 4]>) {-- ctx.data_mut(|d| d.insert_temp(egui::Id::new("viewer-tex-roi"), roi));++ ctx.data_mut(|d| d.insert_temp(egui::Id::unique("viewer-tex-roi"), roi));}fn texture_roi(ctx: &egui::Context) -> Option<[f64; 4]> {-- ctx.data(|d| d.get_temp::<Option<[f64; 4]>>(egui::Id::new("viewer-tex-roi"))).flatten()++ ctx.data(|d| d.get_temp::<Option<[f64; 4]>>(egui::Id::unique("viewer-tex-roi"))).flatten()}/// The comp area ([x, y, w, h], comp pixels) the shown frame covers: its region of interest or@@@ -398,7 -398,7 +398,7 @@@ pub(crate) fn draw_frame(app: &mut Effe(std::sync::Arc::as_ptr(&s.image) as usize, opts.channel.id(), opts.colorized, opts.exposure.to_bits(), &dc_key).hash(&mut h);h.finish()};-- let id = egui::Id::new("viewer-snapshot-tex");++ let id = egui::Id::unique("viewer-snapshot-tex");let tex = match ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(id)) {Some((k, tex)) if k == key => tex,_ => {@@@ -454,7 -454,7 +454,7 @@@(std::sync::Arc::as_ptr(&src) as usize, opts.channel.id(), opts.colorized, opts.exposure.to_bits(), &dc_key, minify).hash(&mut h);h.finish()};-- let id = egui::Id::new("viewer-display-tex");++ let id = egui::Id::unique("viewer-display-tex");let tex = match ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(id)) {Some((k, tex)) if k == key => tex,_ => {@@@ -479,7 -479,7 +479,7 @@@ fn fitted_uv(ctx: &egui::Context, size/// A popup list above `anchor` (selected entries highlighted); entries register/// `viewer.<auto>.<n>` automation ids.fn popup(app: &mut EffectcraftApp, ui: &mut egui::Ui, id: &str, anchor: Rect, items: &[(String, bool)], auto: &str) -> Option<usize> {-- let pid = egui::Id::new(id);++ let pid = egui::Id::unique(id);if !widgets::popup_is_open(ui, pid) {return None;}@@@ -506,7 -506,7 +506,7 @@@}fn toggle_popup(ui: &egui::Ui, id: &str) {-- let pid = egui::Id::new(id).with("open");++ let pid = egui::Id::unique(id).with("open");let open: bool = ui.data(|d| d.get_temp(pid).unwrap_or(false));ui.data_mut(|d| d.insert_temp(pid, !open));}@@@ -529,8 -529,8 +529,8 @@@ pub(crate) fn magnification_menulet t = app.tokens;let ppp = ui.ctx().pixels_per_point();let pop = format!("{id}-pop");-- let response =-- widgets::dropdown(ui, r, &magnification_label(zoom * ppp * 100.0), &t, egui::Id::new(id)).on_hover_text(crate::i18n::tr("Magnification ratio popup"));++ let response = widgets::dropdown(ui, r, &magnification_label(zoom * ppp * 100.0), &t, egui::Id::unique(id))++ .on_hover_text(crate::i18n::tr("Magnification ratio popup"));if response.clicked() {toggle_popup(ui, &pop);}@@@ -637,7 -637,7 +637,7 @@@ fn bottom_bar_contents(app: &mut Effectlet r = Rect::from_min_size(pos2(x, cy - 10.0), vec2(84.0, 20.0));let scale = app.viewer_scale(zoom, ppp);let res = app.viewer_res();-- let response = widgets::dropdown(ui, r, &resolution_label(res, scale), &t, egui::Id::new("vw-res"))++ let response = widgets::dropdown(ui, r, &resolution_label(res, scale), &t, egui::Id::unique("vw-res")).on_hover_text(crate::i18n::tr("Resolution/Down Sample Factor Popup"));if response.clicked() {toggle_popup(ui, "vw-res-pop");@@@ -665,7 -665,7 +665,7 @@@let r = Rect::from_min_size(pos2(*x, cy - 11.0), vec2(22.0, 22.0));// The tip is the English source: the tooltip is looked up in the catalog, while the// automation label stays English for scripts and tests.-- let resp = widgets::icon_button(ui, r, icon, on, &t, egui::Id::new(("vw-btn", id))).on_hover_text(crate::i18n::tr(tip));++ let resp = widgets::icon_button(ui, r, icon, on, &t, egui::Id::unique(("vw-btn", id))).on_hover_text(crate::i18n::tr(tip));auto.add_response(&format!("viewer.{id}"), &resp, tip);*x += 24.0;(resp.clicked(), r)@@@ -786,7 -786,7 +786,7 @@@let renderers = [(Renderer::Classic3D, "Classic 3D", "classic3D"), (Renderer::Advanced3D, "Advanced 3D", "advanced3D")];let current = renderers.iter().find(|(r, ..)| *r == comp.renderer).map_or("Classic 3D", |(_, label, _)| *label);let r = Rect::from_min_size(pos2(x, cy - 10.0), vec2(96.0, 20.0));-- if widgets::dropdown(ui, r, crate::i18n::tr(current), &t, egui::Id::new("vw-3d")).clicked() {++ if widgets::dropdown(ui, r, crate::i18n::tr(current), &t, egui::Id::unique("vw-3d")).clicked() {toggle_popup(ui, "vw-3d-pop");}app.auto.add("viewer.renderer3d", r, current);@@@ -801,7 -801,7 +801,7 @@@let cid = app.session.active_comp_id();let cur = cid.and_then(|c| app.session.state.views3d.get(&c)).map(|v| v.current).unwrap_or_default();let r = Rect::from_min_size(pos2(x, cy - 10.0), vec2(118.0, 20.0));-- let response = widgets::dropdown(ui, r, cur.label(), &t, egui::Id::new("vw-cam"));++ let response = widgets::dropdown(ui, r, cur.label(), &t, egui::Id::unique("vw-cam"));if response.clicked() {toggle_popup(ui, "vw-cam-pop");}@@@ -824,8 -824,8 +824,8 @@@let g = p.layout_no_wrap(tc, Tokens::mono(12.0), t.timecode);let tr = Rect::from_min_size(pos2(x + 4.0, cy - 9.0), g.size() + vec2(8.0, 4.0));p.galley(pos2(tr.min.x + 4.0, tr.min.y + 2.0), g, t.timecode);-- let resp = ui.interact(tr, egui::Id::new("vw-timecode"), Sense::click());-- resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, "Current time"));++ let resp = ui.interact(tr, egui::Id::unique("vw-timecode"), Sense::click());++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, "Current time"));if resp.has_focus() {p.rect_stroke(tr.shrink(1.0), 2.0, Stroke::new(1.0, t.focus), StrokeKind::Inside);}diff --cc crates/ui-egui/src/panels/viewers.rsindex 140dd6f8a,140dd6f8a..097cbeced--- a/crates/ui-egui/src/panels/viewers.rs+++ b/crates/ui-egui/src/panels/viewers.rs@@@ -89,7 -89,7 +89,7 @@@ pub fn show(app: &mut EffectcraftApp, ulet ctx = ui.ctx().clone();let p = ui.painter().with_clip_rect(rect);p.rect_filled(rect, 0.0, t.pasteboard);-- let resp = ui.interact(rect, egui::Id::new(("passive-viewer", id)), Sense::click()).on_hover_text(tr("Click to make this viewer active"));++ let resp = ui.interact(rect, egui::Id::unique(("passive-viewer", id)), Sense::click()).on_hover_text(tr("Click to make this viewer active"));app.auto.add(&format!("viewers.{id}"), rect, "Composition viewer (click to make it active)");match comp_of(app, id).and_then(|cid| Some((cid, app.session.project.comp(cid)?.clone()))) {Some((cid, c)) => {@@@ -137,7 -137,7 +137,7 @@@ fn set_texturedc: Option<effectcraft_engine::viewer::DisplayColor>,dkey: u64,) {-- let dc_id = egui::Id::new(("passive-viewer-display", id));++ let dc_id = egui::Id::unique(("passive-viewer-display", id));let same_display = ctx.data(|d| d.get_temp::<u64>(dc_id)) == Some(dkey);if let Some((k, _)) = app.passive_tex.get_mut(&id)&& *k == keydiff --cc crates/ui-egui/src/pointer_wrap.rsindex a4aefe33a,a4aefe33a..705c38be2--- a/crates/ui-egui/src/pointer_wrap.rs+++ b/crates/ui-egui/src/pointer_wrap.rs@@@ -13,7 -13,7 +13,7 @@@ struct State}fn state_id() -> Id {-- Id::new("numeric-pointer-wrap")++ Id::unique("numeric-pointer-wrap")}/// Opt in only number scrubs, never object, keyframe, panel or scrollbar drags.@@@ -231,12 -231,12 +231,12 @@@ mod testscrate::widgets::drag_value(egui::DragValue::new(&mut self.value).speed(1.0).max_decimals(3)),);} else if self.ordinary {-- ui.interact(Rect::from_min_size(pos2(100.0, 100.0), vec2(60.0, 20.0)), Id::new("ordinary"), egui::Sense::drag());++ ui.interact(Rect::from_min_size(pos2(100.0, 100.0), vec2(60.0, 20.0)), Id::unique("ordinary"), egui::Sense::drag());} else if self.angle {let (rr, dr, value) = crate::panels::fx_widgets::angle_field(ui,pos2(100.0, 100.0),-- Id::new("scrub"),++ Id::unique("scrub"),self.value,1,&crate::theme::Tokens::for_kind(crate::theme::ThemeKind::Dark),@@@ -249,7 -249,7 +249,7 @@@let (_, value, _) = crate::widgets::hot_number_at(ui,pos2(100.0, 100.0),-- Id::new("scrub"),++ Id::unique("scrub"),self.value,1.0,(-1e9, 1e9),diff --cc crates/ui-egui/src/prefs_live.rsindex 321e432e9,321e432e9..ee222c892--- a/crates/ui-egui/src/prefs_live.rs+++ b/crates/ui-egui/src/prefs_live.rs@@@ -11,10 -11,10 +11,14 @@@ use serde_json::jsonuse crate::EffectcraftApp;use crate::frames::FrameKey;--/// Run once per frame, before the panels draw.--pub fn frame(app: &mut EffectcraftApp, ctx: &egui::Context) {-- memory_watch(app, ctx);++/// Settings read once per tick, before any paint (they must keep working while hidden).++pub fn tick(app: &mut EffectcraftApp, ctx: &egui::Context, now: f64) {++ memory_watch(app, ctx, now);home_on_open(app, ctx);++}++++/// Settings that show or draw something: run in the UI pass, before the panels draw.++pub fn frame(app: &mut EffectcraftApp, ctx: &egui::Context) {video_preview(app, ctx);}@@@ -29,7 -29,7 +33,7 @@@ pub fn dropped_files(app: &mut Effectcrif hovered != 0 {let label =if hovered == 1 { crate::i18n::tr("Drop file to import").to_string() } else { crate::i18n::tr_args("Drop {} files to import", &[&hovered]) };-- let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::new("native-file-drop")));++ let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::unique("native-file-drop")));painter.rect_stroke(bounds.shrink(8.0), 6.0, Stroke::new(2.0, app.tokens.accent), StrokeKind::Inside);let hint = Rect::from_center_size(bounds.center(), vec2(300.0, 46.0));painter.rect_filled(hint, 6.0, app.tokens.panel_bg);@@@ -120,9 -120,9 +124,8 @@@/// Re-read the system's free memory every 30 s (cache budgets follow it; on Windows each/// reading starts PowerShell in the background, so it isn't done more often).--fn memory_watch(app: &mut EffectcraftApp, ctx: &egui::Context) {-- let now = ctx.input(|i| i.time);-- let id = egui::Id::new("prefs-memory-watch");++pub(crate) fn memory_watch(app: &mut EffectcraftApp, ctx: &egui::Context, now: f64) {++ let id = egui::Id::unique("prefs-memory-watch");let last = ctx.data(|d| d.get_temp::<f64>(id));if last.is_some_and(|t| now - t < 30.0) {return;@@@ -135,8 -135,8 +138,8 @@@}/// Startup ▸ Show Home Screen When Opening a Project.--fn home_on_open(app: &mut EffectcraftApp, ctx: &egui::Context) {-- let id = egui::Id::new("prefs-last-project");++pub(crate) fn home_on_open(app: &mut EffectcraftApp, ctx: &egui::Context) {++ let id = egui::Id::unique("prefs-last-project");let path = app.session.path.clone();let last = ctx.data(|d| d.get_temp::<Option<String>>(id));ctx.data_mut(|d| d.insert_temp(id, path.clone()));@@@ -169,7 -169,7 +172,7 @@@ fn video_preview(app: &mut EffectcraftAreturn;}let v = app.session.prefs.video.clone();-- let tex_id = egui::Id::new("video-preview-tex");++ let tex_id = egui::Id::unique("video-preview-tex");let update = !app.playback.playing || v.output_during_playback;let key = app.viewer_shown.as_ref().map(|(_, k)| *k);let cur: Option<(FrameKey, egui::TextureHandle)> = ctx.data(|d| d.get_temp(tex_id));diff --cc crates/ui-egui/src/theme.rsindex 932b0928f,932b0928f..ebe910b56--- a/crates/ui-egui/src/theme.rs+++ b/crates/ui-egui/src/theme.rs@@@ -322,6 -322,6 +322,10 @@@ static INTER_REGULAR: &[u8] = include_bstatic INTER_MEDIUM: &[u8] = include_bytes!("../../../assets/fonts/Inter-Medium.ttf");static INTER_SEMIBOLD: &[u8] = include_bytes!("../../../assets/fonts/Inter-SemiBold.ttf");static JETBRAINS_MONO: &[u8] = include_bytes!("../../../assets/fonts/JetBrainsMono-Regular.ttf");++/// Chrome symbols (`✔` U+2714, `▣` U+25A3, …) that Inter, Inter Medium/SemiBold and++/// JetBrains Mono do not cover. 0.37's default font set no longer includes the old emoji++/// fonts, and named families (`medium`, `semibold`) never received egui's default fallbacks.++static NOTO_SYMBOLS2: &[u8] = include_bytes!("../../../assets/fonts/NotoSansSymbols2-Regular.ttf");/// Install fonts (Inter, Inter Medium/SemiBold, JetBrains Mono) and egui visuals. `language` is the/// resolved interface language from [`crate::i18n::language`] (`en`, `ja`, `zh-hans` or `zh-hant`),@@@ -336,16 -336,16 +340,20 @@@ pub fn install(ctx: &egui::Context, t:fonts.font_data.insert("inter-medium".into(), Arc::new(FontData::from_static(INTER_MEDIUM)));fonts.font_data.insert("inter-semibold".into(), Arc::new(FontData::from_static(INTER_SEMIBOLD)));fonts.font_data.insert("jbmono".into(), Arc::new(FontData::from_static(JETBRAINS_MONO)));++ fonts.font_data.insert("noto-symbols2".into(), Arc::new(FontData::from_static(NOTO_SYMBOLS2)));fonts.families.entry(FontFamily::Proportional).or_default().insert(0, "inter".into());fonts.families.entry(FontFamily::Monospace).or_default().insert(0, "jbmono".into());fonts.families.insert(FontFamily::Name("semibold".into()), vec!["inter-semibold".into(), "inter".into()]);fonts.families.insert(FontFamily::Name("medium".into()), vec!["inter-medium".into(), "inter".into()]);// Inter and egui's own fallbacks have no small triangles (the `▸` of "File ▸ Import"), which// would draw as missing-glyph boxes: JetBrains Mono fills in the symbols the others lack.++ // Noto Sans Symbols 2 follows it for the check/box glyphs (`✔`, `▣`) that JetBrains Mono++ // lacks; without it, named families such as `medium` fall straight through to tofu.for (family, stack) in &mut fonts.families {if *family != FontFamily::Monospace {stack.push("jbmono".into());}++ stack.push("noto-symbols2".into());}install_script_fallbacks(&mut fonts, language);ctx.set_fonts(fonts);@@@ -786,7 -786,7 +794,8 @@@ mod tests// another test has loaded a system face without `◻` (the fallback tries loaded faces first).let uv = |s: String| ctx.fonts_mut(|f| f.layout_no_wrap(s, id.clone(), egui::Color32::WHITE).rows[0].glyphs[0].uv_rect);let missing = uv("\u{10ffff}".into());-- for c in "▸•›·▶◀●○⚠…×".chars() {++ // Every chrome symbol the panels, menus, shortcut labels and buttons draw.++ for c in "✔▣✓⚠▶◀▸●○…×›•·−←→↑↓⌘⇧⌥⌃".chars() {let drawn = uv(c.to_string());assert_ne!((drawn.min, drawn.max), (missing.min, missing.max), "{c} has no glyph in {id:?}");}@@@ -807,7 -807,7 +816,7 @@@}let Some(font) = face.font() else { return };let bytes = font.data().as_bytes();-- let covered = fonts_def.font_data.values().any(|d| d.font.as_ref() == bytes && d.index == face.info.index);++ let covered = fonts_def.font_data.values().any(|d| d.bytes() == bytes && d.index == face.info.index);assert!(covered, "a face covering Hangul must be registered with egui");}@@@ -823,7 -823,7 +832,7 @@@.iter().map(|name| {let data = fonts.font_data.get(name).unwrap_or_else(|| panic!("{name} is missing its font data"));-- (data.font.as_ref(), data.index)++ (data.bytes(), data.index)}).collect();for (i, a) in faces.iter().enumerate() {diff --cc crates/ui-egui/src/widgets.rsindex c005224d0,4a8bdb8e0..e54fe87c1--- a/crates/ui-egui/src/widgets.rs+++ b/crates/ui-egui/src/widgets.rs@@@ -21,8 -23,8 +23,8 @@@ struct TabOrder}fn tab_order_id(ui: &Ui) -> egui::Id {-- let panel = ui.stack().iter().find(|s| s.tags().contains(PANEL_TAG)).map_or(egui::Id::NULL, |s| s.id);-- egui::Id::new(("hot-tab-order", panel))++ let panel = ui.stack().iter().find(|s| s.tags().contains(PANEL_TAG)).map_or(egui::Id::NULL, |s| s.scope_id);++ egui::Id::unique(("hot-tab-order", panel))}/// Puts hot-text field `id` in its panel's Tab order. True when a Tab in the field before it@@@ -262,8 -274,8 +274,13 @@@ pub fn icon_toggle(ui: &mut Ui, rect: R}/// Icon button (toolbar style) with optional active state.++///++/// The icon alone carries no text, so the button's accessible name is its tooltip: callers chain++/// `.on_hover_text(…)`, which names the node this reports (an icon button with neither is unnamed++/// and kittest's accessibility check flags it).pub fn icon_button(ui: &mut Ui, rect: Rect, icon: Icon, active: bool, t: &Tokens, id: egui::Id) -> Response {let resp = ui.interact(rect, id, Sense::click());++ resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::Button, ui.is_enabled(), active, ""));if active {ui.painter().rect_filled(rect, 4.0, t.accent);} else if resp.hovered() {@@@ -326,7 -338,7 +343,7 @@@ fn field(ui: &mut Ui, rect: Rect, text// As tall as the field, so the text and the hint sit on its middle (they sat high, #581)..min_size(inner.size()).font(Tokens::ui(12.0))-- .vertical_align(egui::Align::Center),++ .align(egui::Align2::LEFT_CENTER),)}@@@ -338,6 -350,6 +355,15 @@@ pub fn dropdown(ui: &mut Ui, rect: Rect/// [`dropdown`] with a tooltip `tip` (shown always; it replaces the elided text's tooltip).pub fn dropdown_tip(ui: &mut Ui, rect: Rect, text: &str, tip: Option<&str>, t: &Tokens, id: egui::Id) -> Response {let resp = ui.interact(rect, id, Sense::click());++ // A combo box shows its current value; with no separate label widget that value is also the++ // name a screen reader announces. An empty value falls back to the tooltip (or a generic name)++ // so the control is still reachable.++ let name = match (text.is_empty(), tip) {++ (false, _) => text.to_string(),++ (true, Some(tip)) if !tip.is_empty() => tip.to_string(),++ _ => crate::i18n::tr("Options").to_string(),++ };++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::ComboBox, ui.is_enabled(), &name));ui.painter().rect_filled(rect, 3.0, if resp.hovered() { t.hover } else { t.field_bg });ui.painter().rect_stroke(rect, 3.0, Stroke::new(1.0, t.field_border), StrokeKind::Inside);// Text that doesn't fit before the arrow is elided (narrow panels).@@@ -370,6 -382,6 +396,7 @@@/// Text button with a subtle fill.pub fn text_button(ui: &mut Ui, rect: Rect, text: &str, primary: bool, t: &Tokens, id: egui::Id) -> Response {let resp = ui.interact(rect, id, Sense::click());++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), text));let bg = if primary {if resp.hovered() { t.accent_hover } else { t.accent }} else if resp.hovered() {@@@ -411,7 -423,7 +438,7 @@@ pub fn scroll_bar(ui: &mut Ui, auto: &mlet thumb_len = (len * len / (len + max.max(0.0)).max(1.0)).max(16.0).min(len).max(0.0);let travel = (len - thumb_len).max(1.0);let thumb_at = |s: f32| track.min[a] + (len - thumb_len) * if max > 0.0 { (s / max).clamp(0.0, 1.0) } else { 0.0 };-- let resp = ui.interact(track.expand2(if vertical { vec2(3.0, 0.0) } else { vec2(0.0, 3.0) }), egui::Id::new(key), Sense::drag());++ let resp = ui.interact(track.expand2(if vertical { vec2(3.0, 0.0) } else { vec2(0.0, 3.0) }), egui::Id::unique(key), Sense::drag());let pressed = resp.is_pointer_button_down_on() && ui.input(|i| i.pointer.any_pressed());let mut s = scroll;if let Some(p) = resp.interact_pointer_pos().filter(|p| pressed && !(thumb_at(scroll)..=thumb_at(scroll) + thumb_len).contains(&p[a])) {@@@ -482,8 -494,8 +509,8 @@@ pub fn check_label(on: bool, label: &stif on { format!("✓ {label}") } else { format!(" {label}") }}--fn label_swatch_id() -> egui::Id {-- egui::Id::new("label-swatch")++fn label_swatch_id() -> egui::IdSalt {++ egui::IdSalt::new("label-swatch")}/// The colour swatch of a Label menu row, as an atom for its button: Label menus show each@@@ -494,7 -506,7 +521,7 @@@ pub fn label_swatch() -> egui::Atom<'st}/// Paint the [`label_swatch`] of a laid-out button: label `l`'s colour, an empty box for None.--pub fn paint_label_swatch(ui: &Ui, out: &egui::AtomLayoutResponse, l: effectcraft_engine::color::Label, t: &Tokens) {++pub fn paint_label_swatch(ui: &Ui, out: &egui::WidgetAtomResponse, l: effectcraft_engine::color::Label, t: &Tokens) {let Some(r) = out.rect(label_swatch_id()) else { return };let r = Rect::from_center_size(r.center(), vec2(11.0, 11.0));if l == effectcraft_engine::color::Label::None {@@@ -592,7 -642,7 +657,7 @@@ pub(crate) fn note_open_popup_list(ctx/// The pass a [`popup_list`] was last drawn in.fn popup_list_pass_id() -> egui::Id {-- egui::Id::new("popup-list-pass")++ egui::Id::unique("popup-list-pass")}/// Whether a menu, context menu or popup list is open, or the menu bar has the keyboard (as of@@@ -607,9 -657,78 +672,94 @@@ pub fn any_menu_open(ctx: &egui::Contex/// whole: egui sizes a new menu from a default 400 pt area, so without a minimum a longer one/// (Window ▸ Workspace) got stuck at that height with its last entries scrolled out of view/// (#191).- pub fn menu_scroll<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R {+ ///+ /// While the bar is mid press-and-browse (`browsing`), resting the pointer against the menu's+ /// bottom or top edge scrolls it from there — a crawl at first, then a run, as native menus do —+ /// so a long list can be walked with no wheel. Without the hold the edges do nothing: the wheel+ /// and the scroll bar are how a normally opened menu scrolls.+ pub fn menu_scroll<R>(ui: &mut Ui, browsing: bool, add: impl FnOnce(&mut Ui) -> R) -> R {let max_h = ui.ctx().content_rect().height() - 40.0;- egui::ScrollArea::vertical().max_height(max_h).min_scrolled_height(max_h).show(ui, add).inner- let out = egui::ScrollArea::vertical().max_height(max_h).min_scrolled_height(max_h).show(ui, add);- edge_scroll(ui, &out, browsing);++ let pending = ui.scope_id().with("menu-edge-scroll-offset");++ let target = ui.ctx().data_mut(|d| d.remove_temp::<f32>(pending));++ let mut area = egui::ScrollArea::vertical().max_height(max_h).min_scrolled_height(max_h);++ if let Some(target) = target {++ area = area.vertical_scroll_offset(target);++ }++ let out = area.show(ui, add);++ if let Some(target) = edge_scroll(ui, &out, browsing) {++ ui.ctx().data_mut(|d| d.insert_temp(pending, target));++ }+ out.inner+ }++ /// The edge scroll [`menu_scroll`] adds while browsing: with the pointer resting in the bottom+ /// (top) band of an overflowing menu, its content crawls up (down) after a short pause, ramps to+ /// a run and stops at the end — and stops at once when the pointer leaves the band or the hold.+ ///+ /// This runs after `ScrollArea::show`, which laid the menu out for the offset it had, so the new-/// offset goes into the area's state and shows on the next frame: a frame of lag, invisible at-/// these speeds. egui's own scrolling (wheel, drag, scroll bar) is untouched.-fn edge_scroll<R>(ui: &Ui, out: &egui::containers::scroll_area::ScrollAreaOutput<R>, browsing: bool) {++/// offset is supplied once to the next draw's builder: a frame of lag, invisible at these speeds.++/// That explicit vertical offset cancels prior momentum on that draw; later wheel and scroll-bar++/// input still applies normally. A replay can consume the target but cannot queue another step++/// at the same input time.++fn edge_scroll<R>(ui: &Ui, out: &egui::containers::scroll_area::ScrollAreaOutput<R>, browsing: bool) -> Option<f32> {+ /// How far from the top / bottom edge the pointer starts the crawl (points).+ const BAND: f32 = 18.0;+ /// The pause before the crawl starts: a pointer merely grazing the edge must not jump.+ const DELAY: f32 = 0.12;+ /// Points per second: a crawl at first, reaching the run about three quarters of a second in.+ const CRAWL: f32 = 45.0;+ const RAMP: f32 = 700.0;+ const RUN: f32 = 560.0;++ let ctx = ui.ctx();+ let over = out.content_size.y - out.inner_rect.height();+ let dir = match (browsing, over > 0.0, ctx.input(|i| i.pointer.latest_pos())) {+ (true, true, Some(p)) if out.inner_rect.contains(p) => {+ if p.y >= out.inner_rect.max.y - BAND {+ 1+ } else if p.y <= out.inner_rect.min.y + BAND {+ -1+ } else {+ 0+ }+ }+ _ => 0,+ };+ // The clock the pause counts from, kept per menu: entering or leaving an edge band restarts+ // it, so a later stay there crawls off again instead of jumping straight to the run.+ let now = ctx.input(|i| i.time);+ let key = out.id.with("menu-edge-scroll");+ let (since, prev) = ctx.data(|d| d.get_temp::<(f64, i32)>(key)).unwrap_or((now, 0));+ let since = if dir == prev {+ since+ } else {+ ctx.data_mut(|d| d.insert_temp(key, (now, dir)));+ now+ };+ if dir == 0 {- return;++ return None;+ }+ if now - since < f64::from(DELAY) {+ // A pointer resting still fires no events: keep the frames coming until the crawl runs.+ ctx.request_repaint();- return;++ return None;+ }+ let speed = (CRAWL + RAMP * ((now - since) as f32 - DELAY)).min(RUN);+ let crawl = ctx.input(|i| i.unstable_dt).min(0.05) * speed * dir as f32;- let new = (out.state.offset.y + crawl).clamp(0.0, over);- if new != out.state.offset.y {- let mut state = out.state;- state.offset.y = new;- state.store(ctx, out.id);++ let old = out.state.unclamped_offset().y;++ let new = (old + crawl).clamp(0.0, over);++ if new == old {+ // At the end of the list the crawl stands still and asks for no more frames.- ctx.request_repaint();++ return None;++ }++ ctx.request_repaint();++ let stepped = out.id.with("menu-edge-scroll-step");++ if ctx.data(|d| d.get_temp::<f64>(stepped)) == Some(now) {++ return None;+ }++ // Stamp the queue operation, not consumption: a later real frame must still take a step.++ ctx.data_mut(|d| d.insert_temp(stepped, now));++ Some(new)}/// egui's menu style with no gap between the rows: the gap the app's item spacing left betweendiff --cc crates/ui-egui/tests/it/main.rsindex 7dc153343,3aae7c2ab..b5492c1b5--- a/crates/ui-egui/tests/it/main.rs+++ b/crates/ui-egui/tests/it/main.rs@@@ -83,3 -87,3 +87,18 @@@ mod ui_workflow_selectionmod ui_workspace_focus;mod viewer_geometry;mod viewer_passive_display;++++/// Register the managed build's canonical craft-fonts checkout (`CRAFT_FONTS_DIR/fonts`) through++/// the same directory source production scans for `EFFECTCRAFT_FONT_DIRS`. The UI tests then render++/// real Japanese glyphs from the canonical external input instead of relying on host fonts.++pub(crate) fn add_canonical_test_fonts() {++ use effectcraft_text::fonts::{self, DirectorySource};++ static REGISTER: std::sync::Once = std::sync::Once::new();++ REGISTER.call_once(|| {++ let Some(root) = std::env::var_os("CRAFT_FONTS_DIR") else { return };++ let dir = std::path::PathBuf::from(root).join("fonts");++ if dir.is_dir() {++ fonts::add_source(&DirectorySource { dirs: vec![dir] });++ }++ });++}diff --cc crates/ui-egui/tests/it/render_queue_snapshot.rsindex 702421caf,702421caf..d054511af--- a/crates/ui-egui/tests/it/render_queue_snapshot.rs+++ b/crates/ui-egui/tests/it/render_queue_snapshot.rs@@@ -31,7 -31,7 +31,7 @@@ fn render_queue_panel_snapshot()let ids: Vec<u64> = s.project.render_queue.iter().take(3).map(|i| i.id).collect();let mut app = Some(EffectcraftApp::new(s));let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).build_eframe(|_| app.take().expect("app"));-- h.ctx.data_mut(|d| d.insert_temp(egui::Id::new("rq-ui"), (ids, None::<u64>)));++ h.ctx.data_mut(|d| d.insert_temp(egui::Id::unique("rq-ui"), (ids, None::<u64>)));h.state_mut().show_panel(effectcraft_ui_egui::dock::PanelKind::RenderQueue);h.run_steps(4);let img = h.render().expect("render");diff --cc crates/ui-egui/tests/it/shared_docking_ui.rsindex ad56e68d5,ad56e68d5..29d591a1d--- a/crates/ui-egui/tests/it/shared_docking_ui.rs+++ b/crates/ui-egui/tests/it/shared_docking_ui.rs@@@ -154,7 -154,7 +154,9 @@@ fn pointer_drop_merges_floats_and_redoclet from = rect(&h, "panel.tab.Info").center();drag(&mut h, from, pos2(700.0, 400.0), Modifiers::COMMAND);assert_eq!(h.state().ui.floating.len(), 1);-- assert_eq!(h.get_by_label("Resize floating panel").accesskit_node().role(), egui::accesskit::Role::Button);++ // The grip is a resize handle: the migration's role mapping (`ResizeHandle → Splitter`) applies++ // to floating panels too, and the widget reports it (`dock_ui.rs`).++ assert_eq!(h.get_by_label("Resize floating panel").accesskit_node().role(), egui::accesskit::Role::Splitter);action_log.push(action_state(&h, "floated"));let original = h.state().ui.floating[0].rect;let grip = rect(&h, "panel.float.0.resize").center();@@@ -162,7 -162,7 +164,7 @@@assert!(h.state().ui.floating[0].rect[2] > original[2] + 25.0);assert!(h.state().ui.floating[0].rect[3] > original[3] + 15.0);action_log.push(action_state(&h, "resized"));-- let grip_id = egui::Id::new(("floating-panel", PanelKind::Info.id())).with("resize");++ let grip_id = egui::Id::unique(("floating-panel", PanelKind::Info.id())).with("resize");assert_eq!(h.ctx.memory(|memory| memory.focused()), Some(grip_id));let before_keys = h.state().ui.floating[0].rect;for key in [egui::Key::ArrowRight, egui::Key::ArrowDown] {@@@ -365,7 -365,7 +367,7 @@@ fn accordion_resize_routes_pointer_and_};h.run_steps(3);let project = h.state().session.project.clone();-- let id = egui::Id::new(("dock-gutter", "s0".to_string()));++ let id = egui::Id::unique(("dock-gutter", "s0".to_string()));h.ctx.memory_mut(|memory| memory.request_focus(id));h.run_steps(2);for pressed in [true, false] {diff --cc crates/ui-egui/tests/it/ui_agent_audit.rsindex a14f77838,a14f77838..c3f556457--- a/crates/ui-egui/tests/it/ui_agent_audit.rs+++ b/crates/ui-egui/tests/it/ui_agent_audit.rs@@@ -29,7 -29,7 +29,8 @@@ fn harness(s: Session) -> Harness<'statfn send(h: &mut Harness<'_, EffectcraftApp>, method: &str, params: Value) -> Value {let ctx = h.ctx.clone();let (req, _rx) = ControlRequest::new(method, params);-- match control::handle(h.state_mut(), &ctx, &req) {++ let now = h.state().now();++ match control::handle(h.state_mut(), &ctx, &req, now) {Outcome::Done(v) => v,_ => panic!("{method}: no immediate reply"),}@@@ -70,7 -70,7 +71,7 @@@ fn interactive(ctx: &egui::Context) ->}let info = w.info(r.id);// Selectable text (labels sense drags to select their text) is not a control.-- if info.is_some_and(|i| i.typ == egui::WidgetType::Label) {++ if info.is_some_and(|i| i.role == egui::Role::Label) {continue;}out.push((ir, info.and_then(|i| i.label.clone()).unwrap_or_default()));diff --cc crates/ui-egui/tests/it/ui_audio_scrub.rsindex 02fefb14f,02fefb14f..c748afe8e--- a/crates/ui-egui/tests/it/ui_audio_scrub.rs+++ b/crates/ui-egui/tests/it/ui_audio_scrub.rs@@@ -9,6 -9,6 +9,7 @@@ use effectcraft_engine::project::ItemIduse effectcraft_engine::time::Tick;use effectcraft_ui_egui::EffectcraftApp;use effectcraft_ui_egui::audio::{AudioDevice, AudioFeed};++use effectcraft_ui_egui::frames::{RemoteDone, RemoteFrame, RemoteFrames, RemoteJob};use egui::{Event, Modifiers, pos2};use egui_kittest::Harness;use serde_json::json;@@@ -30,6 -30,6 +31,58 @@@ impl AudioDevice for Fake}}++/// A frame renderer whose frames the test releases explicitly. Playback then runs against a++/// controlled clock and controlled cache contents instead of racing however many frame workers++/// the host has; a frame that is not released is queued again by the next playback step.++#[derive(Clone, Default)]++struct GatedFrames {++ pending: Arc<Mutex<Vec<(i64, u32, u32, RemoteDone)>>>,++}++++impl RemoteFrames for GatedFrames {++ fn slots(&self) -> usize {++ 1024++ }++++ fn start(&self, job: RemoteJob, done: RemoteDone) {++ let (frame, width, height) = job.project.comp(job.comp).map_or((-1, 1, 1), |c| {++ let scale = job.opts.scale.max(0.001);++ let width = (c.width as f64 * scale).round().clamp(1.0, 16_384.0) as u32;++ let height = (c.height as f64 * scale).round().clamp(1.0, 16_384.0) as u32;++ (c.frame_rate.frame_at(job.t), width, height)++ });++ self.pending.lock().unwrap().push((frame, width, height, done));++ }++}++++impl GatedFrames {++ /// Put `frames` in the cache, dropping every other queued frame (playback asks again).++ fn render(&self, h: &mut Harness<'_, EffectcraftApp>, cid: ItemId, frames: &[i64]) {++ let scale = h.state().shown_series(cid).scale as f64 / 1000.0;++ for &f in frames {++ h.state().request_frame(cid, f, scale);++ }++ while h.state().frames.dispatch_remote() != 0 {}++ let pending = std::mem::take(&mut *self.pending.lock().unwrap());++ for (frame, width, height, done) in pending {++ if frames.contains(&frame) {++ let rgba = vec![0; (width as usize).saturating_mul(height as usize).saturating_mul(4)];++ done(Ok(RemoteFrame { width, height, rgba, ms: 1.0 }));++ } else {++ done(Err("held back by the test renderer".into()));++ }++ }++ }++++ /// Drop everything queued without caching it (the warm-up passes request viewer frames).++ fn discard(&self, h: &mut Harness<'_, EffectcraftApp>) {++ while h.state().frames.dispatch_remote() != 0 {}++ for (_, _, _, done) in std::mem::take(&mut *self.pending.lock().unwrap()) {++ done(Err("held back by the test renderer".into()));++ }++ }++}++/// A 2 s, 30 fps comp whose solid sounds a tone (Audio switch on).fn setup(audible: bool, fake: &Fake) -> (EffectcraftApp, ItemId) {setup_long(audible, fake, 2.0)@@@ -120,42 -120,42 +173,74 @@@ fn cmd_dragging_the_current_time_scrubsfn preview_with_audio_shows_every_frame_and_sounds_once_cached() {let fake = Fake::default();let (mut app, cid) = setup(true, &fake);-- // Playback requests at most twice as many frames ahead per step as there are render threads.-- // Four times that many frames take at least four steps to cache, so frames are shown silently-- // first however fast the renderer is (with a fixed 2 s comp, a machine with many cores cached-- // all of it before the first step and the sound started at once).++ // Hold rendering in the test: the cache cannot fill ahead of what the test releases, so the++ // silently shown frames and the moment the sound starts do not depend on the host's threads.++ let gate = GatedFrames::default();++ let renderer: Arc<dyn RemoteFrames> = Arc::new(gate.clone());++ app.frames.set_remote(Some(renderer));let ahead = (app.frames.parallelism() * 2).max(4);app.session.execute("comp.settings", json!({"comp": cid.0, "duration": (4 * ahead) as f64 / 30.0})).unwrap();-- // A little under one frame of input time per step.-- let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 31.0).build_eframe(|_| app);++ let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 30.0).build_eframe(|_| app);++ // Playback measures time on the app clock, never `ctx.input(|i| i.time)`; drive that clock++ // explicitly at one frame per step.++ h.state_mut().use_manual_clock();h.run_steps(2);++ gate.discard(&mut h);let frame = |h: &Harness<'_, EffectcraftApp>| {let app = h.state();app.session.project.comp(cid).unwrap().frame_rate.frame_at(app.session.time())};-- let now = h.ctx.input(|i| i.time);++ let now = h.state().now();h.state_mut().play(now);assert!(h.state().playback.audio_held && h.state().audio.is_none(), "nothing is cached: no sound yet");let mut last = frame(&h);let mut shown = 0;-- // Wait on the clock, not a step count: under a loaded machine (parallel test binaries) the-- // background cache can take far longer than 2000 short steps to get ahead.-- let deadline = std::time::Instant::now() + std::time::Duration::from_secs(60);-- while std::time::Instant::now() < deadline {++ // Show frames while only those frames are cached: they play silently first.++ for _ in 0..4 {++ let target = last + 1;++ gate.render(&mut h, cid, &[target]);++ h.state_mut().clock_mut().advance(1.0 / 30.0);h.step();-- if h.state().audio.is_some() {-- break;-- }let f = frame(&h);-- assert!(f == last || f == last + 1 || f < last, "{last} → {f}: a frame was skipped");++ // Accumulating 1/30 in f64 can leave the same frame up for one more step; it must never++ // jump over a frame.++ assert!(f == last || f == last + 1, "{last} → {f}: a frame was skipped");shown += usize::from(f != last);last = f;-- std::thread::sleep(std::time::Duration::from_millis(1));}-- assert!(h.state().audio.is_some() && fake.0.lock().unwrap().0.is_some(), "the sound started once the frames ahead were cached");++ // A frame that has not rendered holds the clock at the frame on screen; once it renders it is++ // shown, never jumped over. This exercises the production hold path, not a test-only shortcut.++ let waiting = last;++ h.state_mut().clock_mut().advance(1.0 / 30.0);++ h.step();++ assert_eq!(frame(&h), waiting, "an uncached frame holds the preview instead of being skipped");++ gate.render(&mut h, cid, &[waiting + 1]);++ // f64 clock accumulation need not put the next step exactly on the next frame boundary;++ // keep stepping until the held frame appears, and never allow it to jump past that frame.++ let mut showed_waiting = false;++ for _ in 0..4 {++ h.state_mut().clock_mut().advance(1.0 / 30.0);++ h.step();++ let f = frame(&h);++ assert!(f == waiting || f == waiting + 1, "{waiting} → {f}: the held frame was skipped");++ if f == waiting + 1 {++ showed_waiting = true;++ break;++ }++ }++ assert!(showed_waiting, "the waiting frame is shown once it renders");++ shown += 1;++ last = waiting + 1;assert!(shown > 0, "frames played silently first");-- // A frame that isn't cached stops the sound rather than being skipped. (Frames render fast-- // enough here to be cached again before the check: keep them out of the cache.)++ assert!(h.state().audio.is_none() && h.state().playback.audio_held, "the rest of the range is not cached: the sound waits");++ // Cache everything ahead; only then may the sound start.++ let end = h.state().playback.plan.expect("a preview plan").end;++ let rest: Vec<i64> = ((last + 1)..=end).collect();++ gate.render(&mut h, cid, &rest);++ h.step();++ assert!(h.state().audio.is_some() && fake.0.lock().unwrap().0.is_some(), "the sound started once the frames ahead were cached");++ // A frame that isn't cached stops the sound rather than being skipped.++ gate.discard(&mut h);h.state().frames.set_budget(0);h.state().frames.clear();h.step();@@@ -168,27 -168,27 +253,47 @@@#[test]fn preview_with_audio_sounds_once_rendering_keeps_up() {let fake = Fake::default();-- let (app, cid) = setup_long(true, &fake, 30.0);++ let (mut app, cid) = setup_long(true, &fake, 30.0);++ // Release only the frames this test chooses, and drive the app clock: rendering cannot race++ // the clock, so a frame is never skipped by a slow or loaded test host.++ let gate = GatedFrames::default();++ let renderer: Arc<dyn RemoteFrames> = Arc::new(gate.clone());++ app.frames.set_remote(Some(renderer));let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 30.0).build_eframe(|_| app);++ h.state_mut().use_manual_clock();h.run_steps(2);++ gate.discard(&mut h);++ let ahead = (h.state().frames.parallelism() * 2).max(4) as i64;let frame = |h: &Harness<'_, EffectcraftApp>| {let app = h.state();app.session.project.comp(cid).unwrap().frame_rate.frame_at(app.session.time())};-- let now = h.ctx.input(|i| i.time);-- h.state_mut().play(now);++ let start = h.state().now();++ h.state_mut().play(start);assert!(h.state().playback.audio_held && h.state().audio.is_none(), "nothing is cached: no sound yet");let mut last = frame(&h);-- // Two seconds of playback, each step giving the frame workers time to keep up.-- for _ in 0..60 {++ let mut shown = 0;++ // Two seconds of playback at one frame per clock step: keep the prefetch window cached, but++ // not the rest of the 30 s comp, so the sound has to start by the real-time rule.++ for step in 1..=60 {++ let target = last + 1;++ let window: Vec<i64> = (target..target + ahead).collect();++ gate.render(&mut h, cid, &window);++ // Set the clock to this step's exact time rather than adding 1/30 repeatedly: accumulated++ // f64 error can put one step just below a frame boundary and the next just above it, so++ // `floor(elapsed × fps)` would otherwise jump from frame N to N + 2 for a one-frame step.++ let now = h.state().now();++ let tick_time = start + step as f64 / 30.0;++ h.state_mut().clock_mut().advance(tick_time - now);h.step();if h.state().audio.is_some() {break;}let f = frame(&h);assert!(f == last || f == last + 1, "{last} → {f}: a frame was skipped");++ shown += usize::from(f != last);last = f;-- std::thread::sleep(std::time::Duration::from_millis(20));}assert!(h.state().audio.is_some() && fake.0.lock().unwrap().0.is_some(), "the sound started within 2 s, at frame {last} of 900");++ assert!(shown >= 3, "the sound starts only after the silent preview kept up for a moment");}diff --cc crates/ui-egui/tests/it/ui_blank_context_menus.rsindex 9e7363dbc,9e7363dbc..a604ef2c2--- a/crates/ui-egui/tests/it/ui_blank_context_menus.rs+++ b/crates/ui-egui/tests/it/ui_blank_context_menus.rs@@@ -65,7 -65,7 +65,7 @@@ fn timeline_blank_outline_and_time_graplet area = rect(&h, "timeline.layerMarquee");let p = if graph { pos2(area.max.x + 150.0, area.center().y) } else { area.center() };right_click(&mut h, p);-- h.get_by_label("New ⏵").click();++ h.get_by_label("New").click();h.run_steps(3);snapshot(&mut h, if graph { "timeline-graph" } else { "timeline-outline" });h.get_by_label("Null Object").click();@@@ -81,7 -81,7 +81,7 @@@ fn timeline_blank_menu_opens_solid_settlet mut h = harness();let p = rect(&h, "timeline.layerMarquee").center();right_click(&mut h, p);-- h.get_by_label("New ⏵").click();++ h.get_by_label("New").click();h.run_steps(3);h.get_by_label("Solid…").click();h.run_steps(3);@@@ -252,13 -252,13 +252,13 @@@ fn timeline_layer_context_menu_has_the_let r = rect(&h, &format!("timeline.layer.{layer}.row"));right_click(&mut h, pos2(r.min.x + 210.0, r.center().y));// The palette sits between Blending Mode and Arrange, as After Effects' layer menu does.-- let blending = h.get_by_label("Blending Mode ⏵").rect();-- let effects = h.get_by_label("Effects ⏵").rect();-- let arrange = h.get_by_label("Arrange ⏵").rect();++ let blending = h.get_by_label("Blending Mode").rect();++ let effects = h.get_by_label("Effects").rect();++ let arrange = h.get_by_label("Arrange").rect();assert!(blending.bottom() <= effects.top() && effects.bottom() <= arrange.top(), "Effects between Blending Mode and Arrange");-- h.get_by_label("Effects ⏵").click();++ h.get_by_label("Effects").click();h.run_steps(3);-- h.get_by_label("Blur & Sharpen ⏵").click();++ h.get_by_label("Blur & Sharpen").click();h.run_steps(3);h.get_by_label("Gaussian Blur").click();h.run_steps(3);@@@ -283,11 -283,11 +283,11 @@@ fn timeline_layer_context_menu_has_layeh.run_steps(3);let r = rect(&h, &format!("timeline.layer.{solid}.row"));right_click(&mut h, pos2(r.min.x + 210.0, r.center().y));-- let blending = h.get_by_label("Blending Mode ⏵").rect();-- let styles = h.get_by_label("Layer Styles ⏵").rect();-- let effects = h.get_by_label("Effects ⏵").rect();++ let blending = h.get_by_label("Blending Mode").rect();++ let styles = h.get_by_label("Layer Styles").rect();++ let effects = h.get_by_label("Effects").rect();assert!(blending.bottom() <= styles.top() && styles.bottom() <= effects.top(), "Layer Styles between Blending Mode and Effects");-- h.get_by_label("Layer Styles ⏵").click();++ h.get_by_label("Layer Styles").click();h.run_steps(3);assert!(h.query_by_label("Layer Style Options...").is_some());assert!(h.query_by_label("Drop Shadow").is_some());@@@ -351,7 -351,7 +351,7 @@@ fn layer_context_menu_adds_a_layer_markh.run_steps(3);let r = rect(&h, &format!("timeline.layer.{top}.row"));right_click(&mut h, pos2(r.min.x + 210.0, r.center().y));-- h.get_by_label("Markers ⏵").click();++ h.get_by_label("Markers").click();h.run_steps(3);snapshot(&mut h, "layer-markers");h.get_by_label("Add Marker").click();diff --cc crates/ui-egui/tests/it/ui_camera_tracker.rsindex a90c3fa45,a90c3fa45..2ab27fd6e--- a/crates/ui-egui/tests/it/ui_camera_tracker.rs+++ b/crates/ui-egui/tests/it/ui_camera_tracker.rs@@@ -175,6 -175,6 +175,7 @@@ fn viewer_zooms_and_pans_over_the_trackdelta: egui::vec2(0.0, 120.0),modifiers: Default::default(),phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,});h.run_steps(20);assert_ne!(h.state().ui.viewer.zoom, zoom, "the wheel zooms over the track points");diff --cc crates/ui-egui/tests/it/ui_control_modifiers.rsindex 3288d6f10,3288d6f10..7a7a1395a--- a/crates/ui-egui/tests/it/ui_control_modifiers.rs+++ b/crates/ui-egui/tests/it/ui_control_modifiers.rs@@@ -18,6 -18,6 +18,8 @@@ fn frames(app: &mut EffectcraftApp) ->if raw.events.is_empty() {break;}++ // The harness feeds the batch itself; a real UI pass would apply it now.++ app.mark_synthetic_applied();let mut button = false;for e in &raw.events {match e {@@@ -34,7 -34,7 +36,8 @@@fn send(app: &mut EffectcraftApp, method: &str, params: Value) {let ctx = egui::Context::default();let (req, _rx) = ControlRequest::new(method, params);-- let _ = control::handle(app, &ctx, &req);++ let now = app.now();++ let _ = control::handle(app, &ctx, &req, now);}#[test]diff --cc crates/ui-egui/tests/it/ui_dock_resize.rsindex c3c12e78a,c3c12e78a..3dc44b708--- a/crates/ui-egui/tests/it/ui_dock_resize.rs+++ b/crates/ui-egui/tests/it/ui_dock_resize.rs@@@ -54,7 -54,7 +54,7 @@@ fn focused_dock_resize_owns_arrows_and_h.run_steps(3);let before_project = h.state().session.project.clone();let before_times = h.state().session.state.times.clone();-- let id = Id::new(("dock-gutter", String::new()));++ let id = Id::unique(("dock-gutter", String::new()));h.ctx.memory_mut(|memory| memory.request_focus(id));h.run_steps(2);assert_eq!(h.ctx.memory(|memory| memory.focused()), Some(id));diff --cc crates/ui-egui/tests/it/ui_effect_controls.rsindex cdf8c7033,90f549315..d6138ba5c--- a/crates/ui-egui/tests/it/ui_effect_controls.rs+++ b/crates/ui-egui/tests/it/ui_effect_controls.rs@@@ -421,7 -421,7 +421,7 @@@ fn right_click_in_effect_controls_showsapp.show_panel(PanelKind::EffectControls);let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).build_eframe(|_| app);h.run_steps(3);-- let category = " Blur & Sharpen ⏵";++ let category = " Blur & Sharpen";// An effect's header: its own menu.let header = rect_of(&h, &format!("effectControls.effect.{fill}")).center();right_click(&mut h, header);diff --cc crates/ui-egui/tests/it/ui_effect_names.rsindex 28d1a1f3f,28d1a1f3f..d57f9c581--- a/crates/ui-egui/tests/it/ui_effect_names.rs+++ b/crates/ui-egui/tests/it/ui_effect_names.rs@@@ -32,7 -32,7 +32,9 @@@ fn harness(language: &str) -> (Harness<app.show_panel(PanelKind::EffectControls);app.show_panel(PanelKind::EffectsPresets);app.show_panel(PanelKind::Timeline);-- let mut h = Harness::builder().with_size(vec2(1400.0, 900.0)).build_eframe(|_| app);++ // The Chinese/Japanese names under test have no installed face on every host: draw tofu++ // instead of failing the missing-glyph gate (the glyph coverage test covers the bundled set).++ let mut h = Harness::builder().with_size(vec2(1400.0, 900.0)).allow_missing_glyphs().build_eframe(|_| app);h.run_steps(4);(h, fx)}diff --cc crates/ui-egui/tests/it/ui_inline_edit.rsindex d7e532d76,c9be6e73b..c9cf4693e--- a/crates/ui-egui/tests/it/ui_inline_edit.rs+++ b/crates/ui-egui/tests/it/ui_inline_edit.rs@@@ -12,7 -12,7 +12,9 @@@ fn harness() -> (Harness<'static, Effeclet mut s = Session::default();s.execute("comp.new", json!({"name": "Main", "width": 320, "height": 180, "duration": 4, "fps": 24})).unwrap();let comp = s.active_comp_id().unwrap().0;-- let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).build_eframe(|_| EffectcraftApp::new(s));++ // Arabic, Hebrew, Devanagari and Thai names typed below need installed system faces: draw++ // tofu on a host without them rather than failing the missing-glyph gate.++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).allow_missing_glyphs().build_eframe(|_| EffectcraftApp::new(s));h.run_steps(4);(h, comp)}diff --cc crates/ui-egui/tests/it/ui_large_project.rsindex e6ffd26e7,e6ffd26e7..4e2476269--- a/crates/ui-egui/tests/it/ui_large_project.rs+++ b/crates/ui-egui/tests/it/ui_large_project.rs@@@ -65,7 -65,7 +65,7 @@@ fn comp_thumbnail_renders_off_the_ui_thfor _ in 0..400 {h.step();if h.state().auto.find("project.thumbnail").is_some()-- && h.ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(egui::Id::new(("proj-thumb", main.0)))).is_some()++ && h.ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(egui::Id::unique(("proj-thumb", main.0)))).is_some(){landed = true;break;diff --cc crates/ui-egui/tests/it/ui_layer_panel_zoom.rsindex 5fa2b1d98,5fa2b1d98..1aabdd2bc--- a/crates/ui-egui/tests/it/ui_layer_panel_zoom.rs+++ b/crates/ui-egui/tests/it/ui_layer_panel_zoom.rs@@@ -111,6 -111,6 +111,7 @@@ fn wheel_zooms_around_the_pointer_and_hdelta: vec2(0.0, 120.0),modifiers: Default::default(),phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,});h.run_steps(20);let after = rect(&h, "layerPanel.canvas");diff --cc crates/ui-egui/tests/it/ui_layer_source_picker.rsindex 000000000,95a0da844..78a0f8821mode 000000,100644..100644--- a/crates/ui-egui/tests/it/ui_layer_source_picker.rs+++ b/crates/ui-egui/tests/it/ui_layer_source_picker.rs@@@ -1,0 -1,207 +1,215 @@@+ //! Picking a layer-valued property with the shared drop-down: the Timeline draws a layer-valued+ //! Light Options property (an Environment light's Source) as a drop-down of the comp's layers,+ //! Effect Controls' layer parameters (a Displacement Map's layer) pick through the same widget,+ //! and both write an undoable `prop.set`.++ use effectcraft_engine::Session;+ use effectcraft_engine::keyframe::Value;+ use effectcraft_engine::project::LayerId;+ use effectcraft_ui_egui::EffectcraftApp;+ use effectcraft_ui_egui::dock::PanelKind;+ use egui::{Pos2, Rect, pos2, vec2};+ use egui_kittest::Harness;+ use egui_kittest::kittest::NodeT;+ use egui_kittest::kittest::Queryable;+ use serde_json::json;++ fn click(h: &mut Harness<'_, EffectcraftApp>, at: Pos2) {+ h.event(egui::Event::PointerMoved(at));+ h.step();+ h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: true, modifiers: Default::default() });+ h.step();+ h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers: Default::default() });+ h.run_steps(3);+ }++ fn rect_of(h: &Harness<'_, EffectcraftApp>, id: &str) -> Rect {+ let e = h.state().auto.find(id).unwrap_or_else(|| panic!("no automation element {id}")).clone();+ Rect::from_min_size(pos2(e.rect[0], e.rect[1]), vec2(e.rect[2], e.rect[3]))+ }++ /// Whether `want` is painted inside `row` (the drop-down's current-value text).+ fn painted_in(h: &Harness<'_, EffectcraftApp>, row: Rect, want: &str) -> bool {+ h.output().shapes.iter().any(|c| match &c.shape {+ egui::Shape::Text(t) => t.galley.text() == want && row.expand(3.0).contains(t.pos),+ _ => false,+ })+ }++ /// The current value of a layer-valued property, by uid.+ fn layer_value(h: &Harness<'_, EffectcraftApp>, layer: u64, prop: u64) -> Option<u64> {+ let comp = h.state().session.active_comp().unwrap();+ match &comp.layer(LayerId(layer)).unwrap().props.find(prop).unwrap().value {+ Value::Layer(v) => *v,+ other => panic!("property {prop} is not layer-valued: {other:?}"),+ }+ }++ /// The "N. name" a drop-down shows for a layer.+ fn entry_for(h: &Harness<'_, EffectcraftApp>, layer: u64) -> String {+ let comp = h.state().session.active_comp().unwrap();+ let i = comp.layers.iter().position(|l| l.id.0 == layer).unwrap();+ format!("{}. {}", i + 1, comp.layers[i].name)+ }++ /// Puts the layer-valued `prop` of `layer` back to `value` with a direct `prop.set` (no merge key,+ /// so the pick below records its own step instead of folding into a picker write), picks `none`+ /// from the drop-down at `value_id`, and checks the clear takes one undo step that restores `value`.+ #[track_caller]+ fn none_pick_clears(h: &mut Harness<'_, EffectcraftApp>, value_id: &str, none: &str, layer: u64, prop: u64, value: u64) {+ h.state_mut().session.execute("prop.set", json!({"layer": layer, "prop": prop, "value": value})).unwrap();+ h.run_steps(2);+ assert_eq!(layer_value(h, layer, prop), Some(value));+ let steps = h.state().session.history.undo.len();+ let at = rect_of(h, value_id).center();+ click(h, at);- h.get_by_label(none).click();++ h.get_by_role_and_label(egui::accesskit::Role::Button, none).click();+ h.run_steps(3);+ assert_eq!(layer_value(h, layer, prop), None, "selecting None clears the value");+ assert_eq!(h.state().session.history.undo.len(), steps + 1, "one clear undo step");+ h.state_mut().session.execute("edit.undo", json!({})).unwrap();+ h.run_steps(2);+ assert_eq!(layer_value(h, layer, prop), Some(value), "undo restores the selected layer");+ }++ /// A light's Source (a layer-valued Light Options property) picks a comp layer from the+ /// Timeline and undo restores None.+ #[test]+ fn timeline_source_drop_down_picks_the_layer_and_undo_restores_none() {+ let mut s = Session::default();+ s.execute("comp.new", json!({"name": "Main", "width": 640, "height": 360, "frameRate": 30, "duration": 4})).unwrap();+ s.execute("comp.settings", json!({"renderer": "advanced3D"})).unwrap();+ let sky = s.execute("layer.newSolid", json!({"name": "Sky HDRI", "color": "#66aaff"})).unwrap()["layer"].as_u64().unwrap();+ let light = s.execute("layer.newLight", json!({"kind": "Environment", "name": "Env Light"})).unwrap()["layer"].as_u64().unwrap();+ let (group, source) = {+ let comp = s.active_comp().unwrap();+ let opts = comp.layer(LayerId(light)).unwrap().props.sub("lightOptions").unwrap();+ (opts.uid, opts.get("source").unwrap().uid)+ };+ let mut app = EffectcraftApp::new(s);+ app.ui.timeline.open_layers.insert(light);+ app.ui.timeline.open_groups.insert(group);+ let mut h = Harness::builder().with_size(vec2(1600.0, 1000.0)).build_eframe(|_| app);+ h.run_steps(4);++ let value_id = format!("timeline.prop.{source}.value");+ // Unset: the row is a drop-down reading "None" — an element to click, not bare text.+ assert_eq!(layer_value(&h, light, source), None);+ assert!(painted_in(&h, rect_of(&h, &value_id), "None"), "the Source row shows a None drop-down");++ // Opening it lists "None" and every layer of the comp, by index and name.+ let at = rect_of(&h, &value_id).center();+ click(&mut h, at);+ let entry = entry_for(&h, sky);- assert!(h.query_by_label("None").is_some(), "the list starts with None");- assert!(h.query_by_label(&entry).is_some(), "the comp's layers are listed ({entry})");++ assert!(h.query_by_role_and_label(egui::accesskit::Role::Button, "None").is_some(), "the list starts with None");++ assert!(h.query_by_role_and_label(egui::accesskit::Role::Button, &entry).is_some(), "the comp's layers are listed ({entry})");++ let steps = h.state().session.history.undo.len();- h.get_by_label(&entry).click();++ h.get_by_role_and_label(egui::accesskit::Role::Button, &entry).click();+ h.run_steps(3);+ assert_eq!(layer_value(&h, light, source), Some(sky), "the Source holds the layer id");+ assert_eq!(h.state().session.history.undo.len(), steps + 1, "one undo step");+ // The row names the layer (index and name), not its internal id.+ assert!(painted_in(&h, rect_of(&h, &value_id), &entry), "the Source row shows the layer's name");++ // Dismissing the list without choosing writes nothing; reopening marks the chosen layer as+ // the current entry (and "None" as not current).+ click(&mut h, pos2(1500.0, 300.0));+ h.run_steps(2);+ assert_eq!(layer_value(&h, light, source), Some(sky), "dismissing the list writes nothing");+ let reopen = rect_of(&h, &value_id).center();+ click(&mut h, reopen);- assert_eq!(h.get_by_label(&entry).accesskit_node().toggled(), Some(egui::accesskit::Toggled::True), "the current entry is highlighted");- assert_eq!(h.get_by_label("None").accesskit_node().toggled(), Some(egui::accesskit::Toggled::False), "None is not the current entry");++ assert_eq!(++ h.get_by_role_and_label(egui::accesskit::Role::Button, &entry).accesskit_node().toggled(),++ Some(egui::accesskit::Toggled::True),++ "the current entry is highlighted"++ );++ assert_eq!(++ h.get_by_role_and_label(egui::accesskit::Role::Button, "None").accesskit_node().toggled(),++ Some(egui::accesskit::Toggled::False),++ "None is not the current entry"++ );+ click(&mut h, pos2(1500.0, 300.0));+ h.run_steps(2);++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();+ h.run_steps(2);+ assert_eq!(layer_value(&h, light, source), None, "undo restores None");++ none_pick_clears(&mut h, &value_id, "None", light, source, sky);+ }++ /// The shared widget is the one Effect Controls already used: a Displacement Map's layer+ /// parameter still picks from the drop-down and still undoes.+ #[test]+ fn effect_controls_layer_param_picks_through_the_shared_widget() {+ let mut s = Session::default();+ s.execute("comp.new", json!({"name": "Main", "width": 640, "height": 360, "frameRate": 30, "duration": 4})).unwrap();+ let map = s.execute("layer.newSolid", json!({"name": "Disp", "color": "#ff0000"})).unwrap()["layer"].as_u64().unwrap();+ let base = s.execute("layer.newSolid", json!({"name": "Base", "color": "#20c040"})).unwrap()["layer"].as_u64().unwrap();+ let fx = s.execute("effect.apply", json!({"layers": [base], "effect": "Displacement Map"})).unwrap()["effects"][0].as_u64().unwrap();+ let prop = {+ let comp = s.active_comp().unwrap();+ comp.layer(LayerId(base)).unwrap().effects().unwrap().find_group(fx).unwrap().get("displacementMapLayer").unwrap().uid+ };+ s.state.selected_layers = vec![LayerId(base)];+ let mut app = EffectcraftApp::new(s);+ app.show_panel(PanelKind::EffectControls);+ let mut h = Harness::builder().with_size(vec2(1600.0, 1100.0)).build_eframe(|_| app);+ h.run_steps(4);++ let value_id = format!("effectControls.prop.{prop}.value");+ let row = rect_of(&h, &value_id);+ click(&mut h, row.center());+ let entry = entry_for(&h, map);- assert!(h.query_by_label(&entry).is_some(), "the comp's layers are listed ({entry})");++ assert!(h.query_by_role_and_label(egui::accesskit::Role::Button, &entry).is_some(), "the comp's layers are listed ({entry})");+ let steps = h.state().session.history.undo.len();- h.get_by_label(&entry).click();++ h.get_by_role_and_label(egui::accesskit::Role::Button, &entry).click();+ h.run_steps(3);+ assert_eq!(layer_value(&h, base, prop), Some(map), "the parameter holds the layer id");+ assert_eq!(h.state().session.history.undo.len(), steps + 1, "one undo step");+ // The row names the picked layer, as the Timeline's Source row does.+ assert!(painted_in(&h, rect_of(&h, &value_id), &entry), "the parameter row shows the layer's name");+ h.state_mut().session.execute("edit.undo", json!({})).unwrap();+ h.run_steps(2);+ assert_eq!(layer_value(&h, base, prop), None, "undo restores None");++ none_pick_clears(&mut h, &value_id, "None", base, prop, map);+ }++ /// The visual record (the `ui_3d` ignored-snapshot convention): the Source drop-down open over+ /// the layer list, and the row after a layer is chosen. Renders with wgpu when `EC_SNAPSHOT_DIR`+ /// is set: `EC_SNAPSHOT_DIR=shots cargo test -p effectcraft-ui-egui --test it ui_layer_source_picker:: -- --ignored`.+ #[test]+ #[ignore = "renders with wgpu; run with --ignored (set EC_SNAPSHOT_DIR to keep PNGs)"]+ fn snapshot_source_dropdown_open_and_chosen() {+ let mut s = Session::default();+ s.execute("comp.new", json!({"name": "Main", "width": 1280, "height": 720, "frameRate": 30, "duration": 5})).unwrap();+ s.execute("comp.settings", json!({"renderer": "advanced3D"})).unwrap();+ let sky = s.execute("layer.newSolid", json!({"name": "Sky HDRI", "color": "#66aaff"})).unwrap()["layer"].as_u64().unwrap();+ let light = s.execute("layer.newLight", json!({"kind": "Environment", "name": "Env Light"})).unwrap()["layer"].as_u64().unwrap();+ let (group, source) = {+ let comp = s.active_comp().unwrap();+ let opts = comp.layer(LayerId(light)).unwrap().props.sub("lightOptions").unwrap();+ (opts.uid, opts.get("source").unwrap().uid)+ };+ let mut app = EffectcraftApp::new(s);+ app.ui.timeline.open_layers.insert(light);+ app.ui.timeline.open_groups.insert(group);+ let mut h = Harness::builder().with_size(vec2(1600.0, 1000.0)).with_pixels_per_point(2.0).wgpu().build_eframe(|_| app);+ h.run_steps(4);+ let save = |h: &mut Harness<'_, EffectcraftApp>, name: &str| {+ if let Ok(dir) = std::env::var("EC_SNAPSHOT_DIR") {+ h.render().expect("render").save(format!("{dir}/{name}")).expect("save");+ }+ };+ save(&mut h, "source_unset.png");+ let at = rect_of(&h, &format!("timeline.prop.{source}.value")).center();+ click(&mut h, at);+ save(&mut h, "source_dropdown_open.png");+ let entry = entry_for(&h, sky);- h.get_by_label(&entry).click();++ h.get_by_role_and_label(egui::accesskit::Role::Button, &entry).click();+ h.run_steps(3);+ assert_eq!(layer_value(&h, light, source), Some(sky));+ save(&mut h, "source_chosen.png");+ }diff --cc crates/ui-egui/tests/it/ui_locked_color.rsindex d942da111,d942da111..5d7d1edd7--- a/crates/ui-egui/tests/it/ui_locked_color.rs+++ b/crates/ui-egui/tests/it/ui_locked_color.rs@@@ -38,7 -38,7 +38,7 @@@ fn invoke(h: &mut Harness<'_, Effectcra}fn locked_center(h: &Harness<'_, EffectcraftApp>, images: &Images) -> [u8; 4] {-- let (_, texture) = h.ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(egui::Id::new("viewer-locked"))).unwrap();++ let (_, texture) = h.ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(egui::Id::unique("viewer-locked"))).unwrap();let images = images.borrow();let image = images.get(&texture.id()).unwrap();image.pixels[(image.size[1] / 2) * image.size[0] + image.size[0] / 2].to_array()diff --cc crates/ui-egui/tests/it/ui_media_browser_cache.rsindex feade97bf,feade97bf..ddfc53e22--- a/crates/ui-egui/tests/it/ui_media_browser_cache.rs+++ b/crates/ui-egui/tests/it/ui_media_browser_cache.rs@@@ -42,7 -42,7 +42,7 @@@ type Listing = (f64, Arc<Result<Vec<Entfn listing(h: &Harness<'_, EffectcraftApp>, only: bool) -> Listing {let dir = h.state().session.state.media_browser.folder.clone().unwrap_or_else(|| "/Shoot".into());-- h.ctx.data(|d| d.get_temp(egui::Id::new(("mb-list", dir, only)))).unwrap()++ h.ctx.data(|d| d.get_temp(egui::Id::unique(("mb-list", dir, only)))).unwrap()}fn names(list: &Arc<Result<Vec<Entry>, String>>) -> Vec<&str> {diff --cc crates/ui-egui/tests/it/ui_media_browser_copy_path.rsindex 8da34c5bd,8da34c5bd..dff60ddd0--- a/crates/ui-egui/tests/it/ui_media_browser_copy_path.rs+++ b/crates/ui-egui/tests/it/ui_media_browser_copy_path.rs@@@ -52,7 -52,7 +52,8 @@@ fn file_folder_and_virtual_paths_copy_flet mut session = Session { browser: Some(Arc::new(TestBrowser(tree))), ..Default::default() };session.prefs.general.language = "en".into();session.execute("comp.new", json!({"width": 64, "height": 36, "duration": 2})).unwrap();-- let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(|_| {++ // The Chinese folder and file names need an installed CJK face.++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).allow_missing_glyphs().build_eframe(|_| {let mut app = EffectcraftApp::new(session);app.ui.start_screen = false;app.show_panel(PanelKind::MediaBrowser);@@@ -96,7 -96,7 +97,8 @@@ fn copy_path_control_command_preserves_let mut reply = None;let mut out = ctx.run_ui(Default::default(), |ui| {let (request, _rx) = ControlRequest::new("ui.menu.invoke", json!({"id": "mediaBrowser.copySourcePath", "params": params}));-- reply = match control::handle(&mut app, ui.ctx(), &request) {++ let now = app.now();++ reply = match control::handle(&mut app, ui.ctx(), &request, now) {control::Outcome::Done(value) => Some(value),_ => panic!("expected immediate reply"),};diff --cc crates/ui-egui/tests/it/ui_panel_windows.rsindex 60ae3f9c3,60ae3f9c3..76a9a31c0--- a/crates/ui-egui/tests/it/ui_panel_windows.rs+++ b/crates/ui-egui/tests/it/ui_panel_windows.rs@@@ -52,7 -52,7 +52,7 @@@ fn a_panel_in_its_own_window_leaves_theh.run_steps(3);// No in-window floating group is drawn for it (no move strip, no floating area)...assert!(!h.state().auto.elements.iter().any(|e| e.id.starts_with("panel.float.")));-- let area = egui::Id::new(("floating-panel", PanelKind::Project.id()));++ let area = egui::Id::unique(("floating-panel", PanelKind::Project.id()));assert!(!h.ctx.memory(|m| m.layer_ids().any(|layer| layer.id == area && m.areas().is_visible(&layer))));// ...the window draws it (here embedded: the test harness has no native windows).assert!(h.state().auto.elements.iter().any(|e| e.id == "panel.Project"));diff --cc crates/ui-egui/tests/it/ui_panels.rsindex 21298910c,21298910c..f4c11ba0b--- a/crates/ui-egui/tests/it/ui_panels.rs+++ b/crates/ui-egui/tests/it/ui_panels.rs@@@ -218,7 -218,7 +218,7 @@@ fn saved_workspace_is_listed_in_the_worh.run_steps(3);assert_ne!(h.state().ui.dock, saved);click(&mut h, "menu.Window");-- let ws = h.query_by_label(" Workspace ⏵").expect("Window ▸ Workspace").rect();++ let ws = h.query_by_label(" Workspace").expect("Window ▸ Workspace").rect();hover(&mut h, ws.center());let entry = h.state().auto.find("menu.savedWorkspaces.0").expect("the saved workspace is listed").clone();assert_eq!(entry.label, "My Layout");@@@ -239,7 -239,7 +239,7 @@@fn edit_label_menu_shows_the_label_colours() {let mut h = harness();click(&mut h, "menu.Edit");-- let label = h.query_by_label(" Label ⏵").expect("Edit ▸ Label").rect();++ let label = h.query_by_label(" Label").expect("Edit ▸ Label").rect();hover(&mut h, label.center());// (Not Dark Green; the entry's label starts with its check-mark column.)let green = h.query_by_label(" Green").expect("the Label submenu is open").rect();@@@ -388,6 -388,6 +388,7 @@@ fn settings_buttons_stay_in_view_at_200delta: egui::vec2(0.0, -1000.0),modifiers: Default::default(),phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,});h.run_steps(5);};diff --cc crates/ui-egui/tests/it/ui_presets_folder.rsindex 93f34dd73,93f34dd73..e11efe944--- a/crates/ui-egui/tests/it/ui_presets_folder.rs+++ b/crates/ui-egui/tests/it/ui_presets_folder.rs@@@ -37,7 -37,7 +37,8 @@@ fn click(h: &mut Harness<'_, Effectcraffn presets_menu_copies_the_configured_folder_without_editing_the_project() {let expected = expected_folder();for language in ["en", "ja"] {-- let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).build_eframe(|_| {++ // The `ja` run draws Japanese menu text, which needs an installed CJK face.++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).allow_missing_glyphs().build_eframe(|_| {let mut app = EffectcraftApp::new(Session::default());app.session.prefs.general.language = language.into();app.ui.start_screen = false;@@@ -69,7 -69,7 +70,8 @@@ fn presets_folder_control_command_returlet mut reply = None;let mut output = ctx.run_ui(Default::default(), |ui| {let (request, _rx) = ControlRequest::new("ui.menu.invoke", json!({"id": "effects.copyPresetsFolderPath"}));-- reply = match control::handle(&mut app, ui.ctx(), &request) {++ let now = app.now();++ reply = match control::handle(&mut app, ui.ctx(), &request, now) {control::Outcome::Done(value) => Some(value),_ => panic!("expected an immediate reply"),};@@@ -128,7 -128,7 +130,7 @@@ fn shared_preset_rows_search_apply_and_h.run_steps(3);let shared = std::sync::Arc::new(entries);let now = h.ctx.input(|i| i.time);-- h.ctx.data_mut(|d| d.insert_temp(egui::Id::new("fx-user-presets"), (now, shared.clone())));++ h.ctx.data_mut(|d| d.insert_temp(egui::Id::unique("fx-user-presets"), (now, shared.clone())));let search = |h: &mut Harness<'_, EffectcraftApp>, text: &str| {click(h, "effects.search");h.input_mut().events.push(Event::Key { key: egui::Key::A, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND });@@@ -160,7 -160,7 +162,7 @@@h.run_steps(2);assert_eq!(h.state().session.active_comp().unwrap().layers[0].props.prop("transform/opacity").unwrap().value.as_f64(), 100.0);}-- let (_, cached) = h.ctx.data(|d| d.get_temp::<(f64, std::sync::Arc<Vec<PresetFile>>)>(egui::Id::new("fx-user-presets"))).unwrap();++ let (_, cached) = h.ctx.data(|d| d.get_temp::<(f64, std::sync::Arc<Vec<PresetFile>>)>(egui::Id::unique("fx-user-presets"))).unwrap();assert!(std::sync::Arc::ptr_eq(&shared, &cached));assert_eq!(shared.iter().map(|p| p.name.as_str()).collect::<Vec<_>>(), ["Custom Cache A", "Custom Cache B"]);}diff --cc crates/ui-egui/tests/it/ui_project_new_folder.rsindex 0ee75c7f9,0ee75c7f9..63a1c6ae3--- a/crates/ui-egui/tests/it/ui_project_new_folder.rs+++ b/crates/ui-egui/tests/it/ui_project_new_folder.rs@@@ -150,7 -150,7 +150,8 @@@ fn engine_execute_only_creates_the_foldlet before = folders(&h);let ctx = h.ctx.clone();let (req, _rx) = ControlRequest::new("engine.execute", json!({"command": "project.newFolder"}));-- let _ = control::handle(h.state_mut(), &ctx, &req);++ let now = h.state().now();++ let _ = control::handle(h.state_mut(), &ctx, &req, now);h.run_steps(3);let [folder] = new_folders(&h, &before)[..] else { panic!("one new folder") };assert!(!renaming(&h, folder), "no name field for an agent's folder");diff --cc crates/ui-egui/tests/it/ui_ram_preview.rsindex 930c43eb7,930c43eb7..8b3748a3f--- a/crates/ui-egui/tests/it/ui_ram_preview.rs+++ b/crates/ui-egui/tests/it/ui_ram_preview.rs@@@ -90,8 -90,8 +90,11 @@@ fn prefetch_waits_while_edits_keep_comilet mut s = Session::default();let c = s.execute("comp.new", json!({"name": "Drag", "width": 64, "height": 36, "duration": 2})).unwrap()["comp"].as_u64().unwrap();let solid = s.execute("layer.newSolid", json!({"color": "#3080ff", "width": 16, "height": 16})).unwrap()["layer"].as_u64().unwrap();-- // Short steps: input time advances 50 ms per frame.++ // Short steps between edits; the app clock below is advanced explicitly.let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(0.05).build_eframe(|_| EffectcraftApp::new(s));++ // Prefetch waits for EDIT_QUIET on the app clock; a manual clock makes the pause++ // deterministic instead of depending on how long the test host took to run the steps.++ h.state_mut().use_manual_clock();settle(&mut h);let frame = |h: &Harness<'_, EffectcraftApp>| {let app = h.state();@@@ -116,6 -116,6 +119,8 @@@assert_eq!(h.state().frames.inflight(), 0, "edit {i}");}// The edits pause: the frames around the current one fill in.++ h.state_mut().clock_mut().advance(1.0);++ h.run_steps(1);settle(&mut h);for _ in 0..20 {h.step();diff --cc crates/ui-egui/tests/it/ui_render_queue.rsindex 72e585eb1,72e585eb1..562b7a1c4--- a/crates/ui-egui/tests/it/ui_render_queue.rs+++ b/crates/ui-egui/tests/it/ui_render_queue.rs@@@ -31,7 -31,7 +31,7 @@@ fn render_settings_template_applies_frolet mut app = Some(EffectcraftApp::new(s));let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).build_eframe(|_| app.take().expect("app"));// Twirl the item open, as clicking its twirl does.-- h.ctx.data_mut(|d| d.insert_temp(egui::Id::new("rq-ui"), (vec![id], None::<u64>)));++ h.ctx.data_mut(|d| d.insert_temp(egui::Id::unique("rq-ui"), (vec![id], None::<u64>)));h.state_mut().show_panel(PanelKind::RenderQueue);h.run_steps(4);let dd = h.state().auto.find(&format!("renderQueue.item.{id}.renderSettings")).expect("Render Settings menu").clone();@@@ -80,7 -80,7 +80,7 @@@ fn clicking_the_output_file_name_opens_}));let mut app = Some(app);let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).build_eframe(|_| app.take().expect("app"));-- h.ctx.data_mut(|d| d.insert_temp(egui::Id::new("rq-ui"), (vec![id], None::<u64>)));++ h.ctx.data_mut(|d| d.insert_temp(egui::Id::unique("rq-ui"), (vec![id], None::<u64>)));h.state_mut().show_panel(PanelKind::RenderQueue);h.run_steps(4);let path = h.state().auto.find(&format!("renderQueue.item.{id}.outputPath")).expect("the output file name").clone();@@@ -88,7 -88,7 +88,7 @@@click_with(&mut h, at, Modifiers::NONE);assert_eq!(*asked.borrow(), [(expected_default, ext.to_string())], "the dialog opened at the current output");assert_eq!(h.state().session.project.render_queue[0].output.output, chosen);-- let editing = |h: &Harness<'_, EffectcraftApp>| h.ctx.data(|d| d.get_temp::<(u64, String)>(egui::Id::new("rq-edit-output")));++ let editing = |h: &Harness<'_, EffectcraftApp>| h.ctx.data(|d| d.get_temp::<(u64, String)>(egui::Id::unique("rq-edit-output")));assert_eq!(editing(&h), None, "no inline editor");// Alt-click edits the template text instead.click_with(&mut h, at, Modifiers::ALT);diff --cc crates/ui-egui/tests/it/ui_scrolling.rsindex 5f6816230,18f7012da..4d80452c9--- a/crates/ui-egui/tests/it/ui_scrolling.rs+++ b/crates/ui-egui/tests/it/ui_scrolling.rs@@@ -36,6 -38,6 +38,7 @@@ fn wheel(h: &mut Harness<'_, Effectcrafdelta: vec2(0.0, dy),modifiers: Default::default(),phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,});h.run_steps(20);}@@@ -59,6 -88,52 +89,198 @@@ fn a_menu_taller_than_the_window_scrollassert_eq!(h.state().dialog, Some(effectcraft_ui_egui::Dialog::Shortcuts), "the entry takes the click");}+ /// With the title still held down (press-and-browse), resting the pointer against the bottom+ /// edge of a menu too tall for the window scrolls it from there — a crawl, then a run, as native+ /// menus do — so the long list can be walked with no wheel.+ #[test]+ fn holding_the_title_scrolls_the_menu_from_its_bottom_edge() {+ let mut h = harness(1200.0, 520.0);+ let edit = rect(&h, "menu.Edit");+ hold(&mut h, edit.center());+ let before = h.query_by_label_contains("Keyboard Shortcuts").expect("the Edit menu opens on the press").rect();+ assert!(before.max.y > 520.0, "Edit is taller than the window ({before:?})");+ let menu = open_popup(&h);+ // Creeping down the edge: the 18 pt band above the menu's inner bottom lies at one of these+ // positions, whatever the frame's margin (they are 6 pt apart).+ let mut walked = false;+ for step in 0..5 {+ move_to(&mut h, pos2(menu.center().x, menu.max.y - 6.0 - 6.0 * step as f32));+ h.run_steps(8);+ let now = h.query_by_label_contains("Keyboard Shortcuts").expect("still open").rect();+ if now.min.y < before.min.y {+ walked = true;+ break;+ }+ }+ assert!(walked, "resting on the bottom edge of the held-down menu scrolled its entries up");+ }++ /// Without the title held down — the menu opened by a plain click — the same edge rest scrolls+ /// nothing: the wheel (above) is how a click-opened menu scrolls, the pointer alone must not+ /// move it (a hover may align the row under it by a few points; a crawl there would be a bug).+ #[test]+ fn without_the_hold_the_edge_does_not_scroll_the_menu() {+ let mut h = harness(1200.0, 520.0);+ let edit = rect(&h, "menu.Edit");+ click_at(&mut h, edit.center());+ let before = h.query_by_label_contains("Keyboard Shortcuts").expect("the Edit menu is open").rect();+ assert!(before.max.y > 520.0, "Edit is taller than the window ({before:?})");+ let menu = open_popup(&h);+ for step in 0..5 {+ move_to(&mut h, pos2(menu.center().x, menu.max.y - 6.0 - 6.0 * step as f32));+ h.run_steps(8);+ let now = h.query_by_label_contains("Keyboard Shortcuts").expect("still open").rect();+ let crawled = before.min.y - now.min.y;+ assert!(crawled < 60.0, "step {step}: the edge scrolled the menu with no title held down ({before:?} -> {now:?})");+ }+ }+++/// Find the actual Edit popup's bottom crawl band while keeping the title press held.++fn held_edit_crawl(h: &mut Harness<'_, EffectcraftApp>) -> Pos2 {++ let edit = rect(h, "menu.Edit");++ hold(h, edit.center());++ let before = h.query_by_label_contains("Keyboard Shortcuts").expect("Edit opens on press").rect();++ let menu = open_popup(h);++ for step in 0..5 {++ let p = pos2(menu.center().x, menu.max.y - 6.0 - 6.0 * step as f32);++ move_to(h, p);++ h.run_steps(8);++ let after = h.query_by_label_contains("Keyboard Shortcuts").expect("Edit stays open").rect();++ if after.min.y < before.min.y - 0.1 {++ return p;++ }++ }++ panic!("the held Edit menu never crawled from its bottom edge");++}++++fn menu_at(h: &mut Harness<'_, EffectcraftApp>, time: f64) {++ h.input_mut().time = Some(time);++ h.step();++}++++/// A discarded layout pass may consume the queued offset once, but must not crawl again for++/// the same RawInput time. A subsequent real iteration must still queue and consume its step.++#[test]++fn menu_edge_crawl_advances_once_on_replay_then_continues_at_a_later_time() {++ use std::sync::{++ Arc,++ atomic::{AtomicBool, Ordering},++ };++++ let mut h = harness(1200.0, 520.0);++ held_edit_crawl(&mut h);++ let discard = Arc::new(AtomicBool::new(true));++ h.ctx.on_end_pass(++ "menu crawl replay regression",++ Arc::new(move |ui| {++ if discard.swap(false, Ordering::SeqCst) {++ ui.ctx().request_discard("replay an actual held menu");++ }++ }),++ );++ let time = h.ctx.input(|i| i.time) + 1.0 / 60.0;++ menu_at(&mut h, time);++ assert_eq!(h.output().platform_output.num_completed_passes, 2, "the actual menu was replayed");++ let once = h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect();++ for _ in 0..3 {++ menu_at(&mut h, time);++ assert_eq!(h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect(), once, "same-time replay cannot queue another crawl");++ }++ let later = time + 1.0 / 60.0;++ menu_at(&mut h, later);++ menu_at(&mut h, later);++ let advanced = h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect();++ assert!(advanced.min.y < once.min.y - 0.1, "a later input time advances the held menu ({once:?} -> {advanced:?})");++ menu_at(&mut h, later);++ assert_eq!(h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect(), advanced, "the later time also takes only one step");++}++++/// The actual menu viewport's vertical range, rather than its outer Area/frame rectangle.++/// Popup's accessibility parent is its title, so background panels and other menus cannot match.++fn menu_scrollbar(h: &Harness<'_, EffectcraftApp>, title: &str) -> Rect {++ let menu = h.get_by_label(title);++ let bars: Vec<_> = menu.query_all_by_role(egui::accesskit::Role::ScrollBar).map(|node| node.rect()).filter(|r| r.height() > r.width()).collect();++ assert_eq!(bars.len(), 1, "{title}: exactly one actual vertical menu scrollbar ({bars:?})");++ let bar = bars[0];++ assert!(bar.height() > 36.0, "{title}: both crawl bands fit inside the viewport ({bar:?})");++ bar++}++++/// Exercise the real popup, its bounds, band exit and subsequent wheel input. Switching to a++/// different real menu must not consume Edit's pending target or reuse its crawl clock.++#[test]++fn menu_edge_crawl_is_bounded_stops_and_keeps_wheel_and_menu_state_independent() {++ let mut h = harness(1200.0, 520.0);++ held_edit_crawl(&mut h);++ h.run_steps(180);++ let bottom = h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect();++ assert!(bottom.max.y <= 520.0, "the last item is inside the viewport at the bottom ({bottom:?})");++ h.run_steps(20);++ assert_eq!(h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect(), bottom, "the bottom bound stops the crawl");++++ let bar = menu_scrollbar(&h, "Edit");++ let x = bar.min.x - 12.0; // Inside the menu content, not on the scroll-bar track.++ let top_band = pos2(x, bar.min.y + 6.0);++ eprintln!("Edit actual viewport scrollbar {bar:?}; top-band input {top_band:?}");++ move_to(&mut h, top_band);++ h.run_steps(180);++ let top = h.query_by_label_contains("Quick Apply").unwrap().rect();++ assert!(top.min.y >= 0.0 && top.max.y <= 520.0, "the first entries return into view ({top:?}); actual bar {bar:?}, pointer {top_band:?}");++ h.run_steps(20);++ assert_eq!(h.query_by_label_contains("Quick Apply").unwrap().rect(), top, "the top bound stops the crawl");++++ let last_at_top = h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect();++ move_to(&mut h, pos2(x, bar.max.y - 6.0));++ h.run_steps(15);++ let scrolled = h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect();++ assert!(scrolled.min.y < last_at_top.min.y - 0.1, "the bottom band starts scrolling again ({last_at_top:?} -> {scrolled:?})");++ move_to(&mut h, pos2(x, bar.center().y));++ h.run_steps(2); // Consume the last one-shot target before checking the stopped menu.++ let stopped = h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect();++ h.run_steps(20);++ assert_eq!(h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect(), stopped, "leaving the band stops the crawl");++ assert!(++ last_at_top.min.y > stopped.min.y + 1.0,++ "there is upward wheel room: bottom {bottom:?}, top {last_at_top:?}, resumed {scrolled:?}, stopped {stopped:?}"++ );++ wheel(&mut h, pos2(x, bar.center().y), 120.0);++ let wheeled_up = h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect();++ assert!(++ wheeled_up.min.y > stopped.min.y + 1.0,++ "upward wheel input moves the menu after the one-shot target: bottom {bottom:?}, top {last_at_top:?}, resumed {scrolled:?}, stopped {stopped:?}, wheeled {wheeled_up:?}"++ );++ assert!(wheeled_up.min.y > bottom.min.y + 1.0, "there is downward wheel room ({bottom:?} -> {wheeled_up:?})");++ wheel(&mut h, pos2(x, bar.center().y), -120.0);++ let wheeled = h.query_by_label_contains("Keyboard Shortcuts").unwrap().rect();++ assert!(++ wheeled.min.y < wheeled_up.min.y - 1.0,++ "wheel input still moves the menu after the one-shot target ({wheeled_up:?} -> {wheeled:?}); bottom {bottom:?}, top {last_at_top:?}, resumed {scrolled:?}, stopped {stopped:?}"++ );++++ // Queue another Edit crawl, then switch titles before its next draw can consume the target.++ move_to(&mut h, pos2(x, bar.max.y - 6.0));++ h.run_steps(15);++ let file = rect(&h, "menu.File");++ move_to(&mut h, file.center());++ let fresh = h.query_by_label_contains("Open Project").expect("File opens while browsing").rect();++ assert!(fresh.min.y >= file.max.y && fresh.max.y <= 520.0, "File starts at its own top, not Edit's offset ({fresh:?})");++ h.run_steps(12);++ assert_eq!(h.query_by_label_contains("Open Project").unwrap().rect(), fresh, "Edit's crawl does not continue in File");++++ // Release on its title rather than an entry, retaining a click-opened popup when possible.++ h.input_mut().events.push(Event::PointerButton { pos: file.center(), button: egui::PointerButton::Primary, pressed: false, modifiers: Default::default() });++ h.run_steps(2);++ if h.query_by_label_contains("Open Project").is_none() {++ click_at(&mut h, file.center());++ }++ let bar = menu_scrollbar(&h, "File");++ let x = bar.min.x - 12.0;++ let released = h.query_by_label_contains("Open Project").unwrap().rect();++ move_to(&mut h, pos2(x, bar.max.y - 6.0));++ h.run_steps(20);++ assert_eq!(h.query_by_label_contains("Open Project").unwrap().rect(), released, "without the hold, the edge does not restart a crawl");++}++fn drag(h: &mut Harness<'_, EffectcraftApp>, from: Pos2, to: Pos2) {h.input_mut().events.push(Event::PointerMoved(from));h.input_mut().events.push(Event::PointerButton { pos: from, button: egui::PointerButton::Primary, pressed: true, modifiers: Default::default() });@@@ -159,7 -234,31 +381,89 @@@ fn settings_dialog_does_not_scroll_sidedelta: vec2(-400.0, 0.0),modifiers: Default::default(),phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,});h.run_steps(20);assert_eq!((rect(&h, "settings.ok"), rect(&h, "settings.page.general")), (ok, page), "nothing moved sideways");}++ /// #2034: the Settings sidebar uses the translated page names when deciding its width.+ #[test]+ fn settings_page_column_fits_japanese_names() {++ use effectcraft_text::fonts;+ use effectcraft_ui_egui::theme::Tokens;++ let mut session = Session::default();+ session.prefs.general.language = "ja".into();- let mut h = Harness::builder().with_size(vec2(1400.0, 900.0)).build_eframe(|_| EffectcraftApp::new(session));- h.run_steps(3);- let ctx = h.ctx.clone();- effectcraft_ui_egui::menus::invoke(h.state_mut(), &ctx, "app.settings", json!({"page": "scripting"})).unwrap();- h.run_steps(3);-++ let app = EffectcraftApp::new(session);+ // The panel titles a page with its Settings menu row, minus the ellipsis.- let name = effectcraft_ui_egui::menus::menu_items(h.state())++ let name = effectcraft_ui_egui::menus::menu_items(&app)+ .into_iter()+ .find(|m| m.id == "app.settings" && m.params["page"] == "scripting")+ .and_then(|m| m.label.strip_suffix("...").map(str::to_owned))+ .expect("the Settings menu lists the Scripting & Expressions page");++ assert!(name.chars().any(|c| c >= '\u{3000}'), "the actual sidebar label is Japanese: {name}");++ // Use the same external-directory scan and face coverage as production, before rendering.++ // The managed job supplies CRAFT_FONTS_DIR; register its canonical fonts folder through the++ // same directory source production scans for EFFECTCRAFT_FONT_DIRS, without changing the env.++ crate::add_canonical_test_fonts();++ fonts::scan_system();++ let base = fonts::resolve("Inter", "Regular").face;++ let japanese = fonts::face(fonts::fallback_for_locale('あ', base, "ja"));++ for ch in ['あ', 'フ'].into_iter().chain(name.chars()) {++ assert!(japanese.has_char(ch), "Japanese fixture lacks {ch:?} for {name:?}: {:?}", japanese.info);++ }++ let required_canonical = std::env::var("CRAFT_FONTS_REQUIRED").as_deref() == Ok("1");++ if required_canonical {++ let root = std::env::var_os("CRAFT_FONTS_DIR").expect("required canonical craft-fonts input");++ let expected =++ std::path::PathBuf::from(root).join("fonts/biz-ud-pgothic/BIZUDPGothic-Regular.ttf").canonicalize().expect("canonical BIZ UDPGothic Regular input");++ let resolved = fonts::resolve("BIZ UDPGothic", "Regular");++ assert!(!resolved.missing, "required BIZ UDPGothic Regular must resolve without substitution");++ let face = fonts::face(resolved.face);++ assert_eq!(face.info.family, "BIZ UDPGothic", "{:?}", face.info);++ assert_eq!(face.info.style, "Regular", "{:?}", face.info);++ assert_eq!(japanese.id, face.id, "required production fallback is the canonical BIZ face: selected {:?}, canonical {:?}", japanese.info, face.info);++ let fonts::FaceData::File(path) = &face.info.data else { panic!("required BIZ face must come from canonical external input: {:?}", face.info) };++ assert_eq!(path.canonicalize().unwrap(), expected, "required face source: {:?}", face.info);++ let expected_bytes = std::fs::read(&expected).unwrap();++ let font = face.font().expect("required canonical BIZ face parses");++ assert!(font.data().as_bytes() == expected_bytes.as_slice(), "resolved BIZ bytes match canonical input {expected:?}");++ for ch in ['あ', 'フ'].into_iter().chain(name.chars()) {++ assert!(face.has_char(ch), "canonical BIZ input lacks actual label glyph {ch:?}: {:?}", face.info);++ }++ eprintln!("required Japanese input {expected:?}: {:?}", face.info);++ }++++ let mut h = Harness::builder().with_size(vec2(1400.0, 900.0)).build_eframe(|_| app);++ h.run_steps(3);++ let ctx = h.ctx.clone();++ effectcraft_ui_egui::menus::invoke(h.state_mut(), &ctx, "app.settings", json!({"page": "scripting"})).unwrap();++ h.run_steps(3);++ h.ctx.fonts_mut(|fonts| {++ let definitions = fonts.definitions();++ assert!(++ definitions.font_data.contains_key("japanese-system"),++ "production installs the Japanese fallback; installed {:?}",++ definitions.font_data.keys().collect::<Vec<_>>()++ );++ assert!(++ definitions.families.get(&egui::FontFamily::Proportional).unwrap().iter().any(|name| name == "japanese-system"),++ "production proportional stack reaches its Japanese fallback"++ );++ if required_canonical {++ let registered = definitions.font_data.get("japanese-system").unwrap();++ let selected = japanese.font().expect("selected canonical Japanese face parses");++ assert_eq!(registered.index, japanese.info.index, "production registration retains selected face index");++ assert!(++ registered.font.as_ref().as_ref() == selected.data().as_bytes(),++ "production japanese-system bytes equal the selected canonical fallback: {:?}",++ japanese.info++ );++ }++ assert!(fonts.has_glyphs(&Tokens::ui(12.5), &name), "production glyph lookup covers actual Japanese sidebar label {name:?}");++ });+ let text_width = h.ctx.fonts_mut(|fonts| fonts.layout_no_wrap(name.clone(), Tokens::ui(12.5), egui::Color32::WHITE).size().x);+ let row = rect(&h, "settings.page.scripting");+ assert!(row.width() >= text_width + 20.0, "{name} needs {text_width} points; row is {row:?}");+ }diff --cc crates/ui-egui/tests/it/ui_tail.rsindex b526c7e28,b526c7e28..1d730841d--- a/crates/ui-egui/tests/it/ui_tail.rs+++ b/crates/ui-egui/tests/it/ui_tail.rs@@@ -197,6 -197,6 +197,7 @@@ fn layer_style_controls_stay_reachable_delta: vec2(-2000.0, -2000.0),modifiers: Default::default(),phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,});h.run_steps(5);let at = in_view(&h, "dialog.layerStyle.value.dropShadow/noise");diff --cc crates/ui-egui/tests/it/ui_text_edit.rsindex d147529b2,ed5baca2d..84a218466--- a/crates/ui-egui/tests/it/ui_text_edit.rs+++ b/crates/ui-egui/tests/it/ui_text_edit.rs@@@ -16,6 -16,11 +16,14 @@@ fn app() -> EffectcraftAppEffectcraftApp::new(s)}+ /// A headless window at the size and frame step the viewer tests here are written for.+ fn harness(a: EffectcraftApp) -> Harness<'static, EffectcraftApp> {- Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| a)++ Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |cc| {++ EffectcraftApp::install_ime_reset_hooks(&cc.egui_ctx);++ a++ })+ }+fn rect(h: &Harness<'_, EffectcraftApp>, id: &str) -> egui::Rect {let e = h.state().auto.find(id).unwrap_or_else(|| panic!("no {id}"));egui::Rect::from_min_size(egui::pos2(e.rect[0], e.rect[1]), egui::vec2(e.rect[2], e.rect[3]))@@@ -570,3 -575,152 +578,1159 @@@ fn type_tool_selected_text_preference_sassert_eq!(edited(&h).0, topmost, "{exclusion} selected text must not override the eligible hit");}}++ /// Opens a fresh Type-tool edit holding `text` and returns the harness with the new layer id,+ /// so the Deselect All tests start from the same state.+ fn type_tool_edit(a: EffectcraftApp, text: &str) -> (Harness<'static, EffectcraftApp>, u64) {+ let mut h = harness(a);+ h.run_steps(3);+ h.state_mut().ui.tool = effectcraft_ui_egui::state::Tool::Type;+ h.run_steps(1);+ let comp = rect(&h, "viewer.comp");+ let p = comp.min + egui::vec2(180.0, 160.0) * (comp.width() / 640.0);+ click(&mut h, p, Modifiers::NONE);+ type_text(&mut h, text);+ let (lid, _, _, _) = edited(&h);+ (h, lid)+ }++ #[test]+ fn deselect_all_chords_end_a_type_tool_edit() {+ for (name, k, mods) in [("Cmd/Ctrl+Shift+A", Key::A, Modifiers { shift: true, ..Modifiers::COMMAND }), ("F2", Key::F2, Modifiers::NONE)] {+ let (mut h, lid) = type_tool_edit(app(), "Hello");+ let (_, text, _, _) = edited(&h);+ assert_eq!(text, "Hello", "{name}: the Type tool click and typing made a layer");+ key(&mut h, k, mods);+ assert!(h.state().session.state.text_edit.is_none(), "{name}: Deselect All ends the edit");+ assert!(h.state().session.state.selected_layers.is_empty(), "{name}: and deselects the layer");+ assert_eq!(layer_doc(&h.state().session, LayerId(lid)).unwrap().text, "Hello", "{name}: the typed text is kept");+ }+ }++ #[test]+ fn cmd_a_in_a_text_edit_still_selects_all_characters() {+ let (mut h, _lid) = type_tool_edit(app(), "Hello");+ key(&mut h, Key::A, Modifiers::COMMAND);+ let (_, _, a, c) = edited(&h);+ assert_eq!((a, c), (0, 5), "Select All keeps selecting every character");+ assert!(h.state().session.state.text_edit.is_some(), "the edit stays open");+ assert_eq!(h.state().session.state.selected_layers.len(), 1, "and the layer stays selected");+ }++ #[test]+ fn rebound_deselect_all_chord_forwards_from_inside_the_edit() {+ let mut a = app();+ a.session.execute("shortcuts.set", json!({"command": "edit.deselectAll", "keys": ["Cmd+Alt+D"]})).unwrap();+ let (mut h, lid) = type_tool_edit(a, "Hello");+ // The chord belongs to the shortcut, not to a hard-coded key: the old defaults do+ // nothing special while the editor holds the keyboard…+ key(&mut h, Key::A, Modifiers { shift: true, ..Modifiers::COMMAND });+ assert!(h.state().session.state.text_edit.is_some(), "Cmd+Shift+A was rebound away");+ let (_, _, a, c) = edited(&h);+ assert_eq!((a, c), (5, 5), "and Cmd+Shift+A no longer selects all characters either");+ key(&mut h, Key::F2, Modifiers::NONE);+ assert!(h.state().session.state.text_edit.is_some(), "nor does F2");+ // …and the current binding is what ends the edit.+ key(&mut h, Key::D, Modifiers { alt: true, ..Modifiers::COMMAND });+ assert!(h.state().session.state.text_edit.is_none(), "the rebound chord ends the edit");+ assert!(h.state().session.state.selected_layers.is_empty(), "and deselects");+ assert_eq!(layer_doc(&h.state().session, LayerId(lid)).unwrap().text, "Hello", "the text is kept");+ }++ #[test]+ fn deselect_all_rebound_onto_an_alt_variant_of_an_editor_chord_forwards() {+ let alt_cmd = |k| (k, Modifiers { alt: true, ..Modifiers::COMMAND });+ for (bound, (k, mods)) in [("Cmd+Alt+Z", alt_cmd(Key::Z)), ("Cmd+Alt+A", alt_cmd(Key::A))] {+ let mut a = app();+ a.session.execute("shortcuts.set", json!({"command": "edit.deselectAll", "keys": [bound]})).unwrap();+ let (mut h, lid) = type_tool_edit(a, "Hello");+ // The editor owns Cmd+A and Cmd+Z themselves, whatever Deselect All is bound to…+ key(&mut h, Key::A, Modifiers::COMMAND);+ let (_, _, a0, c0) = edited(&h);+ assert_eq!((a0, c0), (0, 5), "{bound}: Cmd+A still selects every character");+ type_text(&mut h, "Hi");+ key(&mut h, Key::Z, Modifiers::COMMAND);+ assert_eq!(edited(&h).1, "Hello", "{bound}: Cmd+Z still undoes the typing");+ // …but not their Alt variants, which belong to the rebound Deselect All.+ key(&mut h, k, mods);+ assert!(h.state().session.state.text_edit.is_none(), "{bound}: the rebound chord ends the edit");+ assert!(h.state().session.state.selected_layers.is_empty(), "{bound}: and deselects");+ assert_eq!(layer_doc(&h.state().session, LayerId(lid)).unwrap().text, "Hello", "{bound}: without undoing or selecting text");+ }+ }++ #[test]+ fn bare_letter_rebinding_stays_typing_but_a_function_key_rebinding_forwards() {+ let mut a = app();+ a.session.execute("shortcuts.set", json!({"command": "edit.deselectAll", "keys": ["A"]})).unwrap();+ let (mut h, lid) = type_tool_edit(a, "Hello");+ // A binding without a command modifier is text as far as the editor is concerned: the+ // keystroke belongs to the text, since a command may not steal a key that types+ // (the app-wide dispatcher honors the same invariant by skipping focused text fields).+ key(&mut h, Key::A, Modifiers::NONE);+ assert!(h.state().session.state.text_edit.is_some(), "a bare-letter Deselect All binding does not end the edit");+ type_text(&mut h, "a");+ let (lid2, _, a0, c0) = edited(&h);+ assert_eq!(lid2, lid, "the same edit on the same layer continues");+ assert_eq!((a0, c0), (6, 6), "the letter typed at the caret");+ assert_eq!(layer_doc(&h.state().session, LayerId(lid)).unwrap().text, "Helloa", "and landed in the text");+ // A function key types nothing, so a modifier-free function-key binding is forwarded+ // (the default F2 relies on this).+ h.state_mut().session.execute("shortcuts.set", json!({"command": "edit.deselectAll", "keys": ["F7"]})).unwrap();+ key(&mut h, Key::F7, Modifiers::NONE);+ assert!(h.state().session.state.text_edit.is_none(), "a bare function-key binding ends the edit");+ assert!(h.state().session.state.selected_layers.is_empty(), "and deselects");+ assert_eq!(layer_doc(&h.state().session, LayerId(lid)).unwrap().text, "Helloa", "the text is kept");+ }++ /// Opens a text edit the way a user does from the Project panel — Layer ▸ New ▸ Text's shortcut+ /// while that panel is focused — so the insertion point lives in the comp while focus stays on+ /// Project. Returns the harness and the new layer id.+ fn project_focused_text_edit(text: &str) -> (Harness<'static, EffectcraftApp>, u64) {+ let mut h = harness(app());+ h.run_steps(3);+ h.state_mut().ui.focused = PanelKind::Project;+ h.run_steps(1);+ key(&mut h, Key::T, Modifiers { alt: true, shift: true, ..Modifiers::COMMAND });+ type_text(&mut h, text);+ let (lid, typed, _, _) = edited(&h);+ assert_eq!(typed, text, "typing went into the new layer");+ assert_eq!(h.state().ui.focused, PanelKind::Project, "the Project panel is still the focused panel");+ (h, lid)+ }++ #[test]+ fn deselect_all_chords_end_an_edit_started_while_the_project_panel_is_focused() {+ for (name, k, mods) in [("Cmd/Ctrl+Shift+A", Key::A, Modifiers { shift: true, ..Modifiers::COMMAND }), ("F2", Key::F2, Modifiers::NONE)] {+ let (mut h, lid) = project_focused_text_edit("Hi");+ key(&mut h, k, mods);+ assert!(h.state().session.state.text_edit.is_none(), "{name}: Deselect All ends the edit");+ assert!(h.state().session.state.selected_layers.is_empty(), "{name}: and deselects the layer");+ assert_eq!(layer_doc(&h.state().session, LayerId(lid)).unwrap().text, "Hi", "{name}: the typed text is kept");+ }+ }++ #[test]+ fn deselect_all_menu_item_follows_the_edit_while_the_project_panel_is_focused() {+ let enabled = |h: &Harness<'_, EffectcraftApp>| {+ effectcraft_ui_egui::menus::menu_items(h.state()).into_iter().find(|m| m.id == "edit.deselectAll").is_some_and(|m| m.enabled)+ };+ let (mut h, _) = project_focused_text_edit("Hi");+ h.state_mut().session.execute("project.select", json!({"items": []})).unwrap();+ h.run_steps(1);+ assert!(h.state().session.state.text_edit.is_some(), "the edit is still open");+ // The item ends the edit, so an empty Project selection must not gray it out.+ assert!(enabled(&h), "Deselect All is enabled during the edit");+ key(&mut h, Key::Escape, Modifiers::NONE);+ assert!(h.state().session.state.text_edit.is_none(), "Escape ended the edit");+ assert_eq!(h.state().ui.focused, PanelKind::Project, "the Project panel is still the focused panel");+ // With no edit, the item deselects Project items again: nothing selected there, nothing to do.+ assert!(!enabled(&h), "Deselect All follows the empty Project selection once the edit is over");+ }++++/// The on-canvas editor's outgoing IME producer: the descriptor carries the edited layer's++/// committed text, the real owner, a stable generation and an explicit change cause. A normal++/// typed character is application work; an accepted input-method commit is not.++#[test]++fn ime_producer_follows_the_committed_text_and_cause() {++ // A Latin accent is multi-byte in UTF-8 (the byte offsets below) and Inter draws it, so the++ // harness keeps its strict missing-glyph check; no CJK fallback face is needed headlessly.++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(|_| app());++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().ui.tool = effectcraft_ui_egui::state::Tool::Type;++ h.run_steps(1);++ let comp = rect(&h, "viewer.comp");++ click(&mut h, comp.center(), Modifiers::NONE);++ type_text(&mut h, "Hi");++ let (lid, text, a, c) = edited(&h);++ assert_eq!((text.as_str(), a, c), ("Hi", 2, 2));++++ let ime = h.output().platform_output.ime.clone().expect("the on-canvas editor owns IME");++ let comp_id = h.state().session.active_comp_id().expect("an active comp").0;++ assert_eq!(ime.owner, egui::Id::unique(("effectcraft-ime-text", comp_id, lid)), "the edited comp and layer");++ assert!(ime.context_generation > 0);++ let p = ime.surrounding_text.available().expect("committed text is available");++ assert_eq!((p.text.as_str(), p.cursor, p.anchor), ("Hi", 2, 2));++ assert_eq!(ime.change_cause, egui::ImeChangeCause::Other, "ordinary typing is application work");++ let generation = ime.context_generation;++++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("é".into())));++ h.run_steps(1);++ assert_eq!(edited(&h).1, "Hié");++ let ime = h.output().platform_output.ime.clone().expect("still editing");++ let p = ime.surrounding_text.available().expect("committed text is available");++ assert_eq!((p.text.as_str(), p.cursor, p.anchor), ("Hié", 4, 4), "UTF-8 bytes after the commit");++ assert_eq!(ime.change_cause, egui::ImeChangeCause::InputMethod, "an accepted IME commit earns it");++ assert_eq!(ime.context_generation, generation, "an ordinary edit keeps one context");++}++++/// A click on the Timeline is processed after the viewer overlay drew. The pass must not leave++/// the ended on-canvas editor's old descriptor in the platform output.++#[test]++fn click_away_clears_the_canvas_ime_descriptor_in_the_final_pass() {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let solid = s.execute("layer.newSolid", json!({"name": "Plate", "color": "#406080"})).unwrap()["layer"].as_u64().unwrap();++ let title = s.execute("layer.newText", json!({"text": "Title", "size": 80, "position": [100, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| EffectcraftApp::new(s));++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": title, "caret": 5})).unwrap();++ h.run_steps(2);++ assert!(h.output().platform_output.ime.is_some(), "the editor owns IME before the click");++ let row = rect(&h, &format!("timeline.layer.{solid}.row")).center();++ click(&mut h, row, Modifiers::NONE);++ assert!(h.state().session.state.text_edit.is_none(), "the click ends the edit");++ assert!(h.output().platform_output.ime.is_none(), "the final pass clears the ended editor's descriptor");++}++++/// A new target on the same focused widget must request a composition interrupt, and a delayed++/// commit carrying the previous composition's preview must not reach the new layer.++#[test]++fn switching_text_targets_interrupts_and_rejects_a_delayed_commit() {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let first = s.execute("layer.newText", json!({"text": "A", "size": 80, "position": [80, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let second = s.execute("layer.newText", json!({"text": "B", "size": 80, "position": [80, 240], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ // The delayed commit carries a multi-byte accent Inter draws: no broad missing-glyph++ // allowance, and the stale-composition path is still exercised with real IME events.++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| EffectcraftApp::new(s));++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": first, "caret": 1})).unwrap();++ h.run_steps(2);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++++ h.state_mut().session.execute("text.edit", json!({"layer": second, "caret": 1})).unwrap();++ h.run_steps(1);++ let comp_id = h.state().session.active_comp_id().expect("comp").0;++ let ime = h.output().platform_output.ime.clone().expect("the second editor owns IME");++ assert_eq!(ime.owner, egui::Id::unique(("effectcraft-ime-text", comp_id, second)));++ assert!(ime.should_interrupt_composition, "the session switch cancels the platform composition");++++ // The delayed batch may update the old composition before it commits. That preview must not++ // re-arm the stale guard for the new layer.++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("é".into())));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(first)).unwrap().text, "A");++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "B", "the stale commit is ignored");++}++++/// A stale pre-edit must not re-arm the guard for a following delete-surrounding/commit batch++/// either: deleting around the new layer's caret would otherwise mutate it without a commit.++#[test]++fn a_delayed_preedit_after_a_target_switch_cannot_rearm_the_stale_guard() {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let first = s.execute("layer.newText", json!({"text": "A", "size": 80, "position": [80, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let second = s.execute("layer.newText", json!({"text": "B", "size": 80, "position": [80, 240], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| EffectcraftApp::new(s));++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": first, "caret": 1})).unwrap();++ h.run_steps(2);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++++ h.state_mut().session.execute("text.edit", json!({"layer": second, "caret": 1})).unwrap();++ h.run_steps(1);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::DeleteSurroundingBytes { before_bytes: 1, after_bytes: 0 }));++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("X".into())));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(first)).unwrap().text, "A");++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "B", "the stale pre-edit cannot re-arm a delete/commit batch");++}++++/// A late pre-edit from the old composition can arrive long after the target switch; timing is++/// not provenance. Protection survives idle frames and old terminals until the matching fence.++#[test]++fn late_preedit_and_commit_split_across_idle_frames_cannot_retarget() {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let first = s.execute("layer.newText", json!({"text": "A", "size": 80, "position": [80, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let second = s.execute("layer.newText", json!({"text": "B", "size": 80, "position": [80, 240], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| EffectcraftApp::new(s));++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": first, "caret": 1})).unwrap();++ h.run_steps(2);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++++ h.state_mut().session.execute("text.edit", json!({"layer": second, "caret": 1})).unwrap();++ // Well past the old two-frame suppression window: ownership, not elapsed frames, keeps the++ // tombstone.++ h.run_steps(1);++ let request_id = ime_reset_request(&h);++ h.run_steps(4);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "éé".into(), active_range_chars: None }));++ h.run_steps(3);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("é".into())));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(first)).unwrap().text, "A");++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "B", "the late pre-edit and commit stayed on the old owner");++++ // An actual matching fence admits the fresh composition, without an invented old terminal.++ h.input_mut().events.push(Event::ImeResetCompleted { request_id });++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("é".into())));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "Bé", "a new composition after its matching fence is accepted");++}++++/// A delete-surrounding event belongs to the same stale composition as its late pre-edit even++/// when idle frames separate them. It must not mutate the replacement layer; only F admits fresh++/// input, including when no old terminal commit arrives.++#[test]++fn late_preedit_and_delete_split_across_idle_frames_cannot_retarget() {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let first = s.execute("layer.newText", json!({"text": "A", "size": 80, "position": [80, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let second = s.execute("layer.newText", json!({"text": "B", "size": 80, "position": [80, 240], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| EffectcraftApp::new(s));++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": first, "caret": 1})).unwrap();++ h.run_steps(2);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++++ h.state_mut().session.execute("text.edit", json!({"layer": second, "caret": 1})).unwrap();++ h.run_steps(1);++ let request_id = ime_reset_request(&h);++ h.run_steps(3);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "éé".into(), active_range_chars: None }));++ h.run_steps(3);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::DeleteSurroundingBytes { before_bytes: 1, after_bytes: 0 }));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(first)).unwrap().text, "A");++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "B", "the late delete could not mutate the new owner");++++ h.input_mut().events.push(Event::ImeResetCompleted { request_id });++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("é".into())));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "Bé", "the matching fence admits fresh input");++}++++/// An observed empty pre-edit only ends the visible composition; its terminal commit is a++/// separate event. Switching targets in between must keep the old owner so that delayed commit is++/// rejected instead of landing at the replacement layer's caret.++#[test]++fn empty_preedit_keeps_the_old_target_until_the_pending_commit_arrives() {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let first = s.execute("layer.newText", json!({"text": "A", "size": 80, "position": [80, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let second = s.execute("layer.newText", json!({"text": "B", "size": 80, "position": [80, 240], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| EffectcraftApp::new(s));++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": first, "caret": 1})).unwrap();++ h.run_steps(2);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++++ // The input method clears the visible composition before its commit arrives.++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: String::new(), active_range_chars: None }));++ h.run_steps(1);++ h.state_mut().session.execute("text.edit", json!({"layer": second, "caret": 1})).unwrap();++ h.run_steps(1);++++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("X".into())));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(first)).unwrap().text, "A");++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "B", "the observed empty pre-edit preserved the old owner for its pending commit",);++}++++/// A coalesced raw batch after a target switch may carry the old composition's empty pre-edit and++/// terminal commit followed by a fence and the first pre-edit of a new composition. Only that++/// explicit boundary admits the new pre-edit for the current target.++#[test]++fn a_matching_fence_after_old_terminals_admits_the_next_preedit_in_the_same_batch() {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let first = s.execute("layer.newText", json!({"text": "A", "size": 80, "position": [80, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let second = s.execute("layer.newText", json!({"text": "B", "size": 80, "position": [80, 240], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| EffectcraftApp::new(s));++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": first, "caret": 1})).unwrap();++ h.run_steps(2);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++++ h.state_mut().session.execute("text.edit", json!({"layer": second, "caret": 1})).unwrap();++ h.run_steps(1);++ let request_id = ime_reset_request(&h);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: String::new(), active_range_chars: None }));++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("X".into())));++ h.input_mut().events.push(Event::ImeResetCompleted { request_id });++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "B", "the stale empty pre-edit/commit pair never mutates the new layer",);++++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("é".into())));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(first)).unwrap().text, "A");++ assert_eq!(layer_doc(&h.state().session, LayerId(second)).unwrap().text, "Bé", "the new pre-edit after the matching fence owns the current target",);++}++++/// The byte-count delete-surrounding path through the real app/hook keeps a whole UTF-8++/// character and shares the following commit's undo step.++#[test]++fn delete_surrounding_bytes_through_the_app_replaces_the_emoji() {++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let lid = s.execute("layer.newText", json!({"text": "café😀", "size": 80, "position": [80, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |_| EffectcraftApp::new(s));++ h.state_mut().show_panel(PanelKind::Composition);++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": lid, "caret": 5})).unwrap();++ h.run_steps(2);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::DeleteSurroundingBytes { before_bytes: 4, after_bytes: 0 }));++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("X".into())));++ h.run_steps(2);++ assert_eq!(layer_doc(&h.state().session, LayerId(lid)).unwrap().text, "caféX");++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(layer_doc(&h.state().session, LayerId(lid)).unwrap().text, "café😀", "the delete and commit are one undo step");++}++++/// Use the real viewer's outgoing caret geometry to aim the interruption at a known position.++fn ime_interruption_editor() -> (Harness<'static, EffectcraftApp>, Pos2) {++ crate::add_canonical_test_fonts();++ let mut s = Session::default();++ s.execute("comp.new", json!({"name": "Type", "width": 640, "height": 360, "duration": 2})).unwrap();++ let lid = s.execute("layer.newText", json!({"text": "abcd", "size": 80, "position": [80, 120], "justify": "left"})).unwrap()["layer"].as_u64().unwrap();++ let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1000.0)).with_step_dt(1.0 / 60.0).build_eframe(move |cc| {++ EffectcraftApp::install_ime_reset_hooks(&cc.egui_ctx);++ EffectcraftApp::new(s)++ });++ h.state_mut().show_panel(PanelKind::Composition);++ h.state_mut().ui.tool = effectcraft_ui_egui::state::Tool::Type;++ h.run_steps(3);++ h.state_mut().session.execute("text.edit", json!({"layer": lid, "caret": 1})).unwrap();++ h.run_steps(2);++ let point = h.output().platform_output.ime.as_ref().expect("the viewer drew caret1").cursor_rect.center();++ assert!(rect(&h, "viewer.textEdit").contains(point), "the pointer must hit the actual edited text");++ h.state_mut().session.execute("text.setSelection", json!({"caret": 4})).unwrap();++ h.run_steps(2);++ assert_eq!((edited(&h).2, edited(&h).3), (4, 4));++ (h, point)++}++++/// Real viewer geometry and raw eframe input, without the split-frame `click` helper.++fn native_text_pointer_editor() -> (Harness<'static, EffectcraftApp>, u64, Pos2, Pos2) {++ let (h, caret1) = ime_interruption_editor();++ let caret4 = h.output().platform_output.ime.as_ref().expect("the viewer drew caret4").cursor_rect.center();++ let area = rect(&h, "viewer.area");++ assert!(caret1.is_finite() && caret4.is_finite());++ assert!(area.contains(caret1) && area.contains(caret4));++ assert!(rect(&h, "viewer.textEdit").contains(caret4));++ assert!(caret1.distance(caret4) > 12.0, "separated clicks must not become a double-click");++ let layer = edited(&h).0;++ (h, layer, caret1, caret4)++}++++#[test]++fn native_text_pointer_same_batch_click_moves_caret_and_starts_editing() {++ for active in [true, false] {++ let (mut h, layer, caret1, caret4) = native_text_pointer_editor();++ if !active {++ h.state_mut().session.execute("text.endEdit", json!({})).unwrap();++ h.run_steps(2);++ assert!(h.state().session.state.text_edit.is_none());++ }++ let undo = h.state().session.history.undo.len();++ h.input_mut().events.extend([++ Event::PointerMoved(caret1),++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE },++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h), (layer, "abcd".to_owned(), 1, 1), "active={active}");++ assert!(!h.ctx.input(|i| i.pointer.primary_down()));++ assert_eq!(h.state().session.history.undo.len(), undo, "placing a caret is not a document edit");++ h.input_mut().events.push(Event::PointerMoved(caret4));++ h.run_steps(1);++ assert_eq!((edited(&h).2, edited(&h).3), (1, 1), "release must end selection dragging");++ type_text(&mut h, "X");++ assert_eq!(edited(&h), (layer, "aXbcd".to_owned(), 2, 2), "active={active}");++ }++}++++#[test]++fn native_text_pointer_split_press_drag_release_keeps_ownership() {++ for dragging in [false, true] {++ let (mut h, layer, caret1, caret4) = native_text_pointer_editor();++ h.input_mut().events.extend([++ Event::PointerMoved(caret1),++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h), (layer, "abcd".to_owned(), 1, 1));++ assert!(h.ctx.input(|i| i.pointer.primary_down()));++ let end = if dragging { caret4 } else { caret1 };++ if dragging {++ h.input_mut().events.push(Event::PointerMoved(end));++ h.run_steps(1);++ assert_eq!((edited(&h).2, edited(&h).3), (1, 4));++ }++ h.input_mut().events.push(Event::PointerButton { pos: end, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });++ h.run_steps(1);++ let expected = if dragging { (1, 4) } else { (1, 1) };++ assert!(!h.ctx.input(|i| i.pointer.primary_down()));++ assert_eq!((edited(&h).2, edited(&h).3), expected);++ h.input_mut().events.push(Event::PointerMoved(if dragging { caret1 } else { caret4 }));++ h.run_steps(1);++ assert_eq!((edited(&h).2, edited(&h).3), expected, "a released drag must not follow later movement");++ assert_eq!(layer_doc(&h.state().session, LayerId(layer)).unwrap().text, "abcd");++ }++}++++#[test]++fn native_text_pointer_two_completed_primary_clicks_use_the_latest_primary_press() {++ let (mut h, layer, caret1, caret4) = native_text_pointer_editor();++ h.input_mut().events.extend([++ Event::PointerMoved(caret4),++ Event::PointerButton { pos: caret4, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerButton { pos: caret4, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE },++ Event::PointerMoved(caret1),++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE },++ // A later non-primary click must not become the recovered primary origin.++ Event::PointerMoved(caret4),++ Event::PointerButton { pos: caret4, button: PointerButton::Middle, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerButton { pos: caret4, button: PointerButton::Middle, pressed: false, modifiers: Modifiers::NONE },++ ]);++ h.run_steps(1);++ assert!(h.ctx.input(|i| i.pointer.primary_pressed() && i.pointer.primary_released() && i.pointer.press_origin().is_none()));++ assert!(!h.ctx.input(|i| i.pointer.button_double_clicked(PointerButton::Primary) || i.pointer.button_triple_clicked(PointerButton::Primary)));++ assert_eq!(edited(&h), (layer, "abcd".to_owned(), 1, 1), "the first click must not replace the latest click");++}++++#[test]++fn native_text_pointer_nonfinite_latest_press_does_not_replay_an_earlier_click() {++ for (earlier_finite_click, same_frame_release) in [(false, false), (false, true), (true, false), (true, true)] {++ let (mut h, layer, caret1, caret4) = native_text_pointer_editor();++ let undo = h.state().session.history.undo.len();++ if earlier_finite_click {++ h.input_mut().events.extend([++ Event::PointerMoved(caret1),++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE },++ ]);++ }++ let bad = egui::pos2(f32::INFINITY, caret4.y);++ h.input_mut().events.extend([++ Event::PointerButton { pos: bad, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerMoved(caret1),++ ]);++ if same_frame_release {++ h.input_mut().events.push(Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });++ }++ h.run_steps(1);++ assert_eq!(edited(&h), (layer, "abcd".to_owned(), 4, 4), "earlier_finite_click={earlier_finite_click}");++ assert_eq!(h.state().session.history.undo.len(), undo);++ if !same_frame_release {++ assert!(h.ctx.input(|i| i.pointer.primary_down()));++ h.input_mut().events.push(Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });++ h.run_steps(1);++ assert_eq!(edited(&h), (layer, "abcd".to_owned(), 4, 4), "later release cannot retarget an invalid press");++ assert_eq!(h.state().session.history.undo.len(), undo);++ }++ assert!(!h.ctx.input(|i| i.pointer.primary_down()));++ }++}++++#[test]++fn native_text_pointer_outside_area_origin_cannot_retarget_on_inside_release() {++ for active in [true, false] {++ let (mut h, layer, caret1, _) = native_text_pointer_editor();++ if !active {++ h.state_mut().session.execute("text.endEdit", json!({})).unwrap();++ h.run_steps(2);++ }++ let area = rect(&h, "viewer.area");++ let outside = area.min - egui::vec2(8.0, 8.0);++ assert!(outside.is_finite() && !area.contains(outside));++ assert!(outside.x >= 0.0 && outside.y >= 0.0, "use an actual window location outside the viewer");++ let layers = h.state().session.active_comp().unwrap().layers.len();++ let undo = h.state().session.history.undo.len();++ h.input_mut().events.extend([++ Event::PointerMoved(outside),++ Event::PointerButton { pos: outside, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerMoved(caret1),++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE },++ ]);++ h.run_steps(1);++ assert_eq!(layer_doc(&h.state().session, LayerId(layer)).unwrap().text, "abcd");++ assert_eq!(h.state().session.active_comp().unwrap().layers.len(), layers, "outside origins must not create text in the viewer");++ assert_eq!(h.state().session.history.undo.len(), undo);++ if active {++ // A real outside-panel action may close the edit; it must never retarget it.++ if h.state().session.state.text_edit.is_some() {++ assert_eq!(edited(&h), (layer, "abcd".to_owned(), 4, 4));++ }++ } else {++ assert!(h.state().session.state.text_edit.is_none(), "release inside is not an inside-origin click");++ }++ }++}++++#[test]++fn native_text_pointer_completed_outside_panel_click_closes_the_editor() {++ for (panel, target) in [(PanelKind::Timeline, "timeline.empty"), (PanelKind::Project, "project.empty")] {++ let (mut h, layer, _, _) = native_text_pointer_editor();++ h.state_mut().show_panel(panel);++ h.run_steps(3);++ assert!(h.state().session.state.text_edit.is_some(), "opening a panel is not a pointer click");++ let outside = rect(&h, target).center();++ assert!(!rect(&h, "viewer.area").contains(outside));++ h.input_mut().events.extend([++ Event::PointerMoved(outside),++ Event::PointerButton { pos: outside, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerButton { pos: outside, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE },++ ]);++ h.run_steps(1);++ assert!(h.state().session.state.text_edit.is_none(), "a complete {panel:?} click must close the edit");++ type_text(&mut h, "X");++ assert_eq!(layer_doc(&h.state().session, LayerId(layer)).unwrap().text, "abcd", "typing after click-away must not reach the old editor");++ }++}++++#[test]++fn native_text_pointer_secondary_click_does_not_move_the_caret() {++ let (mut h, layer, caret1, _) = native_text_pointer_editor();++ h.input_mut().events.extend([++ Event::PointerMoved(caret1),++ Event::PointerButton { pos: caret1, button: PointerButton::Secondary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerButton { pos: caret1, button: PointerButton::Secondary, pressed: false, modifiers: Modifiers::NONE },++ ]);++ h.run_steps(1);++ assert!(!h.ctx.input(|i| i.pointer.primary_pressed()));++ assert_eq!(edited(&h), (layer, "abcd".to_owned(), 4, 4));++}++++#[test]++fn native_text_pointer_modal_blocks_background_same_batch_click() {++ let (mut h, layer, caret1, _) = native_text_pointer_editor();++ h.state_mut().dialog = Some(effectcraft_ui_egui::Dialog::About);++ h.run_steps(3);++ h.input_mut().events.extend([++ Event::PointerMoved(caret1),++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::PointerButton { pos: caret1, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE },++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h), (layer, "abcd".to_owned(), 4, 4), "a disabled viewer must not recover a background click");++}++++fn ime_interruption_delete(bytes: bool) -> Event {++ Event::Ime(if bytes {++ egui::ImeEvent::DeleteSurroundingBytes { before_bytes: 1, after_bytes: 0 }++ } else {++ egui::ImeEvent::DeleteSurrounding { before_chars: 1, after_chars: 0 }++ })++}++++fn begin_interrupted_composition(h: &mut Harness<'_, EffectcraftApp>, terminal_pending: bool) {++ EffectcraftApp::install_ime_reset_hooks(&h.ctx);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++ if terminal_pending {++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: String::new(), active_range_chars: None }));++ h.run_steps(1);++ }++ assert_eq!(edited(h).1, "abcd", "neither visible nor cleared preedit changes committed text");++}++++fn request_at_caret(h: &mut Harness<'_, EffectcraftApp>, caret: usize) -> egui::ImeResetId {++ h.state_mut().session.execute("text.setSelection", json!({"caret": caret})).unwrap();++ h.run_steps(1);++ ime_reset_request(h)++}++++fn ime_reset_request(h: &Harness<'_, EffectcraftApp>) -> egui::ImeResetId {++ h.output()++ .platform_output++ .ime++ .as_ref()++ .expect("the real viewer publishes its descriptor")++ .reset_request++ .expect("capture the final request before an unchanged idle pass consumes the one-shot output")++}++++#[test]++fn pointer_caret_interruption_rejects_same_batch_ime_delete_and_commit() {++ for bytes in [false, true] {++ for terminal_pending in [false, true] {++ let (mut h, point) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, terminal_pending);++ let project = h.state().session.project.clone();++ let undo = h.state().session.history.undo.len();++ h.input_mut().events.extend([++ Event::PointerMoved(point),++ Event::PointerButton { pos: point, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ ime_interruption_delete(bytes),++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ ]);++ h.run_steps(1);++ assert_eq!((edited(&h).1.as_str(), edited(&h).2, edited(&h).3), ("abcd", 1, 1), "the actual pointer caret survives stale IME mutations");++ assert!(std::sync::Arc::ptr_eq(&project, &h.state().session.project), "rejected IME never edits the project");++ assert_eq!(h.state().session.history.undo.len(), undo, "rejected input creates no undo entry");++ let request_id = ime_reset_request(&h);++ h.input_mut().events.push(Event::PointerButton { pos: point, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });++ h.run_steps(1);++ // The explicit native fence, not the rejected terminal, admits fresh composition.++ h.input_mut().events.extend([++ Event::ImeResetCompleted { request_id },++ Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }),++ Event::Ime(egui::ImeEvent::Commit("é".into())),++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h).1, "aébcd");++ assert_eq!((edited(&h).2, edited(&h).3), (2, 2));++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(edited(&h).1, "abcd", "only the fresh commit needs undo");++ }++ }++}++++#[test]++fn keyboard_caret_interruption_rejects_later_ime_events_and_keeps_fresh_preedit() {++ for (key, modifiers, expected, fresh_text) in++ [(Key::ArrowLeft, Modifiers::NONE, (3, 3), "abcéd"), (Key::Home, Modifiers::SHIFT, (4, 0), "é"), (Key::A, Modifiers::COMMAND, (0, 4), "é")]++ {++ for bytes in [false, true] {++ let (mut h, _) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, false);++ let project = h.state().session.project.clone();++ let undo = h.state().session.history.undo.len();++ h.input_mut().events.extend([++ Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers },++ ime_interruption_delete(bytes),++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }),++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h).1, "abcd", "the old deletion and commit are refused");++ assert_eq!((edited(&h).2, edited(&h).3), expected, "the real key's selection survives");++ assert!(std::sync::Arc::ptr_eq(&project, &h.state().session.project));++ assert_eq!(h.state().session.history.undo.len(), undo);++ let request_id = ime_reset_request(&h);++ h.input_mut().events.extend([++ Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers },++ Event::ImeResetCompleted { request_id },++ Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }),++ Event::Ime(egui::ImeEvent::Commit("é".into())),++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h).1, fresh_text, "only the fresh preedit after the matching fence is accepted");++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(edited(&h).1, "abcd");++ }++ }++}++++#[test]++fn external_caret_interruption_rejects_pending_composition_mutations() {++ for bytes in [false, true] {++ let (mut h, _) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, true);++ let project = h.state().session.project.clone();++ let undo = h.state().session.history.undo.len();++ // This is the same production command exposed to control clients; no replacement epoch.++ h.state_mut().session.execute("text.setSelection", json!({"caret": 1})).unwrap();++ h.input_mut().events.extend([ime_interruption_delete(bytes), Event::Ime(egui::ImeEvent::Commit("X".into()))]);++ h.run_steps(1);++ assert_eq!((edited(&h).1.as_str(), edited(&h).2, edited(&h).3), ("abcd", 1, 1));++ assert!(std::sync::Arc::ptr_eq(&project, &h.state().session.project));++ assert_eq!(h.state().session.history.undo.len(), undo);++ let request_id = ime_reset_request(&h);++ h.input_mut().events.extend([Event::ImeResetCompleted { request_id }, Event::Ime(egui::ImeEvent::Commit("Y".into()))]);++ h.run_steps(1);++ assert_eq!(edited(&h).1, "aYbcd", "a later direct commit without preedit is still accepted");++ }++}++++#[test]++fn composing_ime_delete_then_commit_and_direct_commit_remain_valid() {++ for bytes in [false, true] {++ let (mut h, _) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, false);++ let undo = h.state().session.history.undo.len();++ h.input_mut().events.extend([ime_interruption_delete(bytes), Event::Ime(egui::ImeEvent::Commit("X".into()))]);++ h.run_steps(1);++ assert_eq!((edited(&h).1.as_str(), edited(&h).2, edited(&h).3), ("abcX", 4, 4), "the IME deletion's own caret movement must not reject its commit");++ assert_eq!(h.state().session.history.undo.len(), undo + 1);++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(edited(&h).1, "abcd", "accepted delete and commit remain one undo step");++ h.run_steps(1);++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("Y".into())));++ h.run_steps(1);++ assert_eq!(edited(&h).1, "abcdY", "noncomposing direct commit remains valid after undo");++ }++}++++#[test]++fn a_noncomposing_direct_commit_can_follow_a_pointer_caret_change_in_the_same_batch() {++ let (mut h, point) = ime_interruption_editor();++ let undo = h.state().session.history.undo.len();++ h.input_mut().events.extend([++ Event::PointerMoved(point),++ Event::PointerButton { pos: point, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::Ime(egui::ImeEvent::Commit("Y".into())),++ ]);++ h.run_steps(1);++ assert_eq!((edited(&h).1.as_str(), edited(&h).2, edited(&h).3), ("aYbcd", 2, 2), "only an interrupted composition is rejected");++ assert_eq!(h.state().session.history.undo.len(), undo + 1);++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(edited(&h).1, "abcd");++}++++fn draws_ime_preview(h: &Harness<'_, EffectcraftApp>) -> bool {++ fn contains_preview(shape: &egui::Shape) -> bool {++ match shape {++ egui::Shape::Text(text) => text.galley.text() == "é",++ egui::Shape::Vec(shapes) => shapes.iter().any(contains_preview),++ _ => false,++ }++ }++ h.output().shapes.iter().any(|shape| contains_preview(&shape.shape))++}++++fn replacement_ime_edit(h: &mut Harness<'_, EffectcraftApp>) -> u64 {++ let replacement =++ h.state_mut().session.execute("layer.newText", json!({"text": "wxyz", "size": 80, "position": [80, 240], "justify": "left"})).unwrap()["layer"]++ .as_u64()++ .unwrap();++ h.state_mut().session.execute("text.edit", json!({"layer": replacement, "caret": 1})).unwrap();++ h.run_steps(1);++ assert_eq!(edited(h), (replacement, "wxyz".to_owned(), 1, 1), "the replacement editor must be live before late IME arrives");++ let comp = h.state().session.active_comp_id().unwrap().0;++ let ime = h.output().platform_output.ime.as_ref().expect("the real replacement editor publishes IME");++ assert_eq!(ime.owner, egui::Id::unique(("effectcraft-ime-text", comp, replacement)));++ assert!(!draws_ime_preview(h), "the old preview must not be drawn on the replacement");++ replacement++}++++#[test]++fn deselect_all_during_composition_rejects_late_ime_on_a_live_replacement_session() {++ for rebound in [false, true] {++ for bytes in [false, true] {++ for terminal_pending in [false, true] {++ let (mut h, _) = ime_interruption_editor();++ let (chord, modifiers) = if rebound {++ h.state_mut().session.execute("shortcuts.set", json!({"command": "edit.deselectAll", "keys": ["Cmd+Alt+Z"]})).unwrap();++ (Key::Z, Modifiers { alt: true, ..Modifiers::COMMAND })++ } else {++ (Key::A, Modifiers { shift: true, ..Modifiers::COMMAND })++ };++ let original = edited(&h).0;++ let old_session = h.state().session.state.text_edit.as_ref().unwrap().session;++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }));++ h.run_steps(1);++ assert!(draws_ime_preview(&h), "a real active composition must draw before interruption");++ if terminal_pending {++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Preedit { text: String::new(), active_range_chars: None }));++ h.run_steps(1);++ assert!(!draws_ime_preview(&h), "empty preedit hides the preview but leaves the terminal pending");++ }++ key(&mut h, chord, modifiers);++ assert!(h.state().session.state.text_edit.is_none(), "the actual current shortcut ends the old edit");++ assert!(h.state().session.state.selected_layers.is_empty());++ assert!(h.output().platform_output.ime.is_none(), "the ended editor must not publish a descriptor");++ assert!(!draws_ime_preview(&h), "Deselect All clears the old preview");++ assert_eq!(layer_doc(&h.state().session, LayerId(original)).unwrap().text, "abcd");++++ let replacement = replacement_ime_edit(&mut h);++ let request_id = ime_reset_request(&h);++ assert_ne!(replacement, original);++ assert_ne!(h.state().session.state.text_edit.as_ref().unwrap().session, old_session);++ let project = h.state().session.project.clone();++ let history = (h.state().session.history.undo.len(), h.state().session.history.redo.len());++ let selection = h.state().session.state.selected_layers.clone();++ h.input_mut().events.extend([ime_interruption_delete(bytes), Event::Ime(egui::ImeEvent::Commit("X".into()))]);++ h.run_steps(1);++ assert_eq!(edited(&h), (replacement, "wxyz".to_owned(), 1, 1), "late delete and commit must reach the live replacement and be rejected");++ assert_eq!(h.state().session.state.selected_layers, selection);++ assert!(std::sync::Arc::ptr_eq(&project, &h.state().session.project), "rejected IME never edits either layer");++ assert_eq!((h.state().session.history.undo.len(), h.state().session.history.redo.len()), history);++ assert_eq!(layer_doc(&h.state().session, LayerId(original)).unwrap().text, "abcd");++++ h.input_mut().events.extend([++ Event::ImeResetCompleted { request_id },++ Event::Ime(egui::ImeEvent::Preedit { text: "é".into(), active_range_chars: None }),++ Event::Ime(egui::ImeEvent::Commit("é".into())),++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h), (replacement, "wéxyz".to_owned(), 2, 2), "a fresh composition still commits after rejecting the old terminal");++ assert_eq!(h.state().session.history.undo.len(), history.0 + 1);++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(edited(&h).1, "wxyz", "only the fresh commit needs undo");++ }++ }++ }++}++++#[test]++fn deselect_all_without_composition_keeps_a_replacement_direct_commit_valid() {++ let (mut h, _) = ime_interruption_editor();++ let original = edited(&h).0;++ key(&mut h, Key::A, Modifiers { shift: true, ..Modifiers::COMMAND });++ assert!(h.state().session.state.text_edit.is_none());++ assert!(h.output().platform_output.ime.is_none());++ let replacement = replacement_ime_edit(&mut h);++ let undo = h.state().session.history.undo.len();++ h.input_mut().events.push(Event::Ime(egui::ImeEvent::Commit("Y".into())));++ h.run_steps(1);++ assert_eq!(edited(&h), (replacement, "wYxyz".to_owned(), 2, 2), "a new editor without an interrupted composition accepts a direct commit");++ assert_eq!(h.state().session.history.undo.len(), undo + 1);++ assert_eq!(layer_doc(&h.state().session, LayerId(original)).unwrap().text, "abcd");++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(edited(&h).1, "wxyz");++}++++fn fresh_ime(text: &str) -> [Event; 2] {++ [Event::Ime(egui::ImeEvent::Preedit { text: text.into(), active_range_chars: None }), Event::Ime(egui::ImeEvent::Commit(text.into()))]++}++++#[test]++fn request_fence_alone_admits_the_first_fresh_ime_in_same_or_next_batch() {++ for terminal_pending in [false, true] {++ for next_batch in [false, true] {++ let (mut h, _) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, terminal_pending);++ let request_id = request_at_caret(&mut h, 1);++ h.input_mut().events.push(Event::ImeResetCompleted { request_id });++ if next_batch {++ h.run_steps(1);++ }++ h.input_mut().events.extend(fresh_ime("が"));++ h.run_steps(1);++ assert_eq!((edited(&h).1.as_str(), edited(&h).2, edited(&h).3), ("aがbcd", 2, 2));++ assert!(h.output().platform_output.ime.as_ref().unwrap().reset_request.is_none(), "completion does not allocate another request");++ h.state_mut().session.execute("edit.undo", json!({})).unwrap();++ assert_eq!(edited(&h).1, "abcd");++ }++ }++}++++#[test]++fn newest_opaque_fence_rejects_stale_foreign_duplicate_and_no_ack_payloads() {++ let (mut h, _) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, false);++ let first = request_at_caret(&mut h, 1);++ let second = request_at_caret(&mut h, 2);++ assert_ne!(first, second);++ let foreign = h.ctx.request_ime_reset(egui::ViewportId::from_hash_of("effect-ime-foreign")).unwrap();++ let foreign_context = egui::Context::default().request_ime_reset(egui::ViewportId::ROOT).unwrap();++ let project = h.state().session.project.clone();++ let undo = h.state().session.history.undo.len();++ for _ in 0..3 {++ h.input_mut().events.extend([++ Event::ImeResetCompleted { request_id: first },++ Event::ImeResetCompleted { request_id: foreign },++ Event::ImeResetCompleted { request_id: foreign_context },++ ime_interruption_delete(false),++ ime_interruption_delete(true),++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ Event::Ime(egui::ImeEvent::Preedit { text: "late".into(), active_range_chars: None }),++ Event::Ime(egui::ImeEvent::Preedit { text: String::new(), active_range_chars: None }),++ ]);++ h.run_steps(1);++ assert_eq!((edited(&h).1.as_str(), edited(&h).3), ("abcd", 2));++ assert!(std::sync::Arc::ptr_eq(&project, &h.state().session.project));++ assert_eq!(h.state().session.history.undo.len(), undo);++ assert!(h.output().platform_output.ime.as_ref().unwrap().reset_request.is_none(), "no-ack does not spin requests");++ }++ h.input_mut().events.extend([++ Event::ImeResetCompleted { request_id: second },++ Event::Ime(egui::ImeEvent::Preedit { text: "が".into(), active_range_chars: None }),++ Event::ImeResetCompleted { request_id: second },++ Event::Ime(egui::ImeEvent::Commit("が".into())),++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h).1, "abがcd", "duplicate F cannot interrupt the newly admitted composition");++ assert!(h.output().platform_output.ime.as_ref().unwrap().reset_request.is_none());++}++++#[test]++fn outside_pointer_visits_the_control_suffix_without_mutating_the_old_viewer() {++ for terminal_pending in [false, true] {++ let (mut h, _) = ime_interruption_editor();++ h.state_mut().show_panel(PanelKind::Timeline);++ h.run_steps(2);++ begin_interrupted_composition(&mut h, terminal_pending);++ let first = request_at_caret(&mut h, 1);++ let layer = edited(&h).0;++ let outside = rect(&h, "timeline.empty").center();++ assert!(!rect(&h, "viewer.area").contains(outside));++ let undo = h.state().session.history.undo.len();++ h.input_mut().events.extend([++ Event::PointerMoved(outside),++ Event::PointerButton { pos: outside, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::ImeResetCompleted { request_id: first },++ Event::Text("BAD".into()),++ Event::Cut,++ Event::Paste("BAD".into()),++ Event::Ime(egui::ImeEvent::Preedit { text: "late".into(), active_range_chars: None }),++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ ]);++ h.run_steps(1);++ assert_eq!(layer_doc(&h.state().session, LayerId(layer)).unwrap().text, "abcd");++ assert_eq!(h.state().session.history.undo.len(), undo);++ assert!(!h.ctx.input(|input| input.events.iter().any(|event| matches!(event, Event::ImeResetCompleted { .. }))), "the suffix control was visited");++ h.input_mut().events.push(Event::PointerButton { pos: outside, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });++ h.run_steps(1);++ h.state_mut().session.execute("text.edit", json!({"layer": layer, "caret": 1})).unwrap();++ h.state_mut().ui.focused = PanelKind::Composition;++ h.run_steps(1);++ let second = ime_reset_request(&h);++ assert_ne!(first, second);++ h.input_mut().events.extend([++ Event::ImeResetCompleted { request_id: first },++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ Event::ImeResetCompleted { request_id: second },++ ]);++ h.input_mut().events.extend(fresh_ime("が"));++ h.run_steps(1);++ assert_eq!(edited(&h).1, "aがbcd");++ }++}++++#[test]++fn old_commit_then_fence_then_outside_pointer_keeps_the_prefix_rejected() {++ let (mut h, _) = ime_interruption_editor();++ h.state_mut().show_panel(PanelKind::Timeline);++ h.run_steps(2);++ begin_interrupted_composition(&mut h, false);++ let first = request_at_caret(&mut h, 1);++ let layer = edited(&h).0;++ let outside = rect(&h, "timeline.empty").center();++ h.input_mut().events.extend([++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ Event::ImeResetCompleted { request_id: first },++ Event::PointerMoved(outside),++ Event::PointerButton { pos: outside, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },++ Event::Text("BAD".into()),++ Event::Paste("BAD".into()),++ ]);++ h.run_steps(1);++ assert_eq!(layer_doc(&h.state().session, LayerId(layer)).unwrap().text, "abcd", "F cannot admit its preceding old commit or the outside suffix");++ h.input_mut().events.push(Event::PointerButton { pos: outside, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });++ h.run_steps(1);++ h.state_mut().session.execute("text.edit", json!({"layer": layer, "caret": 1})).unwrap();++ h.state_mut().ui.focused = PanelKind::Composition;++ h.run_steps(1);++ // A panel may already have ended the custom route before the viewer drew. In that case++ // its controls-only owner retired F and the actual returned replacement must be used.++ if let Some(request_id) = h.output().platform_output.ime.as_ref().unwrap().reset_request {++ assert_ne!(first, request_id);++ h.input_mut().events.push(Event::ImeResetCompleted { request_id });++ }++ h.input_mut().events.extend(fresh_ime("が"));++ h.run_steps(1);++ assert_eq!(edited(&h).1, "aがbcd");++}++++#[test]++fn stock_dialog_suspends_before_sync_and_return_rearms_the_same_model_once() {++ use egui_kittest::kittest::Queryable as _;++ let (mut h, _) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, true);++ let first = request_at_caret(&mut h, 1);++ let custom_owner = h.output().platform_output.ime.as_ref().unwrap().owner;++ h.state_mut().dialog = Some(effectcraft_ui_egui::Dialog::CommandPalette);++ h.state_mut().session.execute("text.setSelection", json!({"caret": 2})).unwrap();++ h.run_steps(2);++ h.input_mut().events.extend([Event::ImeResetCompleted { request_id: first }, Event::Text("xyz".into())]);++ h.run_steps(1);++ let stock = h.output().platform_output.ime.as_ref().expect("the actual stock palette field owns IME");++ assert_ne!(stock.owner, custom_owner);++ assert!(stock.reset_request.is_none(), "ineligible synchronization cannot allocate a new token into the stock descriptor");++ // The real accessible name must remain available after typing hides the placeholder.++ let palette = h.get_by_role_and_label(egui::accesskit::Role::TextInput, "Type a command or effect…");++ assert_eq!(palette.value().as_deref(), Some("xyz"), "the visible stock field receives the text untouched by custom control routing");++ assert_eq!(edited(&h).1, "abcd");++ h.state_mut().dialog = None;++ h.state_mut().ui.focused = PanelKind::Composition;++ h.ctx.memory_mut(|memory| {++ if let Some(field) = memory.focused() {++ memory.surrender_focus(field);++ }++ });++ h.run_steps(1);++ let second = ime_reset_request(&h);++ assert_ne!(first, second);++ h.run_steps(1);++ assert!(h.output().platform_output.ime.as_ref().unwrap().reset_request.is_none());++ h.input_mut().events.extend([++ Event::ImeResetCompleted { request_id: first },++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ Event::ImeResetCompleted { request_id: second },++ ]);++ h.input_mut().events.extend(fresh_ime("が"));++ h.run_steps(1);++ assert_eq!(edited(&h).1, "abがcd");++}++++#[test]++fn full_pass_logic_keeps_a_request_while_hidden_logic_rearms_once_on_return() {++ let (mut h, _) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, false);++ let first = request_at_caret(&mut h, 1);++ h.run_steps(2);++ assert!(h.output().platform_output.ime.as_ref().unwrap().reset_request.is_none(), "normal App::logic before UI must not rearm");++ let ctx = h.ctx.clone();++ let frame = eframe::Frame::_new_kittest();++ let raw = egui::RawInput::default();++ for _ in 0..3 {++ let _ = ctx.run_logic(&raw, |ctx| {++ h.state_mut().tick(ctx, &frame);++ h.state().finish_ime_logic(ctx);++ });++ }++ h.run_steps(1);++ let second = ime_reset_request(&h);++ assert_ne!(first, second);++ h.run_steps(1);++ assert!(h.output().platform_output.ime.as_ref().unwrap().reset_request.is_none());++ h.input_mut().events.extend([++ Event::ImeResetCompleted { request_id: first },++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ Event::ImeResetCompleted { request_id: second },++ ]);++ h.input_mut().events.extend(fresh_ime("が"));++ h.run_steps(1);++ assert_eq!(edited(&h).1, "aがbcd");++}++++#[test]++fn same_caret_application_text_replacement_rejects_the_previous_context_fence() {++ let (mut h, _) = ime_interruption_editor();++ begin_interrupted_composition(&mut h, false);++ let first = request_at_caret(&mut h, 1);++ let before = edited(&h);++ let generation = h.output().platform_output.ime.as_ref().unwrap().context_generation;++ h.state_mut().session.execute("layer.setText", json!({"layer": before.0, "text": "Abcd"})).unwrap();++ h.input_mut().events.extend([++ Event::ImeResetCompleted { request_id: first },++ ime_interruption_delete(true),++ Event::Ime(egui::ImeEvent::Commit("X".into())),++ ]);++ h.run_steps(1);++ assert_eq!(edited(&h), (before.0, "Abcd".to_owned(), before.2, before.3));++ let output = h.output().platform_output.ime.as_ref().unwrap();++ assert_ne!(output.context_generation, generation, "same numeric owner/caret still has a new context");++ let second = ime_reset_request(&h);++ assert_ne!(first, second);++ h.input_mut().events.push(Event::ImeResetCompleted { request_id: second });++ h.input_mut().events.extend(fresh_ime("が"));++ h.run_steps(1);++ assert_eq!(edited(&h).1, "Aがbcd");++}diff --cc crates/ui-egui/tests/it/ui_time_zoom_controls.rsindex 4ab725d6a,4ab725d6a..c1ea26b2b--- a/crates/ui-egui/tests/it/ui_time_zoom_controls.rs+++ b/crates/ui-egui/tests/it/ui_time_zoom_controls.rs@@@ -42,7 -42,7 +42,8 @@@ fn harness(graph: bool) -> Harness<'stafn send(h: &mut Harness<'_, EffectcraftApp>, method: &str, params: Value) {let ctx = h.ctx.clone();let (req, _rx) = ControlRequest::new(method, params);-- if let Outcome::Done(v) = control::handle(h.state_mut(), &ctx, &req) {++ let now = h.state().now();++ if let Outcome::Done(v) = control::handle(h.state_mut(), &ctx, &req, now) {assert!(v["ok"] != false, "{method}: {v}");}for e in h.state_mut().take_synthetic_input() {diff --cc crates/ui-egui/tests/it/ui_timeline_zoom.rsindex 5f731e118,5f731e118..d05ffae64--- a/crates/ui-egui/tests/it/ui_timeline_zoom.rs+++ b/crates/ui-egui/tests/it/ui_timeline_zoom.rs@@@ -30,7 -30,7 +30,13 @@@ fn over_bar(h: &Harness<'_, Effectcraftfn alt_wheel(h: &mut Harness<'_, EffectcraftApp>, at: Pos2, dy: f32) {h.event(Event::PointerMoved(at));h.event(Event::ModifiersChanged(Modifiers::ALT));-- h.event(Event::MouseWheel { unit: MouseWheelUnit::Point, delta: vec2(0.0, dy), modifiers: Modifiers::ALT, phase: egui::TouchPhase::Move });++ h.event(Event::MouseWheel {++ unit: MouseWheelUnit::Point,++ delta: vec2(0.0, dy),++ modifiers: Modifiers::ALT,++ phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,++ });h.step();h.event(Event::ModifiersChanged(Modifiers::NONE));h.step();@@@ -78,7 -78,7 +84,13 @@@ fn ctrl_wheel_and_pinch_zoom_time()let at = over_bar(&h, layer);h.event(Event::PointerMoved(at));h.event(Event::ModifiersChanged(Modifiers::COMMAND));-- h.event(Event::MouseWheel { unit: MouseWheelUnit::Point, delta: vec2(0.0, 240.0), modifiers: Modifiers::COMMAND, phase: egui::TouchPhase::Move });++ h.event(Event::MouseWheel {++ unit: MouseWheelUnit::Point,++ delta: vec2(0.0, 240.0),++ modifiers: Modifiers::COMMAND,++ phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,++ });h.step();h.event(Event::ModifiersChanged(Modifiers::NONE));h.step();diff --cc crates/ui-egui/tests/it/ui_video_preview_off.rsindex e27a37c29,e27a37c29..37a35f856--- a/crates/ui-egui/tests/it/ui_video_preview_off.rs+++ b/crates/ui-egui/tests/it/ui_video_preview_off.rs@@@ -21,7 -21,7 +21,7 @@@ fn an_audio_only_preview_says_video_pres.prefs.preview.get_mut(sc).include_video = false;let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 30.0).build_eframe(|_| EffectcraftApp::new(s));h.run_steps(4);-- let chip = |h: &Harness<'_, EffectcraftApp>| h.ctx.data(|d| d.get_temp::<egui::Rect>(egui::Id::new("viewer-video-off-chip")));++ let chip = |h: &Harness<'_, EffectcraftApp>| h.ctx.data(|d| d.get_temp::<egui::Rect>(egui::Id::unique("viewer-video-off-chip")));assert!(chip(&h).is_none());let now = h.ctx.input(|i| i.time);h.state_mut().play(now);@@@ -30,7 -30,7 +30,7 @@@assert!(chip(&h).is_some(), "the viewer shows the Video-off notice");assert_eq!(frame(&h), 0, "the current time stays put with Video off");h.state_mut().stop();-- h.ctx.data_mut(|d| d.remove::<egui::Rect>(egui::Id::new("viewer-video-off-chip")));++ h.ctx.data_mut(|d| d.remove::<egui::Rect>(egui::Id::unique("viewer-video-off-chip")));h.run_steps(3);assert!(h.state().video_preview_off().is_none());assert!(chip(&h).is_none(), "no notice once stopped");diff --cc crates/ui-egui/tests/it/ui_viewer.rsindex 2a9162a59,14464d189..993925b59--- a/crates/ui-egui/tests/it/ui_viewer.rs+++ b/crates/ui-egui/tests/it/ui_viewer.rs@@@ -193,7 -193,7 +193,8 @@@ fn each_comp_keeps_its_viewer_resolutioassert_eq!(h.state().viewer_res(), Resolution::Auto);let (req, _reply) = effectcraft_ui_egui::control::ControlRequest::new("ui.set", json!({"viewer": {"res": "quarter"}}));let ctx = h.ctx.clone();-- let _ = effectcraft_ui_egui::control::handle(h.state_mut(), &ctx, &req);++ let now = h.state().now();++ let _ = effectcraft_ui_egui::control::handle(h.state_mut(), &ctx, &req, now);assert_eq!(h.state().viewer_res(), Resolution::Quarter);let ctx = h.ctx.clone();assert_eq!(effectcraft_ui_egui::control::inspect(h.state(), &ctx)["ui"]["viewer"]["res"], json!("Quarter"));@@@ -1802,6 -1870,6 +1871,14 @@@ fn key_twice(h: &mut Harness<'_, Effect#[test]fn property_shortcuts_reveal_and_key_transform_properties() {let mut h = harness();++ // Reveal shortcuts compare wall-clock instants; drive the app clock so a step count++ // cannot decide whether a second press is "quick" or a later one.++ h.state_mut().use_manual_clock();++ h.run_steps(1);++ let wait = |h: &mut Harness<'_, EffectcraftApp>| {++ h.state_mut().clock_mut().advance(1.0);++ h.run_steps(2);++ };h.state_mut().session.execute("layer.select", json!({"layers": ["Box"]})).unwrap();h.run_steps(2);let t = |h: &Harness<'_, EffectcraftApp>, p: &str| shown(h, prop_uid(h, "Box", &format!("transform/{p}")));@@@ -1838,16 -1906,16 +1915,16 @@@h.run_steps(2);key(&mut h, egui::Key::U, none);only(&h, &["opacity"]);-- h.run_steps(40);++ wait(&mut h);key(&mut h, egui::Key::U, none);only(&h, &[]);h.state_mut().session.execute("prop.set", json!({"layer": "Box", "path": "transform/rotation", "value": 30})).unwrap();-- h.run_steps(40);++ wait(&mut h);key_twice(&mut h, egui::Key::U);assert!(t(&h, "opacity") && t(&h, "rotation"), "UU: animated and changed properties");assert!(!t(&h, "scale"), "an untouched property stays hidden");// Ctrl+`: twirl the selected layer open, then closed.-- h.run_steps(40);++ wait(&mut h);key(&mut h, egui::Key::Backtick, egui::Modifiers::COMMAND);let id = layer_id(&h, "Box");assert!(h.state().ui.timeline.open_layers.contains(&id) && h.state().ui.timeline.reveal.is_empty());@@@ -1858,6 -1926,6 +1935,14 @@@#[test]fn double_press_shortcuts_reveal_their_second_set() {let mut h = harness();++ // Reveal shortcuts compare wall-clock instants; drive the app clock so a step count++ // cannot decide whether a second press is "quick" or a later one.++ h.state_mut().use_manual_clock();++ h.run_steps(1);++ let wait = |h: &mut Harness<'_, EffectcraftApp>| {++ h.state_mut().clock_mut().advance(1.0);++ h.run_steps(2);++ };h.state_mut().session.execute("layer.select", json!({"layers": ["Box"]})).unwrap();h.state_mut().session.execute("prop.setExpression", json!({"layer": "Box", "path": "transform/scale", "expression": "value"})).unwrap();h.run_steps(2);@@@ -1866,24 -1934,24 +1951,24 @@@key_twice(&mut h, egui::Key::E);assert_eq!(reveal(&h), vec!["expressions"]);assert!(shown(&h, prop_uid(&h, "Box", "transform/scale")));-- h.run_steps(40);++ wait(&mut h);// TT: Mask Opacity; MM: every mask property; a single M: Mask Path.key_twice(&mut h, egui::Key::T);assert_eq!(reveal(&h), vec!["maskOpacity"]);-- h.run_steps(40);++ wait(&mut h);key(&mut h, egui::Key::M, Default::default());assert_eq!(reveal(&h), vec!["maskPath"]);-- h.run_steps(40);++ wait(&mut h);key_twice(&mut h, egui::Key::M);assert_eq!(reveal(&h), vec!["masks"]);-- h.run_steps(40);++ wait(&mut h);// RR Time Remap, AA Material Options, PP paint/puppet, SS selected properties, FF missing effects.for (k, want) in[(egui::Key::R, "timeRemap"), (egui::Key::A, "material"), (egui::Key::P, "paint"), (egui::Key::S, "selected"), (egui::Key::F, "missingEffects")]{key_twice(&mut h, k);assert_eq!(reveal(&h), vec![want], "{k:?}{k:?}");-- h.run_steps(40);++ wait(&mut h);}}diff --cc crates/ui-egui/tests/it/ui_web_gpu_storage.rsindex 9977858c9,9977858c9..a742226de--- a/crates/ui-egui/tests/it/ui_web_gpu_storage.rs+++ b/crates/ui-egui/tests/it/ui_web_gpu_storage.rs@@@ -211,7 -211,7 +211,8 @@@ impl StorageHost for Storagefn send(h: &mut Harness<'_, EffectcraftApp>, method: &str, params: Value) {let ctx = h.ctx.clone();let (req, _rx) = ControlRequest::new(method, params);-- if let Outcome::Done(v) = control::handle(h.state_mut(), &ctx, &req) {++ let now = h.state().now();++ if let Outcome::Done(v) = control::handle(h.state_mut(), &ctx, &req, now) {assert!(v["ok"] != false, "{method}: {v}");}// kittest doesn't call `raw_input_hook`: feed the synthetic click in.diff --cc crates/ui-egui/tests/it/ui_workflow_selection.rsindex 6e264dd33,d2777b22a..121c2b888--- a/crates/ui-egui/tests/it/ui_workflow_selection.rs+++ b/crates/ui-egui/tests/it/ui_workflow_selection.rs@@@ -299,7 -299,7 +299,7 @@@ fn viewer_context_select_reaches_an_obsh.step();}h.run_steps(3);-- h.get_by_label("Select ⏵").click();++ h.get_by_label("Select").click();h.run_steps(3);h.get_by_label("Tile 1").click();h.run_steps(3);diff --cc crates/ui-egui/tests/it/ui_workspace_focus.rsindex 0d0ecd001,0d0ecd001..fbadb964d--- a/crates/ui-egui/tests/it/ui_workspace_focus.rs+++ b/crates/ui-egui/tests/it/ui_workspace_focus.rs@@@ -128,23 -128,23 +128,23 @@@ fn tab_and_shift_tab_traverse_toolbar_ah.run_steps(3);for _ in 0..8 {key(&mut h, Key::Tab, Modifiers::NONE);-- if h.ctx.memory(|m| m.focused()) == Some(Id::new(("tool-slot", 0usize))) {++ if h.ctx.memory(|m| m.focused()) == Some(Id::unique(("tool-slot", 0usize))) {break;}}-- assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::new(("tool-slot", 0usize))));++ assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::unique(("tool-slot", 0usize))));key(&mut h, Key::Tab, Modifiers::NONE);-- assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::new(("tool-slot", 1usize))));++ assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::unique(("tool-slot", 1usize))));assert_eq!(h.state().ui.tool, Tool::Selection, "focus movement alone must not select a tool");key(&mut h, Key::Tab, Modifiers::NONE);-- assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::new(("tool-slot", 2usize))));++ assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::unique(("tool-slot", 2usize))));key(&mut h, Key::Tab, Modifiers::SHIFT);-- assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::new(("tool-slot", 1usize))));++ assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::unique(("tool-slot", 1usize))));key(&mut h, Key::Space, Modifiers::NONE);assert_eq!(h.state().ui.tool, Tool::Hand);assert!(!h.state().playback.playing, "Space activates the focused widget, not preview playback");assert!(Arc::ptr_eq(&h.state().session.project, &project), "keyboard focus and tool selection do not modify the project");-- let response = h.ctx.read_response(Id::new(("tool-slot", 1usize))).unwrap();++ let response = h.ctx.read_response(Id::unique(("tool-slot", 1usize))).unwrap();assert!(h.output().shapes.iter().any(|shape| {matches!(&shape.shape, egui::Shape::Rect(r) if r.rect == response.rect.shrink(1.0) && r.stroke.color == h.state().tokens.text && r.stroke.width > 0.0)@@@ -176,7 -176,7 +176,7 @@@ fn tab_traversal_activates_an_inactive_h.run_steps(3);assert!(h.state().auto.find("panel.tab.EffectControls").is_some(), "the inactive tab must be visible in this fixture");let before = h.state().ui.dock.clone();-- let target = Id::new(("tab", "aaa".to_string(), 1usize));++ let target = Id::unique(("tab", "aaa".to_string(), 1usize));let mut tabs = 0;for _ in 0..80 {key(&mut h, Key::Tab, Modifiers::NONE);@@@ -205,7 -205,7 +205,7 @@@let inspected = effectcraft_ui_egui::control::inspect(h.state(), &h.ctx);assert_eq!(inspected["keyboardFocus"]["automationId"], "panel.tab.EffectControls");key(&mut h, Key::Tab, Modifiers::SHIFT);-- assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::new(("tab", "aaa".to_string(), 0usize))));++ assert_eq!(h.ctx.memory(|m| m.focused()), Some(Id::unique(("tab", "aaa".to_string(), 0usize))));key(&mut h, Key::Enter, Modifiers::NONE);assert_eq!(h.state().ui.focused, PanelKind::Project);assert!(!h.state().playback.playing);@@@ -284,7 -284,7 +284,7 @@@ fn control_root_divider_drag_after_toold.ok("ui.click", json!({"id":"tools.Selection"}), true);// The toolbar can grow as upstream adds controls. Traverse to the actual response// identity rather than assuming a fixed number of focus stops.-- let target = Id::new(("tab", "aaa".to_string(), 1usize));++ let target = Id::unique(("tab", "aaa".to_string(), 1usize));for tabs in 1..=100 {d.ok("ui.key", json!({"key":"Tab"}), true);assert!(d.h.state().ui.mini_flowchart.is_none(), "dock-tab traversal must not open a foreground popup");diff --cc crates/ui-egui/tests/it/viewer_geometry.rsindex ff242230f,ff242230f..e3e4128e8--- a/crates/ui-egui/tests/it/viewer_geometry.rs+++ b/crates/ui-egui/tests/it/viewer_geometry.rs@@@ -95,7 -95,7 +95,13 @@@ fn compact_control_row_scrolls_and_preslet mut h = harness(300.0, ThemeKind::Light);assert!(rect(&h, "viewer.timecode").right() > 300.0);h.event(Event::PointerMoved(pos2(150.0, 345.0)));-- h.event(Event::MouseWheel { unit: egui::MouseWheelUnit::Point, delta: vec2(-1500.0, 0.0), modifiers: Default::default(), phase: egui::TouchPhase::Move });++ h.event(Event::MouseWheel {++ unit: egui::MouseWheelUnit::Point,++ delta: vec2(-1500.0, 0.0),++ modifiers: Default::default(),++ phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,++ });h.run_steps(30);let timecode = rect(&h, "viewer.timecode");let row = rect(&h, "viewer.controls");@@@ -160,7 -160,7 +166,7 @@@ fn click_control(h: &mut Harness<'_, Ef#[test]fn tab_traversal_reveals_the_last_control() {let mut h = harness(300.0, ThemeKind::Dark);-- let last = egui::Id::new("vw-timecode");++ let last = egui::Id::unique("vw-timecode");for _ in 0..80 {h.key_press(egui::Key::Tab);h.run_steps(3);@@@ -232,7 -232,7 +238,13 @@@ fn painted_scrollbar(h: &Harness<'_, Effn scroll_controls_to_end(h: &mut Harness<'_, EffectcraftApp>) {h.event(Event::PointerMoved(pos2(150.0, 345.0)));-- h.event(Event::MouseWheel { unit: egui::MouseWheelUnit::Point, delta: vec2(-1500.0, 0.0), modifiers: Default::default(), phase: egui::TouchPhase::Move });++ h.event(Event::MouseWheel {++ unit: egui::MouseWheelUnit::Point,++ delta: vec2(-1500.0, 0.0),++ modifiers: Default::default(),++ phase: egui::TouchPhase::Move,++ source: egui::MouseWheelSource::Wheel,++ });h.run_steps(30);h.event(Event::PointerMoved(pos2(150.0, 180.0)));h.run_steps(3);diff --cc crates/ui-egui/tests/ui_accessibility.rsindex 000000000,000000000..df283b0f9new file mode 100644--- /dev/null+++ b/crates/ui-egui/tests/ui_accessibility.rs@@@ -1,0 -1,0 +1,52 @@@++//! Accessibility of the app's own controls.++//!++//! The shared widgets in `widgets.rs` are raw `ui.interact` rectangles. Without a `WidgetInfo`++//! they are not in the accessibility tree at all, so neither a screen reader nor kittest can++//! reach them; and an input control without a name is unreachable even when it is in the tree.++//! `Harness::run` checks the tree it has, but only for the screen it settled on: this opens every++//! panel and checks again.++//!++//! Limit: a control that reports no `WidgetInfo` at all has no node, so it is not "unnamed" here.++//! `widgets::checkbox` and the raw-painted row controls (`icon_toggle`, `scroll_bar`, hot-number++//! values) are still in that state; naming every call site is separate work.++++use effectcraft_engine::Session;++use effectcraft_ui_egui::EffectcraftApp;++use effectcraft_ui_egui::dock::PanelKind;++use egui_kittest::Harness;++use egui_kittest::kittest::{NodeT, Queryable};++use serde_json::json;++++fn harness() -> Harness<'static, EffectcraftApp> {++ let mut s = Session::default();++ s.execute("file.openDemoProject", json!({})).unwrap();++ // A text layer under edit gives the Character / Paragraph panels their controls.++ let _ = s.execute("layer.select", json!({"layers": ["EFFECTCRAFT"]}));++ Harness::builder().with_size(egui::vec2(1680.0, 1020.0)).build_eframe(|_| EffectcraftApp::new(s))++}++++#[test]++fn custom_toolbar_buttons_are_named() {++ let mut h = harness();++ h.run();++ // An icon button carries no text of its own: its tooltip is its accessible name.++ let home = h.query_by_label("Home").expect("the toolbar's Home icon button is named by its tooltip");++ assert_eq!(home.accesskit_node().role(), egui::accesskit::Role::Button);++ assert!(h.unnamed_widgets().is_empty(), "{:?}", h.unnamed_widgets());++}++++#[test]++fn every_panel_names_its_input_controls() {++ let mut h = harness();++ h.run();++ let mut unnamed = vec![];++ for p in PanelKind::ALL {++ h.state_mut().show_panel(p);++ h.state_mut().ui.maximized = Some(p);++ h.run_steps(4);++ for w in h.unnamed_widgets() {++ unnamed.push(format!("{}: {w}", p.title()));++ }++ }++ assert!(unnamed.is_empty(), "{} control(s) have no accessible name:\n{}", unnamed.len(), unnamed.join("\n"));++}diff --cc docs/agents.mdindex 04f09a2ee,5c58d24b7..aae8be12c--- a/docs/agents.md+++ b/docs/agents.md@@@ -532,7 -533,7 +533,10 @@@ indices): character attributestarts editing (`position` instead of `box` makes point text; `vertical: true` vertical type).2. `text.insert {"text":"Hello world"}` types at the caret (replacing the selection);`text.setSelection {"start":6,"end":11}` selects "world"; `text.moveCaret {"to":"wordLeft",-- "extend":true}` moves like the arrow keys; `text.delete {"word":true}` is Alt+Backspace.++ "extend":true}` moves like the arrow keys; `text.delete {"word":true}` is Alt+Backspace;++ `text.deleteSurrounding {"before":1,"after":2,"bytes":true}` deletes the characters around the++ selection without deleting it (what an input method's replacement asks for: the selection stays++ for the commit that follows; a byte count ending inside a character leaves that character).3. `layer.setText {"range":[6,11], "size":40, "fill":"#ff5500"}` styles the selection (theCharacter panel does the same); with an empty range it sets the style the next typed text takes.4. `edit.copy`, `edit.paste`, `edit.pasteTextMatchFormatting` and `edit.pasteTextFormattingOnly`diff --cc docs/control-protocol.mdindex 8cd7b7692,40ad36f8d..aa5b22f8b--- a/docs/control-protocol.md+++ b/docs/control-protocol.md@@@ -126,7 -126,7 +126,7 @@@ frames and can be assigned through `sho| Method | Params | Result ||---|---|---|--| `ui.screenshot` | `{path?, panel?, id?}` | `{path, width, height}`: a PNG of the window, or cropped to one panel or element. |++| `ui.screenshot` | `{path?, panel?, id?}` | `{path, width, height}`: a PNG of the window, or cropped to one panel or element. The panel or element rectangle is resolved when the capture is issued (after the UI settles), so it follows a panel that moved; a panel or id that is not on screen is retried and then reported, never replaced by a whole-window shot. |Element ids are stable, for example `tools.Selection`, `panel.Timeline`, `panel.tab.EffectControls`,`panel.tab.Timeline.<comp>` (one Timeline tab per open comp; `panel.tab.Timeline` is the showndiff --cc docs/egui-037-migration-plan.mdindex 000000000,000000000..692cec33cnew file mode 100644--- /dev/null+++ b/docs/egui-037-migration-plan.md@@@ -1,0 -1,0 +1,1607 @@@++# EffectCraft — egui 0.37 migration plan++++Current landing status, 2026-10-25: the working tree includes main `991904888a20b7da72b2a4880b21c7d912154736` and pins egui `6d518fc799681571963842f95b55a6b68431b15a`, winit `a517b3846ee8457d84ee4975110bfda6797c44dc` and shared UI `25da1314d443171b4adeaad2cd9454b273f35c6f`. The final IME adapter uses ordered native reset request identifiers and `ImeResetCompleted`; the earlier tombstone-only description below is historical.++++Full current-source CI `egui037-effectcraft-current-main-ci-20261025-0231` recorded 3,961 passing tests, 14 failures and 31 ignored across 88 test summaries. All 14 failures are GPU tests: their names and diagnostic blocks match the frozen pre-migration `eb51087` baseline exactly after removing thread process numbers. Formatting, strict lint, layering, assets and the 32-crate WASM check completed. The 596-test UI regression suite passes. This is not a green full-CI result or hardware-GPU qualification. Native IME, visible final-source workflows and paired performance remain open.++++The repository's green-only commit gate remains unmet by the GPU results; the reviewed worktree and complete evidence are retained for human review. No push, publication or merge is authorized by this status.++++Historical implementation and research record follows. Its older pins, test counts and unacknowledged-reset description do not describe the current candidate.++++Status: implementation in progress, 2026-10-24. The dependency/API port, IME context adapter,++screenshots, accessibility, font coverage and text-edit repairs are present in the dirty migration++worktree. The parent-managed local run++`egui037-effectcraft-candidate-20261024-upstream-tests-09` recorded **820 passed, 14 ignored**:++`effectcraft-ui-egui --lib` 297 passed / 3 ignored, `--test it` 521 passed / 11 ignored and++`--test ui_accessibility` 2 passed; `cargo clippy -p effectcraft-ui-egui --lib --tests -- -D warnings`++exited 0. That run covers `effectcraft-ui-egui` only; the engine suite, full `cargo xtask ci`, wasm,++native GUI and real-platform IME were not rerun for this revision. Evidence:++`/home/codex/work/ssd2/task-evidence/egui037-effectcraft-candidate-20261023/task-jobs/egui037-effectcraft-candidate-20261024-upstream-tests-09/output.log`.++The custom viewer text editor now has an explicit per-viewport IME composition lifecycle instead++of a frame-number suppression window: an active composition is owned by the edit session's++layer/session identity, and a target switch or editor end turns it into a tombstone. An empty++pre-edit is the observed end of the visible composition, but its terminal commit/delete can arrive++in a later event, so the owner stays associated with the cleared composition; if the target changes++before that terminal event, the tombstone rejects it instead of applying it to the replacement. A++lone non-empty old pre-edit keeps the tombstone across arbitrary idle frames. A rejected terminal++commit consumes the tombstone immediately, so a new pre-edit later in the same raw input batch++starts a composition for the current target. A rejected empty pre-edit or delete-surrounding keeps++the tombstone through the rest of that batch so its paired old commit is rejected too, and is++consumed at batch end when no commit follows. A composition started after that terminal boundary is++accepted, so the tombstone never becomes a permanent lock. `egui::ImeEvent`++payloads still carry no context generation, and the inspected `egui-winit` 0.37 source ignores++`Ime::Enabled`/`Ime::Disabled` and implements `should_interrupt_composition` by toggling++`set_ime_allowed` without an observable reset acknowledgement. The fallback therefore drops the++first ambiguous composition after an unobserved platform reset rather than claiming provenance it++cannot prove; a producer-side event epoch would be needed to close that residual, and this is not++claimed as tested on a real platform IME here. Two real-app headless regressions in++`crates/ui-egui/tests/it/ui_text_edit.rs` cover the observed-empty-preedit pending commit and a new++pre-edit after a stale terminal commit in the same raw batch; this revision adds them but does not++claim they were rerun here.++The later bounded same-owner interruption repair (2026-10-24) tracks the expected caret and++selection separately from that immutable layer/session owner. A live or terminal-pending++composition is invalidated before application pointer/selection changes can accept an old IME++mutation, including keys before a later IME event in the same raw batch and control-client++selection changes before a pass. Accepted IME mutations update the expected selection so the++IME deletion's own caret shift does not reject its paired commit. The existing terminal rules++still permit a fresh preedit after a rejected terminal commit, and a direct commit with no active++composition remains valid even after a pointer change in the same batch. Five new real-app++regressions cover15 scenarios with both deletion forms, pointer and keyboard interruption,++terminal-pending/external selection, undo preservation, fresh composition and direct commits.++These new source bytes and tests await parent-managed formatting, focused/full gates and fresh++independent review; no new test, native-IME or final dependency-graph acceptance is claimed here.++++Every future push or new pull request still needs a fresh, explicit human approval of the exact++commit range and its validation; this document is not publication evidence.++++Scope: `storytold/effectcraft` only (this checkout). Shared work in `storytold/craft-libs`++(PR 199 and the CL-2 capture helper), the suite egui fork and the suite winit fork are dependencies++with their own plans; this document records what EffectCraft needs from them, not what they should++do. Sibling apps, their plans and their dependency bumps are out of scope.++++This plan deliberately separates:++++- **facts** verified by reading the pinned source in this checkout, the egui checkout and the++ upstream 0.36.2/0.37.0 tags;++- **historical clues** (the 2026-10-22 audit compiler output), which are not current acceptance;++- **proposals** (refactors and acceptance criteria) that the implementation PRs must prove.++++## 1. Baseline and provenance++++### 1.1 Exact source under plan++++| Item | Value |++| --- | --- |++| EffectCraft implementation checkout | `/home/codex/work/CraftApps/egui037-migration-20261022/effectcraft-implementation` |++| Current EffectCraft worktree | HEAD `049070d65c66a73f322b496b22521816e0018f14`; dirty migration worktree. The lock and manifests still use the local integration patch, not final immutable pins. |++| EffectCraft historical planning baseline | `9581b53c3f8945683252af0eb5fac79e0e43aed4` (`Release 0.16.0`, 2026-10-22), retained for baseline comparisons only |++| Branch | `codex/egui-037-plan-20261022` |++| Workspace | single root workspace `Cargo.toml` (`resolver = "3"`, members `crates/*`, `apps/*`, `xtask`) |++| Lockfile | `Cargo.lock`, lock format 4 |++| MSRV / edition | Rust 1.95, edition 2024 (`Cargo.toml:7-12`) |++| Target upstream release | egui tag `0.37.0`, peeled commit `841a328ba2dd8f6996beb7189ebb7fc00e668a2a` (tagged 2026-10-15) |++| Candidate suite egui (comparison input only) | `aiongg/craft/0.37` = `a4f9a17f64a6bae61350fb85804c9df0d9865916` (2026-10-21, E1–E21). Read-only source for this plan; **not a publication pin**. |++| Candidate suite winit (comparison input only) | `aiongg/craft/0.30.13-lang` = `8b35388bd719e8cc86a95971ba0bc026c9a8f058` (winit 0.30.13 + W1–W15, W17–W27). Read-only source; **not a publication pin**. |++| Production egui pin | **pending approved fork implementation**: the final reviewed and published `storytold/egui` P8 SHA containing E1–E21, P2b async W15P routing, P7 held-key pairing, P7b/E21b, P7c's selected `#8763`/`#8748` fixes and the justified `#8731`/`#8736` performance fixes if measurements require them. All egui-family crates must come from that one revision. |++| Production winit pin | **pending approved fork implementation**: the completed, final reviewed `storytold/winit` SHA containing W1–W27, W15P and the W27 lifecycle fixes. |++| Final dependency unit | one immutable set recorded together: the complete storytold egui P8 SHA + storytold winit SHA + craft-ui SHA with CL-1 and CL-2F, proved by a clean `--locked` fetch. This is the consumer's first and only compatibility landing: no stock-0.37 or intermediate fork production stage. |++| Suite shared UI dependency | `craft-ui` from `storytold/craft-libs`, reconciled merged-PR base `3832c47ef68a0e6214f2c1e85f3526b6adcb686e` (current shared-library implementation base). Historical planning rev `5c874d51eeb3de70e735c8ce87a59a7dedd47675` is superseded; the final publication pin is the reviewed immutable SHA containing CL-1 and CL-2F. |++| Shared PR history | `storytold/craft-libs#199` is merged at `3832c47ef68a0e6214f2c1e85f3526b6adcb686e`. Historical port hunks `8614e4a04fae516fba16c22b31ff1008cb6be10b` and README `1764bca`, applied to old `main` `49190884278f16c9a9f5823d7698a8ffb5deb062`, are superseded. Never merge `b68de8c`/`ec8840a` as trees. |++| Separate language PR | `storytold/craft-libs#198` (fork E5/E9/E12–E21, winit W17–W27) |++++All pins must be full commit SHAs. Branch names are not publication pins. The `aiongg` SHAs above++are source-inspection inputs for this review; the lock file in a publication branch must name only++the final storytold revisions (plus the existing unrelated craft-libs PDF pin).++++### 1.2 Baseline dependency set (historical `9581b53c`; from `Cargo.lock` and manifests)++++The implementation worktree now resolves the egui family at `0.37.0` and `craft-ui` at++`3832c47ef68a0e6214f2c1e85f3526b6adcb686e` through `local-integration-config.toml`; the current++`Cargo.lock` entries therefore have no registry `source` for those patched crates. That local++configuration is review evidence, not an immutable publication pin.++++| Crate | Version / source | Where pinned |++| --- | --- | --- |++| `egui` | `0.36.2` crates.io, checksum `dc938cc2…` | `Cargo.toml:108` |++| `eframe` | `0.36.2` crates.io, checksum `55ad41fa…` | `Cargo.toml:109` (default features off) |++| `egui_kittest` | `0.36.2` | `Cargo.toml:110`, dev-only |++| `egui-wgpu` / `egui-winit` | `0.36.2` | transitive, one each |++| `kittest` | `0.4.0` | transitive of `egui_kittest` |++| `accesskit` / `accesskit_winit` | `0.24.1` / `0.32.2` | transitive |++| `winit` | `0.30.13` crates.io, checksum `a6755fa5…` | `apps/effectcraft/Cargo.toml:23` (`"0.30"`, default features off) and transitive |++| `wgpu` | `30.0.1` | `Cargo.toml:101` |++| `craft-ui` | baseline `0.1.0` git `storytold/craft-libs` rev `5c874d51…`; implementation resolves local `craft-libs-implementation` at `3832c47…` | `Cargo.toml:107` plus `local-integration-config.toml` |++| `craft-pdf` | git `storytold/craft-libs` rev `ca50d63b…` | `Cargo.toml:15` |++| `craft-docpath` | git `storytold/craft-libs` rev `82a24b00…` | `Cargo.toml:16` |++| `hayro-syntax` patch | git `storytold/craft-libs` rev `ca50d63b…`, `=0.7.2` | `Cargo.toml:213-214` |++| `wasm-bindgen` | `0.2.129` (exact crate and CLI), `apps/effectcraft-web/Cargo.toml:34` and `xtask/src/main.rs:254` | web only |++| filmcraft crates | git rev `2c5ba7a7…` | `Cargo.toml:76-95` |++++There is exactly one egui family in the baseline. The target must preserve that invariant (see §6).++++Manifest audit: 38 `Cargo.toml` files (root, 32 `crates/*`, 3 `apps/*`, `xtask`, and the standalone++plugin). Only `crates/ui-egui`, `apps/effectcraft`, `apps/effectcraft-web` and (through++`effectcraft-ui-egui`) `apps/effectcraft-cli` use the egui family. `examples/plugins/posterize-bands`++has its own workspace/lock and no egui. There are no vendored crates and no `[patch]` on the egui++family in the baseline; the only patch is `hayro-syntax`.++++### 1.3 Package, binary, feature and entry-point targets++++| Target | Kind | egui-family surface |++| --- | --- | --- |++| `effectcraft` (`apps/effectcraft`) | native binary | `eframe` with `default_fonts`, `wgpu`, `accesskit`, `links`, `wayland`, `x11` (`apps/effectcraft/Cargo.toml:18`); direct `winit`; native `Desktop` app (`apps/effectcraft/src/main.rs:426-456`) |++| `effectcraft-web` (`apps/effectcraft-web`) | `cdylib` + `rlib`, wasm32 | `eframe` web runner (`app.rs:88-122`, `start()` at `app.rs:185`); `eframe` features `default_fonts`, `wgpu` |++| `effectcraft-ui-egui` (`crates/ui-egui`) | library (swappable frontend) | the real UI, control channel, docking, viewer, timeline, kittest dev-dep `eframe` + `wgpu` (`crates/ui-egui/Cargo.toml:24-41`) |++| `effectcraft-cli` | binary + MCP server | depends on `effectcraft-ui-egui` for `bench --ops` (`apps/effectcraft-cli/Cargo.toml:19`) |++| `effectcraft-ui-egui --example snapshot` | example | headless kittest+wgpu screenshots (`crates/ui-egui/examples/snapshot.rs`) |++| `xtask` | tool | `ci`, `wasm`, `web`, `assets`, `layers` (`xtask/src/main.rs:409-428`) |++| `examples/plugins/posterize-bands` | separate nested workspace | no egui dependency; its own `Cargo.lock`; untouched |++++Platform cfgs that the migration must respect:++++- wasm32: `frames.rs` remote/local frame pump, `audio.rs` Web Audio, `theme.rs` no system fonts,++ `prefs_live.rs` no native drops, viewer deferred readbacks (`lib.rs:825-855`), `sys-locale` only++ off-wasm (`crates/ui-egui/Cargo.toml:36-37`), web storage/workers.++- native: pointer wrap (`pointer_wrap.rs:133`), system font fallbacks (`theme.rs:388-430`),++ `rfd`/`cpal`, native menu (macOS), `zbus` appearance (Linux), appimage (Linux).++- `eframe`/`winit` platform features: Wayland and X11 on Linux, `muda`/`objc2` on macOS,++ `winresource` on Windows.++++### 1.4 Current test and CI commands (source-declared)++++- `cargo xtask ci` = `cargo fmt --check`; `cargo clippy --workspace --all-targets --release -- -D warnings`;++ `cargo test --workspace --release`; PDF dependency check; `layers`; `assets`; `wasm`++ (`xtask/src/main.rs:409-418`).++- `cargo xtask wasm` checks every L0–L4 crate plus `effectcraft-ui-egui` and `effectcraft-web`++ for `wasm32-unknown-unknown` (`xtask/src/main.rs:235-252`).++- UI tests: 81 files in `crates/ui-egui/tests`, driven by `egui_kittest::Harness`++ (`build_eframe`, `run_steps`, synthetic `Event`s, automation-registry rects, AccessKit queries).++ `ui_gpu.rs` runs the viewer on egui-wgpu's device; `ui_agent_audit.rs` audits commands and++ automation coverage; `viewer_geometry.rs` has an opt-in visual matrix++ (`CRAFT_UI_VISUAL_DIR`).++- Web: `cargo xtask web --serve 8765`, then `node apps/effectcraft-web/tests/smoke.mjs`,++ `workers.mjs`, `page.mjs`, `storage.mjs` (`docs/web.md:412-445`).++- Performance: `effectcraft-cli bench --ops --json` (`apps/effectcraft-cli/src/main.rs:885-925`),++ `cargo xtask bench` (`xtask/src/bench.rs`), and the headless `ui_egui::bench::Driver`++ (`crates/ui-egui/src/bench.rs:13-108`).++++## 2. What actually changes in egui 0.37 that affects EffectCraft++++This section is limited to changes visible in the pinned sources. It corrects two assumptions that++must not enter the plan:++++- **`App::logic` / `App::ui` and `Context::run_ui` are not new in 0.37.** They already exist in++ 0.36.2 (`egui-0.36.2/crates/eframe/src/epi.rs:167,182`; `egui-0.36.2/crates/egui/src/context.rs:794`),++ and EffectCraft already uses them (`crates/ui-egui/src/lib.rs:1852-1935`, `apps/effectcraft/src/main.rs:426-456`,++ `apps/effectcraft-web/src/app.rs:88-122`). The migration is **not** a wholesale update-to-ui rewrite.++- **`Context::run_logic` is not a substitute for a pass.** It does not interpret time or events;++ `run_logic` only refreshes viewport state (`egui-0.37.0/crates/egui/src/context.rs:1190-1218`).++ Calling it cannot initialise fonts or consume input.++++### 2.1 Compile-visible API changes (the historical audit is a clue, not acceptance)++++The 2026-10-22 audit (`/home/codex/work/ssd2/task-evidence/egui037-audit-20261022/{fork,stock}/effectcraft.errors`)++compiled only `effectcraft-ui-egui` (lib and lib test), against a historical fork revision and++machine-local path patches. It reported the same 15 errors in fork and stock mode, with 602++(stock) / 603 (fork) warnings; the difference is warning counts only. Those errors are consistent with the upstream 0.37 sources read here:++++| # | Anchor in this checkout | Error | 0.37 API and required change |++| --- | --- | --- | --- |++| 1 | `crates/ui-egui/src/color_picker.rs:19` | `Role::ColorButton` absent | `WidgetType` is a deprecated alias of `accesskit::Role`; use `Role::ColorWell` (`egui-0.37.0/crates/egui/src/lib.rs:644-659`) |++| 2 | `color_picker.rs:336` | `Role::Other` absent | `Role::Unknown` |++| 3 | `control.rs:371` | `Event::MouseWheel` missing `source` | add `source: MouseWheelSource::Wheel` (`egui-0.37.0/crates/egui/src/data/input/event.rs:175-200`) |++| 4 | `lib.rs:1539` | no `egui::UserData` | screenshots are callback based (`ScreenshotCallback`) |++| 5 | `lib.rs:1569` | no `Event::Screenshot` | receive the image from the callback, not from input events |++| 6 | `menu_keys.rs:84` | `UiStack.id` absent | `UiStack.unique_id` / `UiStack.scope_id` (`ui_stack.rs:133-150`); use `scope_id` for a stable panel identity |++| 7 | `panels/effect_controls.rs:1274` | `Role::SelectableLabel` | `Role::Button` with `WidgetInfo::selected` |++| 8 | `panels/project.rs:613` | `Role::Other` | `Role::Unknown` (or `Role::TreeItem` directly) |++| 9 | `panels/project.rs:781` | `Role::Other` | `Role::Unknown` |++| 10 | `panels/text_panels.rs:700` | `Role::SelectableLabel` | `Role::Button` |++| 11 | `theme.rs:732` | `&dyn AsRef<[u8]>` comparison | `FontData.font` is now a `Blob = Arc<dyn AsRef<[u8]> + Send + Sync>`; compare `FontData::bytes()` |++| 12 | `theme.rs:752` | same | same |++| 13 | `widgets.rs:24` | `UiStack.id` | `scope_id` |++| 14 | `widgets.rs:493` | expected `IdSalt`, found `Id` | `Atom::custom(IdSalt, …)` (`atomics/atom.rs:98`) |++| 15 | `widgets.rs:498` | expected `IdSalt` | `WidgetAtomResponse::rect(IdSalt)` (`atomics/widget_atom.rs:224`) |++++Deprecations that `-D warnings` turns into failures (all 602 audit warnings are in this list):++++| Deprecated item | Count in this checkout | Replacement |++| --- | --- | --- |++| `egui::Id::new` | 616 lines (`591` src, `25` tests); 626 occurrences (`601` src, `25` tests) across 59 src and 12 test files | `Id::unique` (same hash; `id.rs:101-104` delegates to it) |++| `egui::WidgetType` | 19 | `egui::Role` (variant renames in §2.2) |++| `Ui::id()` | 2 (`color_picker.rs:335,337`) | `Ui::scope_id()` (`ui.rs:363-371`) |++| `egui::AtomLayoutResponse` | 1 (`widgets.rs:497`) | `WidgetAtomResponse` |++| `TextEdit::vertical_align` | 1 (`widgets.rs:329`) | `TextEdit::align(Align2::LEFT_CENTER)` (`builder.rs:408-427`) |++++Integration tests were not compiled by the audit and must be assumed to contain more breakage.++Two known classes are already visible by inspection:++++- 11 `Event::MouseWheel { … }` constructions lack `source` (`control.rs:371`, `ui_timeline_zoom.rs:33,81`,++ `ui_scrolling.rs:34,157`, `viewer_geometry.rs:98,235`, `ui_panels.rs:386`, `ui_tail.rs:195`,++ `ui_layer_panel_zoom.rs:109`, `ui_camera_tracker.rs:173`). The 12th match is a pattern in `lib.rs:581`.++- `ui_agent_audit.rs:73` reads `WidgetInfo.typ`; it becomes `.role`.++++There is **no** `PointerSource` in the target fork: `Event::PointerButton` keeps the 0.36 shape++(`aiongg/craft/0.37:crates/egui/src/data/input/event.rs:106-118`). The audit error at++`control.rs:371` was the wheel event, not the pointer button.++++### 2.2 Role mapping used by this migration++++`WidgetType` → `accesskit::Role` (egui's own mapping table, `egui/src/lib.rs:644-659`):++++| Old | New |++| --- | --- |++| `Button` | `Role::Button` |++| `ColorButton` | `Role::ColorWell` |++| `Slider` | `Role::Slider` |++| `SelectableLabel` | `Role::Button` + `selected` |++| `Checkbox` | `Role::CheckBox` |++| `TextEdit` | `Role::TextInput` / `MultilineTextInput` |++| `DragValue` | `Role::SpinButton` |++| `CollapsingHeader` | `Role::DisclosureTriangle` |++| `Panel` | `Role::Pane` |++| `ResizeHandle` | `Role::Splitter` |++| `Other` | `Role::Unknown` |++++### 2.3 Behaviour changes that compilation will not catch++++These are the app-specific risks, each with a source anchor and a planned assertion.++++1. **`default_fonts` is no longer a default feature of `egui`/`epaint`.** eframe still enables it by++ default, but EffectCraft disables eframe defaults and re-enables only++ `default_fonts`, `wgpu`, `accesskit`, `links`, `wayland`, `x11`++ (`crates/ui-egui/Cargo.toml:25`, `apps/effectcraft/Cargo.toml:18`). The app relies on++ `FontDefinitions::default()` at `theme.rs:334`; the feature must stay explicitly enabled on the++ `egui` dependency, not only through eframe, so `cargo check -p effectcraft-ui-egui` and test++ builds are deterministic. (`#8583`; `egui-0.37.0/crates/egui/Cargo.toml:40-46`.)++2. **The bundled emoji fonts are no longer in `FontDefinitions::default()`.** In 0.36.2 the default++ definitions include `NotoEmoji-Regular` and `emoji-icon-font` unconditionally++ (`egui-0.36.2/crates/epaint/src/text/fonts.rs:490-580`). In 0.37 they are behind++ `monochrome_emoji_fonts`, and the default only adds the small `egui-icons` font++ (`egui-0.37.0/crates/epaint/src/text/font_definitions.rs:105-180`). EffectCraft's own chrome is++ affected. A read-only cmap audit of the fonts actually bundled by this app and by egui found:++ - `✔` U+2714 (menu check gutter, `menus.rs:2176`) is in **only** NotoEmoji and emoji-icon-font;++ - `▣` U+25A3 (Media Browser folder, `media_panels.rs:198`; Essential Graphics media row,++ `essential.rs:247`) is in Hack and emoji-icon-font, but Hack is not in the app's++ Proportional family (`theme.rs:339-347` only prepends Inter and appends JetBrains Mono), so++ only the emoji font covers it;++ - `✓` U+2713 (checked label text, `widgets.rs:485`) is in Inter/JetBrains Mono and unaffected.++ Without `monochrome_emoji_fonts` these two become tofu, and kittest's default++ `MissingGlyphPolicy::Panic` turns that into test failures.++3. **Clipboard support became an eframe feature.** 0.36.2's eframe always enabled++ `egui-winit/clipboard` (`egui-0.36.2/crates/eframe/Cargo.toml:152`). 0.37 gates it behind++ `clipboard` (`egui-0.37.0/crates/eframe/Cargo.toml:142-144`), which is in eframe's default set++ but not enabled by EffectCraft's `default-features = false` manifests. Without it, cut/copy/paste++ to the OS clipboard silently degrade to an in-app simulated clipboard++ (`egui-winit-0.37.0/Cargo.toml:44-46`), breaking Edit ▸ Copy/Paste, text-field paste and++ `menus.rs:1867-1906` which maps clipboard events back to command keys.++4. **Screenshots are callback based** (`#8489`; `data/screenshot_callback.rs`,++ `ViewportCommand::Screenshot(ScreenshotCallback)`, `Context::request_screenshot`). The current++ correlation by `UserData` token through `Event::Screenshot` is impossible++ (`lib.rs:1530-1580`, `control.rs:439-444`). See §5.7.++5. **`WidgetType` and ID APIs are deprecated**, and the CI clippy gate is `-D warnings`++ (`xtask/src/main.rs:412`). This is 626 mechanical `Id::new` occurrences (616 lines) plus the 19++ source role edits and one more in `ui_agent_audit.rs` (see §5.2/§5.3).++6. **AccessKit roles/names are enforced by kittest 0.37.** `HarnessBuilder` defaults++ `check_accessibility: true` and `Harness::run` panics on visible input widgets without a name++ (`egui_kittest-0.37.0/src/builder.rs:50-51`, `src/accessibility.rs:9-45`). `is_input` covers++ `Button`, `CheckBox`, `ColorWell`, `ComboBox`, `Slider`, `SpinButton`, `Splitter`, `Tab`,++ `TextInput`, `TreeItem`, … (`egui-0.37.0/crates/egui/src/accessibility.rs:9-60`). Many of the++ app's stock `TextEdit`, `DragValue` and `Slider` fields are currently unnamed (39++ `TextEdit::singleline/multiline` constructors out of 44 `TextEdit::` references, and 51++ `DragValue`/`Slider` constructors), and custom `ui.interact` widgets have no `WidgetInfo` at all.++7. **Missing glyphs panic in kittest 0.37** (`#8601`; `MissingGlyphPolicy::Panic` is the harness++ default, `builder.rs:50`). Tests that deliberately render uninstalled scripts must opt out with++ `HarnessBuilder::allow_missing_glyphs()`; two are already known:++ `tests/ui_effect_names.rs:35` (the builder inside `harness()` at line 20, used by the++ `zh-hans` tests at 68, 81, 107 and 127, including `高斯模糊`) and++ `tests/ui_presets_folder.rs:40` (`ja`). Fontconfig on this planning host lists no faces at all, so++ those tests would panic rather than draw tofu until a CJK face is installed or the opt-out is used.++8. **`Ui::id` → `Ui::scope_id`, `UiBuilder::id` → `scope_id`, `Panel` constructors take++ `impl AsIdSalt`.** EffectCraft does not use `SidePanel`/`TopBottomPanel`, and uses++ `CentralPanel::default()` only (`dock_ui.rs:475`, `prefs_live.rs:207`), so no panel-order++ rewrite is needed. The root `Ui` is already the app surface (`lib.rs:1905-1935`,++ `lib.rs:1614-1723`). Never call `Context::root_ui` from a panel or a test closure: it panics++ while the root Ui is borrowed (`context.rs:1005-1055`).++9. **Style defaults changed** (roomier buttons, larger corner radii; `#8617`, `#8445`).++ EffectCraft pins `item_spacing`, `button_padding`, `interact_size.y`, `menu_margin`, scroll style++ and all widget corner radii from tokens (`theme.rs:510-530`, `theme.rs:474-495`), so the visible++ impact should be small, but atom-based `Button`/`ComboBox` layout can still move geometry. This++ is a geometry/pixel test target, not an assumption.++10. **Menus/popups and text editing changed** (`#7802`, `#7624`, `#8572`, `#8548`, `#8763`,++ `#8628`). EffectCraft builds its own menu bar and keyboard navigation++ (`menus.rs:2025-2050`, `menu_keys.rs`), with `MenuConfig` style overrides. Regression tests must++ cover hover-switch, arrows, submenu opening, outside-click close, and a button acting on a++ focused `TextEdit`'s selection (the `#8763` case). Container tooltips now also show when their++ children are hovered (`#7909`); check tooltip presence/absence on the app's large custom++ `interact` rects (viewer, timeline, dock) instead of assuming the 0.36 behaviour.++11. **Kinetic scrolling/rubber-banding** (`#8662`, `#8663`) and the new `MouseWheelSource` change++ wheel semantics. Synthetic wheel events must say `Wheel` (not `Unknown`) so tests and the++ control channel keep deterministic scroll behaviour.++12. **`Frame::default_fonts` + AccessKit bump**: accesskit 0.24.1 → 0.25.1, accesskit_winit++ 0.32.2 → 0.34.1, kittest 0.4.0 → 0.5.0. The kittest trees are **not** identical: `lib.rs`++ re-exports `accesskit_consumer::NodeRef` as `AccessKitNode` where 0.4 re-exported `Node`, and++ `query.rs`/`filter.rs` also differ. The 26 query call sites must be compiled against 0.5, not++ assumed unchanged.++13. **New 0.37 lifecycle tools** that this plan uses:++ - `ViewportCommand::RequestPaintWhileHidden` and `ViewportInfo::visible()`++ (`viewport.rs:1202-1240`, `viewport_info.rs:90-101`); visibility remains derived from++ minimized/occluded even during a forced hidden UI paint;++ - `Context::request_screenshot` / `ScreenshotCallback` (`context.rs:4595-4606`). The call sends++ a `ViewportCommand`, which requests a repaint of that viewport; a pending screenshot also++ makes a hidden window take a full UI+paint pass (`wgpu_integration.rs:686-690`,++ `egui-winit/src/lib.rs:2116-2128`). It does **not** schedule a repaint when the callback++ completes; the completion slot owns that wake-up (§5.7);++ - `Context::set_repaint_observer` and `RepaintCause` (`context.rs:2290-2296`, `283-300`).++14. **Known upstream regressions at 0.37.0** (reported upstream; not measured by this task):++ - `#8731`: plain-text tessellation ≈61% more instructions (`tessellate_text` per-vertex colour++ check). The candidate comparison revision is unpatched: `aiongg/craft/0.37:crates/epaint/src/tessellator.rs:2295-2341`++ still has the conditional inside the vertex loop.++ - `#8736`: egui-wgpu pipeline creation is ~40 ms slower on Windows/DX12 (FXC) because of++ `wrap_texel_coord`.++ Both are measured acceptance gates in §9 and, if over threshold, must be fixed in the final++ P8 egui revision before P1 is frozen. P5 reports/retests; it does not change the pin.++++## 3. Fork, winit and craft-libs integration decisions++++### 3.1 What EffectCraft actually needs from the suite fork++++EffectCraft has no `vendor/` directory and no local egui patch. Its only `[patch.crates-io]` entry is++`hayro-syntax`, inherited from the craft-libs PDF stack (`Cargo.toml:213-214`); it is unrelated to++egui and must stay.++++The production dependency is the complete reviewed and published storytold egui **P8** revision,++not the personal `aiongg` branches used as comparison input here. P8 carries E1–E21, P2b async++W15P routing, P7 held-key pairing, P7b/E21b outgoing IME surrounding text (§5.5), P7c's selected++`#8763`/`#8748` fixes and the justified `#8731`/`#8736` performance fixes. The completed final++winit SHA carries W1–W27, W15P and the W27 lifecycle fixes. The two forks and `craft-ui` CL-1 +++CL-2F are approved as one immutable unit at P1; P4 adds extended native/language coverage without++a second compatibility graph (§10). There is no stock or intermediate-fork production stage;++stock 0.37.0 is a measurement control only.++++| Fork patch | EffectCraft use | Decision |++| --- | --- | --- |++| E1 `viewport_hooks` | not used (craft-tablet only) | keep in fork; no app change |++| E2+E3 surface fit / wgpu error scopes | protects windows whose surface exceeds the adapter limit and reports configure/renderer failures; relevant to the app's "never crash" rule and its device-loss handling | **keep, benefit**; verify with a required-adapter `ui_gpu.rs` run and a device-loss test |++| E4 Wayland clipboard/PRIMARY | the app edits text in project rows, timeline fields, expression fields, Script UI and settings; Hyprland serves one data device per client | **keep**; requires winit W15 plus the new **W15P** PRIMARY path (§5.5/§8.7) |++| E5/E12/E13/E16 bidi and grapheme editing | UI labels and stock `TextEdit`s only; **text layers use `effectcraft-text`, not epaint** | **keep**; do not claim it fixes text layers |++| E6 IME focus | stock `TextEdit`s | keep |++| E7/E19 letter keys on non-Latin layouts | shortcuts (`menus::parse_shortcut`, `handle_shortcuts`); requires winit W25 | **keep**; manual platform test |++| E8 `TextEdit` glyph clipping | stock fields (Thai/Vietnamese/Arabic marks) | keep |++| E9 `Style::right_to_left` | app never sets it; its dock/layout is custom LTR | keep in fork; **do not enable** in EffectCraft (would mirror stock widgets inside an unmirrored custom layout) |++| E10 web named keys / Latin codes | web keyboard behaviour | keep; no app change |++| E11 vello_cpu multithreading | not used | keep in fork |++| E14 `FontTweak::fallback_align` | the app installs system fallback faces (`theme.rs:388-430`) | keep; **optional follow-up** to set it for CJK/Indic fallbacks, with screenshot proof |++| E15 `LineBreaker` | text layers use `effectcraft-text`; not adopted | keep in fork |++| E17/E18 `Context::set_language` / `Frame::set_ui_language` | screen-reader language and UI shaping language (the app has an interface language setting, `i18n::language`) | **adopt in the language stage** (fork-only; see §5.9) |++| E20 widget text language | goes with E17 | adopt with E17 |++| E21 `ImeEvent::DeleteSurroundingBytes` | the app has a **custom** viewer text editor that consumes IME events itself (`viewer_text.rs:397-508`) | **adopt in the IME stage**; stock 0.37 only has char-based `DeleteSurrounding` |++| **P2b** (new prerequisite) | async W15P PRIMARY routing in egui-winit: bounded read workers, owner-specific completion waker, no blocking UI path | **in P8**; gate in §5.5/§8.7 |++| **P7** (new prerequisite) | held-key pairing: the emitted egui key identity is stored by physical key and reused on release; clipboard shortcuts alone do not prove this | **in P8**; gate in §3.2/§5.5 |++| **P7b/E21b** (new prerequisite) | candidate egui-winit never calls winit W27's `set_ime_surrounding_text`; `IMEOutput` carries no logical text. The custom viewer editor is a required producer. | **in P8 before final acceptance**; see §5.5, §8.4 and `ime-surrounding-gap.md` |++| **P7c** (new prerequisite) | selected upstream fixes `#8763` (a button/menu command acting on a focused `TextEdit` selection) and `#8748` (hidden parent not updating deferred child viewports) | **in P8**; tested in §5.6/§5.8. Local workarounds are not the final unit. |++++Removal conditions are the fork's own (`PATCHES.md`): each patch goes when an egui/winit release in++use contains it. EffectCraft must not add a second copy of any of these fixes locally.++++### 3.2 Winit patches that matter here++++| Patch | Why EffectCraft needs it | Gate |++| --- | --- | --- |++| W1 mixed-DPI rect | window placement and monitor hit tests (`apps/effectcraft/src/window.rs`) | Windows mixed-DPI manual test |++| W2/W5/W20/W21 X11 IME | the app's editable fields and expression editor | X11 IME under Xvfb+WM (qualified parts only; §8.7) |++| W3/W18/W19/W22/W24/W26/W27 IME | the custom text editor and stock fields; W26/W27 are required by E21 and by E21b/P7b | macOS press-and-hold/dictation, Wayland text-input-v3, Windows IME |++| **W15P** (new) | winit-owned Wayland PRIMARY on the existing connection/event queue, per-seat manager/device/source/offer from SCTK 0.19.2; no second regular data device | wlroots/Hyprland, KWin and Mutter capability matrix (§8.7) |++| W13 Wayland wheel phase | zoom/scrub shortcuts must not latch | Wayland manual test |++| W15 Wayland clipboard/files | needed by E4 | Hyprland clipboard check |++| W23 macOS Command keys | menu shortcuts | macOS layout test |++| W25 Latin layout | E19 shortcuts; preserve the emitted key identity by physical key across release | Russian/Arabic/Hebrew layout test plus a held Ctrl+Z/Cmd+K release after a layout/modifier change |++++W27 also needs the lifecycle fixes recorded in `winit-review-triage.md`: clear the pending++preedit/commit/deletion batch on leave with an explicit epoch, test late `Done`, disable/reset, seat++removal and two windows, and preserve deletion-FIFO/commit pairing. Focus epochs and protocol++serials are distinct: a current-epoch `Done` with a mismatched serial still applies its incoming++edits exactly once and only defers outgoing surrounding state until a matching serial; a stale++(different owner/focus generation) batch is invalidated and discarded. `W25`/`W23`/`E19` must++preserve the emitted egui key identity by physical key across release (including layout/modifier++changes), clearing it on focus loss, IME interception and destruction, and test a non-clipboard++held key (Ctrl+Z/Cmd+K), repeat semantics and two physical keys mapping to one logical key.++W15 needs bounded, cancelable transfers with a 2 s total monotonic deadline and a 16 MiB total++byte budget; the egui adapter must not block the UI and must cancel stale pastes after++focus/target/generation changes.++++### 3.3 craft-libs PR 199, CL-2 and language PR 198++++- PR 199 is **merged** at `3832c47ef68a0e6214f2c1e85f3526b6adcb686e`, the current reconciled++ shared-library implementation base. Do not merge its historical head `b68de8c5` (a stale tree++ relative to current `main`, missing `craft-platform` and reverting security/settings/docking/++ printer fixes) or audit merge `ec8840a` (stale lock, egui 0.36.2) as trees. The historical API++ port `8614e4a` and README `1764bca` on old `main` `4919088` are superseded by the merged base.++- EffectCraft pins `craft-ui` to the **reviewed CL-1 merge/rebase SHA on craft-libs `main` after the++ port**, not to the PR head. That revision must keep its egui dependency on registry `0.37` so++ EffectCraft's `[patch.crates-io]` (not a git URL patch) can redirect it.++- **CL-2 capture completion helper.** The shared plan's selected design is a bounded, cancelable++ per-request completion slot with a weak callback reference, aggregate image-byte and request++ limits, and an explicit viewport wake-up after the slot lock is released. EffectCraft is one of++ the eleven existing craft-ui consumers, so it pins **CL-1 + CL-2F in the same atomic dependency++ stage** as P1; only the DesignCraft/GridCraft pilots use the reviewed provisional CL-2 revision,++ and their adapters are reviewed before CL-2F freezes the API. Any consumer with an incompatible++ existing craft-ui bump must reconcile it in that same stage. EffectCraft does not pin the++ provisional revision. **No app-local result channel** and no generic UI compatibility layer.++ EffectCraft keeps its own request ids, paths, crop, deadlines and reply JSON.++- `craft-ui`'s production API used here (`docking::{Action, Zone, Placement, resolve_drop, zone_rect, drop_zone}`,++ `layout::{split_rect, SplitAxis, SplitSize, ResizeHandle, ResizeHandleStyle}`) is unchanged by++ the port; the additive `printing::tick` is not used by EffectCraft.++- PR 198 / the fork language work is adopted only where §3.1 says so. The app keeps its own++ catalogs (`i18n.rs`, `i18n/ui.rs`, `i18n/effects.rs`) and its own text engine; it does not adopt++ craft-text line breaking or a shared translation layer.++- Blocking: CL-1 and CL-2F must land before the EffectCraft dependency-pin PR can be reviewed++ honestly. Until then, implementation may use a local pinned SHA only for development, never in a++ publication branch, and never a machine-local path patch.++++## 4. Root-`Ui`, lifecycle and multi-pass semantics++++### 4.1 Current split (already on 0.36.2, must be preserved and completed)++++Today `EffectcraftApp::logic` does GPU-failure application, language/theme/font install, FPS, control++drain, screenshot scheduling/collection (`lib.rs:1870-1903`), while `ui` calls `frame()` which does++**polls, playback, events, autosave, prefs, window title, close guard and the whole paint**++(`lib.rs:1905-1935`, `lib.rs:1614-1723`).++++Verified integration facts (candidate source, same call sites as upstream 0.37):++++- `eframe` runs `logic` and `ui` inside one `Context::run_ui` closure for every full pass++ (`eframe-0.37.0/src/native/epi_integration.rs:349-364`; web `app_runner.rs:289-292`). A full pass++ can run more than once per frame when `Context::request_discard` is used.++- While the root window is minimized/occluded, native eframe runs `Context::run_logic` with++ `App::logic` only (`epi_integration.rs:384-425`), unless a `Screenshot` or++ `RequestPaintWhileHidden` action is pending, in which case it runs a **full** UI pass with current++ input and paint (`wgpu_integration.rs:680-740`).++- `prepare_raw_input` calls `raw_input_hook` **before both** paths++ (`epi_integration.rs:414-428`). `update_logic_only` then stores the hook-mutated raw input in++ `pending_raw_input` for the next full pass (`epi_integration.rs:400`). Therefore synthetic++ events fed during a logic-only call are retained, not lost, and are applied exactly once by the++ next full pass.++- Native eframe throttles repaints of an invisible/minimized window to at least 100 ms++ (`eframe-0.37.0/src/native/run.rs:27,376-383`), so a hidden gesture or capture takes a few++ throttled full passes; the app's deadlines must allow for that and must not infer failure from the++ first 100 ms.++- `ViewportInfo::visible()` derives from `minimized`/`occluded`, not from a paint request. It stays++ `Some(false)` during a forced hidden UI pass, so visibility cannot distinguish "logic only" from++ "forced hidden paint".++- `run_logic` refreshes only `raw.viewports` and `raw.focused` (`egui-0.37.0/crates/egui/src/context.rs:1190-1218`);++ it leaves `InputState::time`, events and pointer state at the previous pass's values. eframe sets++ `RawInput::time` in `prepare_raw_input`, but `run_logic` does not copy it into `InputState`.++- `Context::request_screenshot` sends a viewport command, which requests a repaint, and a pending++ screenshot is a "wants paint" action even when hidden. The callback itself does not request a++ repaint when the pixels arrive.++++Consequences, all pre-existing in 0.36.2:++++- With the window minimized/occluded, job polling, playback advance, audio pumping, auto-save++ ticks, engine-event draining, the unsaved-close guard and the window-title update **do not run**++ on ordinary logic-only ticks.++- A discarded pass re-runs the `run_ui` closure, so `logic` runs again for the same frame.++ `Grid` requests a discard on first show (`egui-0.37.0/crates/egui/src/grid.rs:468`); EffectCraft++ has 18 `Grid::new` sites across dialogs/settings/forms.++- The control channel's `AfterInput` replies are completed in `logic` as soon as `synthetic` is++ empty, which is before the pass applies the last synthetic event (`lib.rs:1893-1901`,++ `lib.rs:1921-1930`). While hidden, an event can also have been fed into retained raw input with++ no pass yet applied.++++### 4.2 Target boundaries++++Introduce one explicit app tick and one draw pass; do not add a generic `Context` bridge:++++```rust++// EffectcraftApp++now: f64, // monotonic app clock value for this tick, used for deadlines++focused: bool, // last known focus, refreshed from viewport info++last_input_at: f64,++last_draw_geom: Option<(egui::Rect, f32)>, // last non-discarded root draw: screen rect + ppp++geometry_epoch: u64, // bumped whenever that screen rect or ppp changes++want_paint: bool,++clock: AppClock, // real or injected (§4.3)++++/// The only non-paint entry. Effects are idempotent; time may advance slightly per call.++pub fn tick(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame);++++/// Paint only. Receives the root Ui from eframe.++pub fn draw(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame);++++// eframe::App++fn raw_input_hook(&mut self, ctx, raw) { /* feed synthetic, pointer wrap; no clock, no replies */ }++fn logic(&mut self, ctx, frame) { self.tick(ctx, frame) }++fn ui(&mut self, ui, frame) { self.draw(ui, frame) }++```++++`tick` must contain, in this order:++++1. `init_gpu(frame)` (moved from `ui`, `lib.rs:761-806`), so the compositor exists before the first++ paint and while hidden; `apply_gpu_failure` + `close_after_device_loss` (moved from `ui`,++ `lib.rs:1905-1910`).++2. `i18n::set_current(language)`, theme/font install and `apply_prefs` (moved from `frame`).++3. Engine/background polling: `poll_render`, `poll_track`, `poll_mask_track`, `poll_jobs`,++ `poll_offload`, `poll_warp`, `poll_roto`, `poll_camera` (`lib.rs:1617-1655`), plus++ `frames.set_context(ctx)` so worker completions can request repaints while hidden. These are++ queue-draining and a second call in a discarded pass is a no-op (e.g. `render_queue.rs:579-583`++ takes the update queue).++4. `run_script_tasks`, `handle_events` (engine queue drained once), `command_inbox`; toast/status++ timestamps use `now`, not `ctx.input(|i| i.time)`.++5. `run_dialog_answers` and the native-menu answers.++6. `tick_autosave` (already wall-clock based, `lib.rs:1790-1816`) with the app clock, watch folder,++ `tick_footage_reload` using `self.focused`/`self.now`/`self.last_input_at` instead of `ctx.input`.++7. Control: `drain_control` with `now`, `finish_job_waiters` with a bounded repaint.++8. Screenshots: `collect_screenshots` (drain completion slots and validate each image against the++ geometry + epoch recorded at issuance, §5.7), then `issue_screenshots` (`now`), then timeouts++ and cancellations.++9. Playback: `advance_playback(ctx, scale, now)` using the last drawn viewer scale;++ audio pump; `cache_when_idle`.++10. Unsaved close guard (`panels/unsaved.rs:50-62`) and window-title update.++11. `prefs_live::memory_watch` / `home_on_open` (split out of `prefs_live::frame`,++ `prefs_live.rs:15-19`); `video_preview` stays in draw.++12. If `want_paint`, or synthetic input/`input_waiters` remain, or a control step needs a UI pass,++ send `ViewportCommand::RequestPaintWhileHidden` and clear `want_paint`. This also covers++ playback with an open Video Preview or floating panel window (§5.8).++++`tick` never reads input events, pointer state or modifiers for decisions. `draw` keeps only paint++and direct manipulation: dock layout, panels, menus, dialogs, areas, `ui.inspect` registry, pointer++hover, shortcuts that read events, `finish_native`, `video_preview`, dropped-file overlay/import,++Home thumbnail capture, toast, workspace-state save on pointer-up, and `frames.pump` on wasm (or++move `pump` to `tick`; either is acceptable if tested, but it must not be the only progress path).++`draw` updates `last_input_at` from the pass's input activity and records++`last_draw_geom = Some((ui.ctx().screen_rect(), ui.ctx().pixels_per_point()))` at the end of every++pass that is not discarded (`!ui.ctx().will_discard()`), bumping `geometry_epoch` when the rect or++ppp differs from the previous value. Screenshot issuance copies this geometry + epoch; completion++rejects/retries if the epoch changed before the save (§5.7). The callback itself supplies only++pixels, so the issued record — not callback timing — is the geometry anchor.++++**No `Context::root_ui` anywhere.** Areas/Windows/Modals keep taking `ctx` (they create their own++layers); panels receive the existing `&mut Ui`. `show_viewport_immediate` stays as is.++++### 4.3 App clock, focus and input gating++++- **The clock is app-owned and injected.** Neither `ctx.input(|i| i.raw.time)` nor++ `ctx.input(|i| i.time)` is valid in a logic-only tick: `run_logic` copies only viewports/focused++ (`context.rs:1190-1218`), so `i.raw.time` is the previous full pass's raw value and `i.time` is++ the previous pass's `InputState::time`; kittest leaves `RawInput::time` `None`.++ ```rust++ pub struct AppClock {++ source: ClockSource, // Real(web_time::Instant) | Manual(f64)++ }++ impl AppClock { fn now(&self) -> f64 { /* monotonic seconds */ } }++ let now = self.clock.now();++ ```++ `tick` stores `self.now = now` before using it. Tests inject `AppClock::manual()` and advance it;++ a regression must show that a stale `ctx.input(|i| i.time)` cannot satisfy a deadline. Native and++ web use the same `web_time::Instant` source; `EffectcraftApp::now()` exposes the last value so++ `WebApp::logic` can pass it to `persist::snapshot` (§8.6).++- Focus comes from the fresh viewport copy with a visible-pass fallback:++ ```rust++ let focused = ctx.input(|i| i.viewport().focused)++ .or_else(|| ctx.input(|i| i.focused));++ self.focused = focused.unwrap_or(self.focused);++ ```++ Do not read `i.events`/pointer in `tick`; input handling belongs to `draw` (the known UI phase).++- **Synthetic input is not gated on visibility, but is gated on an unapplied event.**++ `raw_input_hook` runs once per eframe prepare (frame or logic call), not per egui UI pass, and++ calls `self.feed_synthetic(raw_input)` then `pointer_wrap::prepare_input(...)`. In a logic-only++ call eframe retains the mutated raw input++ (`pending_raw_input`) and calls the hook again on the next call; in a forced hidden full pass it++ is applied immediately. Gating on `visible() == Some(false)` would skip feeding in both cases++ and leave the gesture (and its reply) pending forever.++ `feed_synthetic` drains **one pointer event per call** (`lib.rs:578-591`), so repeated++ logic-only updates before the forced full pass (eframe's overdue-`RedrawRequested` path and its++ 100 ms invisible-window throttle) would append press, move and release to the same retained++ input and collapse a gesture into one pass. The hook must therefore set a guard when it moves a++ synthetic event into raw input and skip feeding while that guard is set; the guard is cleared++ when a known UI pass has applied that step once, even if layout is later discarded;++ record that application separately from screenshot settling/accepted-frame counters.++ RawInput events are consumed on the first pass and are not replayed in later passes.++ Never clear the guard in `tick`; never wait for the event to reappear in an accepted pass.++ The next step is fed only on a subsequent host input preparation. No event is discarded. §8.3 tests repeated logic-only ticks with a drag and a click.++- `raw_input_hook` performs no reply, no clock read and no side effect other than pointer-wrap state,++ the synthetic-pending guard and merge-key closing. `pointer_wrap::prepare_input` returning "gesture ended" clears++ `session.history.merge_key`; doing that during a logic-only call is safe because the events are++ retained and the same reset is idempotent.++- Replies for `AfterInput` are completed **only at the end of a non-discarded `draw` pass**++ (after the pass, check `!ui.ctx().will_discard()`) that ran after the last synthetic event was++ fed, and never in `tick`. A hidden request therefore replies only after the forced pass applied++ it, and a pass that egui throws away cannot produce an early success reply.++- If a control request needs a UI pass (synthetic input, a panel-window change, or a caller that++ explicitly wants fresh `ui.inspect`/`ui.elements` data), `tick` sends `RequestPaintWhileHidden`.++- `control::handle` is called from `tick` with `now` passed in (a signature change, not a wrapper):++ replace its `ctx.input(|i| i.time)` at `control.rs:428` with `now`, and `inspect`'s++ `windowFocused` at `control.rs:562` with `ctx.input(|i| i.viewport().focused)`. `ui.inspect` and++ `ui.elements` keep last-painted semantics.++++### 4.4 Multi-pass and idempotence++++A discarded pass re-runs `tick` and `draw` with the same raw input (events are taken by the first++pass). Rules:++++- `tick` effects are idempotent for a replayed pass: polls drain queues; auto-save checks a++ timestamp; `advance_playback` computes the target frame from the plan and the monotonic `now`++ rather than incrementing, so a replay with a slightly later `now` does not double-count++ `Playback::frame_shown` (`lib.rs:230-246`); screenshot scheduling advances only when `now`++ passes a settle deadline, never once per pass (the old frame counter must not be replayed);++ job-waiter completion is keyed by the pending job, not by pass count.++- One-shot side effects in `draw` must rely on egui's per-pass input (`Response::clicked`,++ `drag_stopped`) and command merge keys, not on layout-pass counts. High-risk paths are viewer++ drags (`viewer.rs:1674-1874`), timeline drags (`timeline.rs:1500-1700`), painting strokes++ (`layer_panel.rs:350-360`) and form toggles inside `Grid`s.++- Add a forced-discard regression test (§8.3) that proves one undo step and one command effect++ across a real two-pass frame.++++## 5. Concrete refactors with anchors++++### 5.1 Manifests, features, pins and lock checks++++Root `Cargo.toml` (final publication form; placeholders are filled only after the reviewed forks++exist). P1 waits for the complete reviewed/published storytold egui P8 (E1–E21, P2b, P7, P7b/E21b,++P7c and any justified perf fix), the completed winit (W1–W27, W15P, W27 lifecycle) and craft-ui++CL-1 + CL-2F. It includes the custom-editor IME payload adapter atomically. Stock 0.37.0 and++aiongg candidates remain comparison controls, never intermediate production stages.++++```toml++craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "<reviewed main SHA including CL-1 and CL-2F>", features = ["serde"] }++egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] }++eframe = { version = "0.37", default-features = false }++egui_kittest = { version = "0.37" }++++[patch.crates-io]++winit = { git = "https://github.com/storytold/winit", rev = "<final reviewed winit SHA incl W15P>" }++egui = { git = "https://github.com/storytold/egui", rev = "<final reviewed egui P8 SHA incl E21b + P7c>" }++eframe = { git = "https://github.com/storytold/egui", rev = "<same egui SHA>" }++egui-winit = { git = "https://github.com/storytold/egui", rev = "<same egui SHA>" }++egui-wgpu = { git = "https://github.com/storytold/egui", rev = "<same egui SHA>" }++egui_kittest = { git = "https://github.com/storytold/egui", rev = "<same egui SHA>" }++hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "ca50d63b773c99f96e75c77ce5a1d21e7c9cda0d", version = "=0.7.2" } # keep++```++++`epaint`, `epaint_default_fonts`, `ecolor` and `emath` are path dependencies of the git egui crates++and must resolve from that same git revision. `aiongg/*` SHAs are comparison inputs only and must++not appear in a publication lock.++++Notes:++++- `craft-ui` is a git dependency from `craft-libs`; redirecting it with++ `[patch."https://github.com/storytold/craft-libs"]` is only acceptable for development, never in a++ publication branch. The publication form is the real `rev`.++- Do not patch `egui_plot`, `egui_dock`, `egui_extras` (unused) or `egui_system_font_provider`++ (unused while `system_fonts` is off).++- The fork's own `[patch.crates-io] winit = { branch = … }` belongs to the fork workspace and does++ **not** propagate; the consumer patch above is mandatory.++- Feature additions in the app manifests:++ - `crates/ui-egui/Cargo.toml:25`: `eframe` features += `clipboard`.++ - `apps/effectcraft/Cargo.toml:18`: `eframe` features += `clipboard`.++ - `apps/effectcraft-web/Cargo.toml:30`: keep `default_fonts`, `wgpu` (web has no OS clipboard++ feature; browser clipboard events are separate).++ - `egui_kittest` dev features: `eframe`, `wgpu`, plus `snapshot` only if §8.4's pixel goldens are++ adopted. `egui_kittest` depends on `egui` with `default-features = false`; only kittest's own++ `[dev-dependencies]` enable `default_fonts`/`monochrome_emoji_fonts`, and a dependency's++ dev-dependencies do **not** propagate. The workspace `egui` features above are therefore what++ EffectCraft's library and integration-test builds receive; do not rely on kittest to enable++ fonts. If a test root resolves `egui` independently, it must enable the font features itself++ or install controlled fonts, and the actual graph is checked per production/test root.++ - `monochrome_emoji_fonts` is enabled at the workspace `egui` dependency so `✔`/`▣` survive++ (§2.3.2). It propagates into `effectcraft-web`; record the raw and compressed WASM size change++ and either accept it with a budget or introduce a native-only `ui-egui` emoji-fonts feature++ after measuring (§9).++ - `system_fonts` stays **off** initially: the app already installs language-driven system++ fallbacks (`theme.rs:388-430`) and scans fonts for its menus; enabling eframe's fontique++ provider would add startup cost (`#8512`) and make rendering machine-dependent. Revisit as a++ separate product change for colour emoji.++- `winit` direct dependency in `apps/effectcraft/Cargo.toml:23` must match the patched fork (it++ does: `0.30`).++- Lock/duplicate checks after every pin change:++ ```sh++ cargo tree -d++ cargo tree -i [email protected]++ cargo tree -i [email protected]++ cargo tree -e features --target x86_64-unknown-linux-gnu++ cargo tree -i wasm-bindgen --target wasm32-unknown-unknown++ cargo check --locked++ cargo test --locked++ cargo metadata --locked --format-version 1 --no-deps++ ```++ Acceptance: exactly one egui-family source (the final storytold revision) covering `egui`,++ `eframe`, `egui-winit`, `egui-wgpu`, `egui_kittest`, `epaint`, `epaint_default_fonts`, `ecolor`++ and `emath`; exactly one winit (the final storytold revision); no registry `egui`/`epaint`++ beside it; no `path = "…"` patch and no branch dependency; a clean checkout fetches every++ approved revision and passes the checks with `--locked`.++- `wgpu` stays `30.0.1`; egui 0.37 accepts `30.0` and already resolves 30.0.1 here. The pinned++ `wasm-bindgen = 0.2.129` must stay consistent with `wasm-bindgen-futures`; check the wasm-target++ inverse tree above.++++### 5.2 IDs and scopes++++- Mechanical `Id::new(` → `Id::unique(`: **626 occurrences / 616 lines** (`601`/`591` in source,++ `25` in tests; 59 source and 12 test files). Count by occurrence and file, not only by line.++ `GlyphId::new` in `crates/text`/`crates/pdf` (7 lines) is unrelated and must stay. Values are++ identical because `Id::new` delegates to `Id::unique`++ (`egui-0.37.0/crates/egui/src/id.rs:101-104`); persisted workspace state++ (`workspace_state.rs`, **version 1**) and project JSON store no egui IDs, so no migration is++ needed.++- `color_picker.rs:335,337`: `ui.id()` → `ui.scope_id()`.++- `widgets.rs:24`: `s.id` → `s.scope_id` (the panel's stable scope; do not use `unique_id`, which++ changes with layout).++- `widgets.rs:492-497`: make `label_swatch_id() -> egui::IdSalt` = `IdSalt::new("label-swatch")`;++ `Atom::custom(salt, …)`; `WidgetAtomResponse::rect(salt)`.++- `menu_keys.rs:84`: `find_menu_root(ui).scope_id`.++- No new ID scheme; add a test that the same source yields the same `Id` across frames and that two++ different payloads differ. Do not derive IDs from translated text (already true).++++### 5.3 Roles, names and accessibility++++Migrate the 19 source `WidgetInfo` sites with the table in §2.2, plus `ui_agent_audit.rs:73` in the++test (`.role`). Specific choices:++++- `color_picker.rs:19`: `Role::ColorWell`, label = hex (existing screen-reader contract).++- `color_picker.rs:336`: `Role::Unknown` (a painted swatch, not an input).++- `color_picker.rs:338`: `Role::Button` ("Original color").++- `color_picker.rs:271,300`: `Role::Slider` (labels stay).++- `effect_controls.rs:1274`, `text_panels.rs:700`: `WidgetInfo::selected(Role::Button, enabled,++ selected, label)`.++- `panels/project.rs:613`: use `WidgetInfo::labeled(Role::TreeItem, …)` directly, but **keep** the++ `accesskit_node_builder` at `project.rs:614-620` for `selected`, `level` and `expanded`++ (`WidgetInfo` cannot express level/expanded); remove only its `set_role(TreeItem)` line.++- `project.rs:781`: `Role::Unknown` (comment).++- `dock_ui.rs:367`: `Role::Splitter` ("Resize floating panel") instead of `Button`.++- `widgets.rs:497`: `WidgetAtomResponse`.++++Naming work for kittest's accessibility check:++++- **Strict checks stay on from the first green PR.** There is no shared test harness to flip:++ `Harness::builder()` appears at 180 call sites in 78 test files, and++ `HarnessBuilder::default()` sets `check_accessibility: true`++ (`egui_kittest/src/builder.rs:51`). A new helper would not reach existing direct builders, and a++ per-builder `with_accessibility_check(false)` would only hide failures. P1 therefore adds the++ actual names until every test passes with strict checks; a repository grep gate forbids++ `with_accessibility_check(false)` (§8.2). No global or blanket opt-out exists at any stage.++- Stock fields: give each `TextEdit` a `hint_text` or `accessible_name`, each `DragValue`/`Slider`++ an `accessible_name`. Known call sites: `TextEdit` (39) in `precomp.rs:117`, `rq_templates.rs:137`,++ `scriptui_view.rs:145`, `timeline.rs:1507,2066,2458,3516`, `project.rs:704`,++ `shortcut_editor.rs:276,440,532`, `markers_ui.rs:119`, `text_panels.rs:607`,++ `settings.rs:174,607`, `effect_controls.rs:1214`, `forms.rs:786,794,806`, `dialogs.rs:471`, plus++ the rest from `grep -rn TextEdit:: crates/ui-egui/src`; `DragValue`/`Slider` (51) in++ `layer_styles_dialog.rs`, `gradient_editor.rs`, `settings.rs`, `key_dialogs.rs`, `forms.rs`,++ `dialogs.rs`, `dialogs_3d.rs`, `viewer_tools.rs`, `scriptui_view.rs`.++- For rows whose label is a separate widget, use `Ui::label_inputs_by(label_id, |ui| editor)` —++ e.g. the Grid rows at `forms.rs:771`, `settings.rs:596`, `key_dialogs.rs:142,207,251`,++ `markers_ui.rs:133`, `rq_templates.rs:56,100`, `layer_styles_dialog.rs:214`.++- For rows whose label is painted (Timeline property rows, Effect Controls rows), use++ `Ui::name_inputs(label, |ui| editor)` or `Response::accessible_name(label)` where the label is++ already known. This covers `timeline.rs:2458,3516` and `effect_controls.rs:1214`.++- Custom widgets have no `WidgetInfo` today; add a small local helper, not a compatibility layer:++ ```rust++ fn named(resp: egui::Response, role: egui::Role, name: impl Into<String>) -> egui::Response {++ resp.widget_info(|| egui::WidgetInfo::labeled(role, resp.enabled(), name.into()));++ resp++ }++ ```++ Use it first for the highest-value controls: dock tabs (`Role::Tab`, selected state,++ `dock.rs:1149-1280`), active/close buttons, the dock split handle, numeric scrub fields++ (`widgets.rs:53-160`), the color field/slider (`color_picker.rs`), the error bar prev/next++ buttons (`expr_bar.rs:59-70`), and the floating-panel resize grip (`dock_ui.rs:367`). Do not++ blanket-wrap `ui.interact`: a node without a real name/role is worse than no node.++ The helper stays private to `effectcraft-ui-egui`; there is one consumer (this app), so it is not++ proposed for `craft-ui` and is not a generic compatibility layer.++++Accessibility assertions (§8.4) must include roles, `selected`, enabled state, names, and the++AccessKit language once §5.9 lands. The app's `ui_agent_audit.rs` (automation coverage) stays++separate: an automation id is not an accessible name. `docs/gaps.md:227` records that the project++has done no accessibility work; this stage is a first, tested step (visible stock controls and the++highest-value custom controls), not a claim of screen-reader parity.++++### 5.4 Fonts, glyphs and text++++- Enable `egui/default_fonts` and `egui/monochrome_emoji_fonts` in the workspace dependency (see++ §5.1) so `FontDefinitions::default()` at `theme.rs:334` keeps the 0.36.2 font set. Do not rely on++ eframe feature unification for correctness.++- Keep the app's two-pass font warm-up (`styled`/`fonts_ready`, `lib.rs:1876-1890`,++ `lib.rs:1905-1911`): 0.37 may apply `set_fonts` immediately when no text has been laid out++ (`#8602`, `#8609`), but relying on that would change when the first frame draws and would make++ headless tests depend on pass timing. Do not use `run_logic` to install fonts in a UI test.++- `theme.rs:732`: `d.font.as_ref() == bytes` → `d.bytes() == bytes` (and keep `d.index`).++- `widgets.rs:329`: `TextEdit::vertical_align(Align::Center)` → `TextEdit::align(Align2::LEFT_CENTER)`++ (the old call only changed the vertical component; the horizontal default was LEFT).++- Update the comment at `theme.rs:354-360` ("egui … has no bidirectional layout"): the suite fork++ shapes RTL runs, but text layers still use `effectcraft-text` and are unaffected. Add a UI-label++ RTL test (Arabic/Hebrew `Label`/menu text has visual-right-to-left run order) and keep the++ text-layer RTL test in `crates/text/src/layout.rs:1419` as the text-engine contract.++- Keep `system_fonts` off. If colour emoji is wanted later, it is a separate change with a startup++ measurement and cross-platform screenshots, not part of this migration.++- Fallback registration stays as is (`theme.rs:388-430`), including `FontData::from_owned` and++ `data.index = face.info.index`; `FontData` still accepts that construction in 0.37. Optional++ follow-up: E14 `FontTweak::fallback_align` for the installed system faces, with CJK/Indic++ screenshots before and after.++- Extend the existing glyph-coverage test (`theme.rs:700-716`) to the full chrome symbol set used by++ the app, including `▣`, `✔`, `✓`, `⚠`, `▶`, `◀`, `▸`, `●`, `○`, `…`, `×`, `›`, `•`, `·`, `−`,++ `←/→/↑/↓`, `⌘`, `⇧`, `⌥`, `⌃`, `⏎`, `↵`, `′`, `″`, in Proportional, Monospace, `medium` and++ `semibold`. This is the regression test for finding 2.3.2.++- Tests that deliberately render scripts with no installed face opt out explicitly **at that test++ builder**: `ui_effect_names.rs:35` (the builder inside `harness()` at line 20, used by the++ `zh-hans` tests at 68, 81, 107 and 127) and `ui_presets_folder.rs:40` (`ja`; the builder is inside++ the test) use `Harness::builder().allow_missing_glyphs()` with a comment naming the script. No++ global opt-out. Test fonts come from the workspace `egui/default_fonts` +++ `monochrome_emoji_fonts` features (§5.1), not from `egui_kittest`'s non-propagating++ dev-dependencies.++- Headless text rendering is not proof of native font fallback/IME; native platform checks remain++ (§8.7).++++### 5.5 Input, IME, clipboard and PRIMARY++++- `control.rs:371`: `Event::MouseWheel { …, source: egui::MouseWheelSource::Wheel }`; the same in++ the 11 test constructions (§2.1). Use `Wheel`, not `Unknown`, so synthetic scrolls are not++ treated like momentum/rubber-band input.++- `viewer_text.rs:397-508` (custom text editor): handle stock++ `egui::ImeEvent::DeleteSurrounding { before_chars, after_chars }` by converting the caret++ position to a char range and issuing `text.delete { range, merge: <same key> }` before the++ following `ImeEvent::Commit`, so replacement is one undo step. Native winit emits the fork's++ `DeleteSurroundingBytes { before_bytes, after_bytes }` (E21/W26/W27); add that arm in the++ language/IME stage, converting UTF-8 byte offsets at char boundaries via `TextDoc::text`,++ `TextDoc::char_of_byte` and `TextDoc::byte_of` (`crates/keyframe/src/text_doc.rs:527-545`).++ Regression: preedit + delete-surrounding + commit replaces exactly the intended characters and++ adds one undo step; press-and-hold/dictation on macOS is verified manually (`W26`).++- **Incoming composition lifecycle (viewer_text).** Each viewport stores++ `ImeComposition::Active(owner)`, `TerminalPending(owner)` or `Stale`, where the owner is++ `(layer, edit session)` and excludes caret, selection, text, revision and geometry. A target++ switch or `text.endEdit` invalidates both live states; the `Stale` tombstone rejects every++ pre-edit/delete/commit from the replaced owner. An empty pre-edit clears the visible composition++ but records `TerminalPending(owner)`: the visible pre-edit ended, while its terminal commit or++ delete-surrounding is still pending. A switch before that terminal event therefore still rejects++ it rather than applying it to the replacement. A non-empty old pre-edit is treated as a continuing++ update of that old composition and keeps the tombstone across arbitrary idle frames. A rejected++ terminal commit is the composition boundary and consumes the tombstone immediately, so a new++ pre-edit later in the same raw input batch is accepted for the current target. A rejected empty++ pre-edit or delete-surrounding is only tentatively terminal: it keeps the tombstone through the++ rest of the batch so a paired old commit is rejected too, and is consumed at batch end when no++ commit follows. Tests must separate the late pre-edit from its commit/delete by at least three idle++ frames, exercise an observed empty pre-edit followed by a target switch and a delayed old commit,++ verify a new pre-edit after a rejected terminal commit in the same batch commits to the new++ target, verify a genuinely new composition after the consumed terminal batch, and verify that no++ permanent lock remains. Do not replace this with an elapsed-frame guard: time is not causal++ ownership.++- **E21b/P7b outgoing surrounding text (new prerequisite, not existing behaviour).**++ Source inspection at the candidate revision found no call to winit's++ `WindowExtWayland::set_ime_surrounding_text` anywhere under `egui-winit`, and `IMEOutput`++ (`egui/src/data/output.rs:100-115`) has only purpose/rect/cursor rect/interrupt. Deletion and++ commit handling alone therefore cannot pass the suite's surrounding-text contract.++ - The fork adds a bounded transient `IMESurroundingText` payload to `IMEOutput` (logical text,++ cursor/anchor as UTF-8 byte offsets, **owner/context generation identity**). It is built from++ committed text only, excludes preedit, is skipped from debug/persistence output, and is per++ IME-owning widget/viewport. The owner generation is present even when support is unavailable;++ **available-empty is distinct from unavailable** and is sent as an explicit empty payload,++ never as an absent one. Changing owner/support (normal, password, unavailable) clears the++ backend cache and uses the protocol's committed disable/enable boundary; an empty text payload++ is not a general clearing API.++ - The **final completed pass** owns the outgoing value, including `None`: the adapter must not++ use `ime.or(self.ime)`-style carry-over that can retain an earlier pass's text. `egui-winit`++ calls W27 on text/selection/focus changes; per-window caching cannot bleed between widgets or++ windows. The excerpt is at most 4,000 UTF-8 bytes cut at valid char boundaries. A selection++ that cannot fit returns an explicit **unavailable** context (or an explicit empty one++ when the document really is empty), never a truncated "complete" selection.++ - A current-epoch `Done` whose protocol serial does not match still applies its incoming edits++ **exactly once** and only defers outgoing surrounding state until a matching serial. A stale++ (different owner/focus generation) batch is invalidated and discarded. Track focus epochs and++ protocol serials separately.++ - **No new document-sized allocation.** Building the new bounded payload must not clone the full++ document; the baseline `TextEdit` already clones whole buffers for change detection/undo, and++ that pre-existing cost is measured separately.++ - **EffectCraft custom adapter (viewer_text).** The producer at `viewer_text.rs:568` must supply++ the logical model text from the edited layer's `TextDoc` (committed text), not display-bidi++ text, with preedit excluded (`viewer-text-preedit` stays a display-only temp value), plus the++ editor's owner generation unconditionally. Convert `TextEdit.anchor/caret` (character++ indices, `crates/engine/src/commands/text_edit.rs:18-40`) to UTF-8 bytes with++ `TextDoc::byte_of`, clamp at char boundaries, excerpt to 4,000 bytes, and remap cursor/anchor++ to the excerpt. Emit an explicit **empty** payload for an available empty document; emit++ **unavailable** (and trigger the committed disable boundary) when there is no edit session,++ when focus leaves the viewer, or after `text.endEdit`/Escape/click-away, so stale text cannot++ survive. The editor has no password mode; the stock-field password/unavailable clears are++ tested there. The payload is scoped to the viewport that owns the focused editor (floating++ panel windows and the main window cannot share state).++ - **Atomic compatibility.** `IMEOutput` loses `Copy` when the payload is owned. The P8 fork SHA,++ all egui-family crates, the `craft-ui` revision and EffectCraft's single `IMEOutput` literal++ (`viewer_text.rs:568`; there are no destructures in this repo) must change in one dependency++ unit. Do not land a mixed stock/fork lock, and do not claim a stock-0.37 app build after this++ stage: the literal would not compile against stock `IMEOutput` (§11.13).++ - Tests: outgoing text immediately after delete+commit and deletion-only batches; scalar/++ grapheme vs byte indices; supplementary emoji, combining marks and RTL logical order; preedit++ exclusion and caret movement; long selection/excerpt limit and allocation bound; same-window++ field switch; two windows; focus loss and late serial; current-epoch mismatched serial applies++ incoming edits once and defers outgoing; stale-epoch discard; available-empty vs unavailable++ and normal/password/unavailable transitions; final-pass `None` authoritative; multi-pass++ final output; native Wayland Vietnamese/predictive IME protocol trace. macOS `NSRange`++ conversion remains a separate W26 path; this does not claim new macOS surrounding-text APIs.++- Clipboard: `eframe/clipboard` feature (§5.1). `ctx.copy_text`/`output.commands` paths at++ `lib.rs:1600-1612`, `lib.rs:1946-1953`, `viewer_text.rs:413-430`, `menus.rs:1867-1906` and the macOS++ `Hooks::clipboard_text` (`lib.rs:159-160`, `apps/effectcraft/src/main.rs:326`) stay unchanged.++- **PRIMARY (E4 + W15P) is a native gate, not one manual row.** Upstream 0.37 fills PRIMARY from++ `Label`/`TextEdit` selections and pastes on middle click (`#8428`); the reviewed fork replaces++ the arboard fallback with a winit-owned PRIMARY path on the existing Wayland++ connection/event queue, using SCTK 0.19.2's `PrimarySelectionManagerState` and per-seat++ device/source/offer objects. Never create a second regular `wl_data_device`. `set_primary` /++ `get_primary` route through it; password selections are never offered; an unchanged selection++ does not reclaim ownership. Serial handling accepts keyboard **and** pointer press serials for++ the focused seat with origin, freshness and epoch (do not invent a keyboard-only rule — the++ protocol describes pointer-driven selection). **Claim the selection synchronously while the++ triggering serial is fresh**; only serving the selection is asynchronous. Reads are bounded:++ a 2 s total monotonic deadline, 16 MiB total bytes, at most 4 read workers and 2 writers with++ a bounded queue of 8. A live owner-specific completion waker wakes the owning viewport after the++ slot lock is released and never blocks the UI; canceled or stale results are discarded, and a++ stale paste is canceled after focus/target/generation changes.++ The native capability matrix in §8.7 covers wlroots/Hyprland, KWin and Mutter; ordinary paste is++ not PRIMARY acceptance. An isolated PRIMARY-only fallback requires measured necessity and review.++- Non-Latin layout shortcuts (E7/E19/W25): headless tests cannot exercise winit's mapping. Add a++ manual row (Russian, Arabic, Hebrew) that checks Menu shortcuts and the timeline/Project Ctrl+C/V/X++ paths, and keep `parse_shortcut` tests (`menus.rs:2229-2265`) as the app-level contract. Use a++ non-clipboard held-key case (e.g. Ctrl+Z) as well, because clipboard shortcuts return before++ emitting Key-down.++++### 5.6 Menus, popups and docking++++- `menus.rs:2025-2050`: keep `MenuBar::new().config(MenuConfig::new().style(menu_style)).ui(...)`;++ 0.37 keeps `MenuConfig` and adds `submenu_gap`. Regression tests: hover-switch between top-level++ menus, arrow navigation (`menu_keys::Nav`), opening a submenu, Escape/outside-click closing, and++ a menu command that acts on the focused `TextEdit`'s selection (`#8763`). That last case is P7c's++ selected fix in the P8 revision, not an app workaround.++- `menu_keys.rs:84`: scope id (see §5.2). `menu_keys` also uses `ui.is_sizing_pass()` for popup++ sizing (already); keep and test that a sizing pass does not invoke a command twice.++- Dock: the layout and drawing are app-owned (`dock.rs`, `dock_ui.rs`); only `craft_ui::docking`++ actions are shared. Preserve panel order/nesting, clip rects, split sizes and IDs. 0.37's++ "Panel/Scene clip rect respects parent" (`#8562`) needs a clip test for a maximized panel and an++ embedded (web) floating panel.++- Root Ui order (`lib.rs:1614-1723`): menu bar strip, header, dock body, native drop overlay,++ mini flowchart, dialogs, ScriptUI windows, coach, import card, toast. There are no side++ `Panel::left/top/...` calls; the dock is an explicit child Ui with computed rects. Keep that order++ and nesting (it decides hover/layer order and clip rects). `CentralPanel` is used only inside++ floating-panel and video-preview viewports (`dock_ui.rs:475`, `prefs_live.rs:207`).++- Do not enable `Style::right_to_left` (E9); the dock and viewer are custom LTR geometry.++++### 5.7 Screenshots (control channel, kittest, hidden windows)++++Replace token-via-input-event correlation with the shared CL-2 completion slot (§3.3). Do not add an++unbounded or app-local result channel: the slot is owned by the app request record, and the++callback holds only a weak reference to it.++++```rust++struct PendingShot {++ token: u64,++ path: Option<String>,++ crop: Option<[f32; 4]>, // logical points, as the control protocol already takes++ reply: Sender<Value>,++ deadline: f64, // app clock++ admitted: (egui::Rect, f32, u64), // screen rect + ppp + geometry epoch at acceptance++ issued: Option<(egui::Rect, f32, u64)>, // target-UI rect + ppp + geometry epoch at issuance++ slot: Arc<capture::CompletionSlot>, // CL-2F helper type (API frozen)++ reserved_bytes: usize,++}++```++++- **Admission.** Use the shared default policy: at most **4 outstanding requests**, **128 MiB per++ image** and **256 MiB aggregate** reserved in-flight/completed bytes. Stricter app caps are++ allowed, but never looser. Estimate the target surface with checked `width * height * 4` from the++ known UI geometry, reject over-budget requests before issuing a capture with an actionable++ reply, and revalidate the reservation at issuance. A post-callback size check alone does not++ bound peak capture memory; the reservation does.++- **Issue.** `ctx.request_screenshot(callback)` sends a viewport command that itself forces a++ repaint, and a pending screenshot makes a hidden window take a full UI+paint pass. A screenshot++ that is merely **queued and not yet issued**, and settling deadlines, must have `tick`/logic send++ `RequestPaintWhileHidden` so the UI reaches issuance; do not add a second wants-paint request++ once the screenshot command has been issued. At issuance record the target-UI logical++ content/screen rect, ppp and a geometry epoch. That issued geometry + epoch, not callback++ metadata, is bound to the image: the callback carries **only pixels**.++- **Completion.** The app owns the strong slot and the owner-specific waker; the callback holds++ only a weak reference, stores the image unless canceled/completed, takes the wake handle, drops++ the slot lock, then requests the owning viewport's repaint. The callback does not wake itself and++ must not strongly capture a `Context` or the app; that would create a cycle with the viewport's++ queued command. `collect_screenshots` drains completed slots in `tick` and encodes/writes/replies++ outside the callback.++- **Geometry/scale binding.** With an **unchanged geometry epoch**, derive the pixel scale from++ the returned image dimensions against the issued rect and verify aspect/rounding; the returned++ image may be smaller when E2 surface fitting applies. **Any** intervening resize/DPI/zoom/surface++ epoch change between admission, issuance and save cancels and retries the request — even if the++ geometry later changes back before the save. Never crop with the admission-time, current or any++ other ppp that disagrees with the issued epoch. Store admitted/issued/captured values and record++ mismatches; an explicit error is correct when a retry cannot complete inside the deadline.++- **Cancel/timeout/drop.** Removing the request record (timeout, close, app drop, caller drop)++ marks its slot canceled under the lock; a late callback finds no live slot or a canceled one and++ drops the image without a second reply or file write. Release the reserved bytes on every exit++ path (completion, timeout, cancellation) and assert retained bytes return to zero after drain.++- `save_screenshot` takes the actual scale/geometry instead of `&egui::Context`++ (`control.rs:570-606`), so it can run in `tick`.++- `issue_screenshots` (`lib.rs:1530-1558`) uses the tick's `now` and a settle deadline, not a++ per-pass frame counter; `collect_screenshots` (`lib.rs:1560-1580`) becomes the slot drain.++- Remove the "occluded/minimized" refusal at `lib.rs:1490-1498` for the native wgpu path only after++ the platform run shows the screenshot request really produces a frame. The refusal exists because++ 0.36 never painted a hidden window; 0.37 makes a pending screenshot a wants-paint action++ (`wgpu_integration.rs:680-690`, `egui-winit/src/lib.rs:2116-2128`). Keep the timeout error and++ add `ui.focus` as the fallback. Record Windows/macOS/Linux results separately. Do not claim++ hidden-window screenshots on a platform that was not tested. On web, eframe does not paint a++ hidden tab (logic-only passes have no clipped primitives), so `ui.screenshot` on web requires a++ visible tab; record that limitation.++- Correlation tests: two concurrent screenshots with different crops; callback-once behavior; a++ timed-out request followed by a late callback (no second reply, no file/PNG); shutdown/close with++ a pending capture; aggregate byte-budget rejection; a resize/DPI change between admission,++ issuance and completion (retry or explicit error, never a stale crop); a hidden-window capture on++ native wgpu is a positive row (not a "missing RequestPaint" negative); retained bytes return to++ zero; the app/Context can be dropped without the callback keeping it alive.++- `docs/control-protocol.md:125-129` and the module docs at `control.rs:1-27` need the new wording++ (no user-visible protocol change: `ui.screenshot` keeps its method and reply shape).++++### 5.8 Viewports and GPU++++- Floating panels (`dock_ui.rs:466-512`) use `show_viewport_immediate`; the video preview uses the++ same (`prefs_live.rs:166-236`). Keep them inside `draw`. Persisted window rects++ (`PanelWindow::sanitized`, `ui.panel_windows`) are unchanged.++- **Hidden playback and child windows.** `show_viewport_immediate` children only update when the++ parent runs a pass. If playback is playing while the root window is minimized/occluded, or a++ floating panel/video preview is open, `tick` must keep `want_paint` set (and request a repaint at++ the needed cadence) so the parent runs the forced hidden pass. Do not rely on the one-shot++ open/close command mitigation alone. Test a minimized-window playback with the Video Preview open++ and with a floated panel, asserting the child content advances and the parent does not thrash.++- 0.37's `#8748` (a hidden parent does not update deferred children) is carried as P7c's selected++ fix in the final P8 revision; verify it in the hidden-playback test. Independently, a command that++ opens/closes/floats a panel or video preview also sets `want_paint`, and playback keeps the pass++ cadence, so the app does not depend on one mechanism alone.++- GPU: `egui_wgpu::Renderer`'s++ `register_native_texture_with_sampler_options`, `update_egui_texture_from_wgpu_texture_with_sampler_options`++ and `free_texture` are unchanged in 0.37 (`renderer.rs:790-930`), so `viewers.rs:150-210` needs no++ API change. `RenderState`/`Frame::wgpu_render_state` are unchanged. Keep E2+E3. The existing++ `ui_gpu.rs` GPU-vs-CPU tolerance (at most 0.3% of pixels differ by more than 1/255, worst channel++ difference ≤4) stays.++- **A skipped GPU test is not evidence.** `ui_gpu.rs` returns early when++ `effectcraft_gpu::Gpu::headless()` finds no adapter (`tests/ui_gpu.rs:44-47`) or when egui-wgpu's++ GL device has WebGL2 limits (`tests/ui_gpu.rs:62-65`). For the GPU acceptance row run with a++ required adapter, assert `gpu_adapter().is_some()`, and record adapter/backend/driver and the++ exact test invocation. The planning host exposes an i915 render node (`/dev/dri/renderD128`) with++ no display session; that can qualify a headless wgpu adapter run, not presentation.++- Device loss must be handled from `tick` (see §4.2); the `ui()` early return currently means a++ device lost while hidden is not acted on (`lib.rs:1905-1910`). Add a logic-only test that a++ reported failure closes the window and keeps the auto-save.++- 0.37 `Frame::set_wgpu_surface_config` is fixed (`#8442`); EffectCraft does not use it. Do not add it++ as part of this migration.++++### 5.9 Language and screen readers (fork-only stage)++++When `craft-libs#198`'s fork APIs are accepted:++++- In the app tick, after `i18n::set_current(language)`, call++ `ctx.set_language(Some(language.to_string()))` (fork E17) and, where an `eframe::Frame` is++ available, `frame.set_ui_language(Some(language))` (fork E18). This sets the AccessKit root++ language and widget text layout language. It does not change the app's catalogs.++- Assert `ctx.language()` follows the interface language, the AccessKit root node carries the++ language, and a `TextEdit`'s text is shaped with the UI language (CJK glyph choice where fonts++ are installed). Tests that need the fork API are marked fork-required in their module docs.++- Keep the app LTR (`Style::right_to_left` unset). Text-layer RTL remains `effectcraft-text`'s++ contract; UI-label bidi is epaint's.++- The E17/E18 policy sub-stage is optional and separately revertable. The production app already++ requires the final fork and E21b from P1; a stock-0.37 control uses a separate minimal adapter++ and is not obtained merely by reverting P4 (§11.13).++++## 6. Dependency topology, publication reachability and rollback++++Intended graph (final reviewed storytold revisions; names shown for structure):++++```text++effectcraft / effectcraft-web / effectcraft-cli++ -> effectcraft-ui-egui -> craft-ui (craft-libs rev with CL-1 + CL-2F)++ -> egui 0.37.0 (git <final storytold egui P8 SHA, incl E21b/P7c>)++ -> epaint, epaint_default_fonts, ecolor, emath (same git rev)++ -> eframe, egui-wgpu, egui-winit (same git rev)++ -> accesskit 0.25.1, kittest 0.5.0++ -> winit 0.30.13 (git <final storytold winit SHA, incl W15P>)++ -> winit (direct, same git rev)++```++++- Every egui-family crate EffectCraft resolves must come from the same git revision. `cargo tree -d`++ must show no second egui family, and `cargo tree -i [email protected]` exactly one source.++- Publication: EffectCraft is an application, so a git egui/winit dependency is acceptable in its++ lock, but no branch names, no `path` patches and no machine-local checkout may appear in a++ publication branch. The `aiongg` candidate SHAs are comparison inputs and must not appear in a++ publication lock. `craft-libs` consumers keep their own patches; the app's `[patch.crates-io]`++ is the supported place for the suite fork.++- A clean checkout must fetch every final approved revision and pass `cargo check --locked` and++ `cargo test --locked` without local overrides; record that proof with the lock.++- Rollback: keep the exact baseline lock (egui family 0.36.2, craft-ui `5c874d51`, winit registry++ 0.30.13) in the task evidence. The project file format, command ids, undo model, workspace-state++ **version 1** and the GPU compositor are unchanged by this migration, so rollback is a revert of++ the pin/refactor commits, with no data migration. Do not persist any 0.37-only preference until++ the final stage, so an older build ignores nothing it cannot read.++- `examples/plugins/posterize-bands` is a separate workspace with its own lock and no egui; do not++ edit it. `craft-pdf`/`hayro-syntax` and the filmcraft pins are unrelated and stay.++- There are no vendored crates in this repository (`vendor/` absent); the only patch is the++ craft-libs `hayro-syntax` entry. Do not delete it, and do not "clean up" the commented filmcraft++ path patch by enabling it.++++## 7. Command, undo, save/reopen contracts++++Nothing in the egui bump may change these:++++- Every gesture still routes through `effectcraft_engine::Session::execute` or `menus::invoke`++ (`lib.rs:1-6`, `control.rs:1-19`); UI-local state must not become the source of truth.++- One gesture = one undo step: existing tests such as `ui_viewer.rs:2263` (fit/zoom),++ `ui_viewer.rs:2306` (rotate), `ui_project_delete.rs`, `ui_timeline_trim.rs` and `ui_keyframes.rs`++ stay green.++ `Session::history.merge_key` is reset when a numeric scrub ends (`lib.rs:1866-1867`,++ `pointer_wrap.rs:31-36`).++- Save/reopen: `.ecproj` JSON contains no egui types; save, reopen and pixel-compare a comp after a++ UI edit. Workspace state (`workspaces.json`, **version 1**, `workspace_state.rs:37-40,85-88`)++ contains `PanelKind`, rects and floats, not egui ids; save, restart and restore the dock/floating/++ window layout. If a new field is ever required, specify an explicit version bump, a migration and++ a backward-compatible reader test; do not silently reuse version 1.++- Multi-pass must not duplicate a command, an undo step, an autosave write or a close prompt++ (§4.4, §8.3).++- **Auto-save while hidden has two owners today.** Project auto-save/recovery already runs from++ `tick`; the workspace-layout autosave is still in `draw` (`lib.rs:1715-1722`, gated on++ `!ptr.any_down()` and `workspace_store.due(now)`). P2 moves its due check and write to `tick`++ using the app clock and the last pointer-down state observed in `draw`. Only then does the++ hidden claim cover both kinds; the close guard and crash recovery remain tick-owned. §8.3's++ test asserts both writes while hidden.++++## 8. Tests and acceptance++++### 8.1 Repository gates++++Every stage runs the repository gates (through the server job workflow, never directly from the++planning task): `cargo fmt --check`, `cargo clippy --workspace --all-targets --release -- -D warnings`,++`cargo test --workspace --release`, `cargo xtask layers`, `cargo xtask assets`, `cargo xtask wasm`,++plus `node apps/effectcraft-web/tests/{workers,page,storage}.mjs` (no build needed).++On every dependency stage also run `cargo check --locked`, `cargo test --locked`,++`cargo tree -d`, the family/winit inverse trees and the wasm-target `wasm-bindgen` tree on a clean++checkout. `cargo xtask ci` is the final gate.++++### 8.2 Compile and API contract++++- The 15 errors and 602 warnings above are gone, with no `#[allow(deprecated)]` added to production++ code.++- Grep gates must use precise patterns:++ ```sh++ git grep -nP '\bId::new\(' -- '*.rs' # only comments/none++ git grep -n 'WidgetType\|AtomLayoutResponse\|\.vertical_align(' -- crates apps++ git grep -n 'with_accessibility_check(false)' -- crates apps # must be empty at every stage++ ```++ The old `grep -rn "Id::new"` also matches `GlyphId::new` in `crates/text`/`crates/pdf` (7 lines)++ and can never return "none"; `\bId::new\(` does not match inside `GlyphId`.++- `ui_agent_audit.rs:73` uses `WidgetInfo.role` (`typ` is gone); all tests construct `MouseWheel`++ with `source`.++- Tests for `Id::unique` stability and for the role mapping table.++++### 8.3 Lifecycle, hidden windows and multi-pass++++New tests (headless, `Context::run_logic` + `run_ui`, no GPU). The driver must mirror the real++eframe order: `raw_input_hook`-equivalent (`feed_synthetic`) → `run_logic` → retain the mutated raw++input → next `run_ui`, and it must not replay input events from `tick`. Use `AppClock::manual()`:++++1. `logic_only_drains_control_and_jobs`: a control request that only needs `tick` (e.g.++ `engine.execute` of a non-UI command) gets its reply with zero `run_ui` calls; `poll_render`++ completes a render job and the Toast/event is drained. Advance the manual clock between ticks.++2. `logic_only_feeds_synthetic_and_forces_one_paint`: with the root viewport marked++ `minimized: Some(true)` (so `visible() == Some(false)`), a queued `ui.click` is fed by the hook++ during a logic-only tick; the tick emits `RequestPaintWhileHidden` and sends **no** reply. A++ second logic-only tick does **not** feed another event while the first is still unapplied. The++ following forced `run_ui` sequence (still minimized) consumes one pointer event per pass, applies++ the buffered gesture exactly once and replies exactly once after the final pass. The same test++ asserts that the forced passes are not gated on `visible()` and that no event was dropped.++3. `after_input_replies_only_after_a_paint`: same, and assert the command's effect exists before++ the reply is sent; force a discard on that pass and show the reply still waits for the final++ non-discarded pass.++4. `forced_hidden_pass_applies_buffered_gesture`: feed during a logic-only tick, run forced full++ passes until `synthetic` is drained, and assert exactly one command and one undo step (no++ duplicate from the logic-only call).++5. `playback_advances_without_a_paint`: with a viewer scale recorded and the manual clock, hidden++ ticks advance `session.time` within the preview step and do not duplicate `Playback.frame_shown`;++ audio is started once (stub `audio_device`); a stale `ctx.input(|i| i.time)` cannot satisfy a++ deadline.++6. `autosave_and_close_guard_run_while_hidden`: project auto-save and the moved workspace-layout++ autosave both write in logic-only ticks; a hidden close request opens the unsaved dialog and++ sends `CancelClose`.++7. `discarded_pass_is_idempotent`: force `ctx.request_discard` (or show a first-time `Grid`) while++ performing one command, one drag and one auto-save; assert one command execution, one undo step,++ one file write.++8. `device_loss_while_hidden_closes_and_saves`: bridge a failure during a logic-only tick; assert++ the close command and the auto-save, as in `lib.rs:2040-2075`.++9. `hidden_playback_keeps_child_viewports`: with playback playing and a Video Preview or floating++ panel open, hidden ticks keep requesting a pass and the child content advances (§5.8).++10. Screenshot-slot tests from §5.7 (concurrency, cancellation, late callback, resize/DPI including++ a change back, byte budget, shutdown).++11. `repeated_logic_only_ticks_do_not_collapse_a_gesture`: queue a `ui.click` and a `ui.drag`, run++ several logic-only ticks (mirroring eframe's overdue `RedrawRequested` and 100 ms invisible++ throttle) while the root viewport stays minimized, and assert the hook fed at most the one++ unapplied event; then run forced full passes and assert press/move/release each reached a++ separate pass, exactly one click/drag command and one undo step resulted, and no event was++ dropped. Repeat for a click followed immediately by a drag.++++### 8.4 Screen geometry, pixels and accessibility++++- Fixtures: the built-in demo project (`file.openDemoProject`) for visual states, the generated++ `engine::perf::large_project` for scale/perf, and the bundled Inter/JetBrains Mono fonts. No++ external media is needed for UI geometry/accessibility/pixel tests; media-dependent tests keep++ their existing generated fixtures.++- Geometry/hit tests (existing helpers, automation rects): viewer comp rect and fit at 1.0/1.25/1.5/++ 2.0 ppp; dock split resize; tab drag and overflow; floating panel window (native only; embedded++ web path separate); menu item click at a label; timeline row heights (`ui_parameter_spacing.rs`++ keeps 20/19 px); panel order/nesting after maximize/restore.++- Double-click paths: 24 `double_clicked()` call sites (27 textual `double_click` occurrences++ including the Timeline helper, e.g. project rename `project.rs:783,832,1036`, Timeline++ `timeline.rs:1502,2116,2325,2516,2876,3529`, Flowchart `flowchart.rs:360`): 0.37 changed++ double/triple-click classification (`#7915`). Assert one double-click performs exactly one action++ and does not also fire a triple-click path.++- **Visual review harness — correct the claim and extend it.** Today++ `crates/ui-egui/tests/ui_visual_review.rs` (`UI_REVIEW_DIR`, `#[ignore]`) captures the workspace++ in light and dark, but every `PanelKind::ALL` panel and the About/New Comp/Settings/Shortcuts/++ Command Palette dialogs only in **dark**, at the harness default ppp 1.0, at wide 1600×1000 and++ compact 1024×768 (`ui_visual_review.rs:13-48`). Extend it to capture every panel and dialog in++ **both themes at ppp 1.0 and 2.0** (four combinations per state, both sizes), then use it on the++ baseline and every stage. This is the primary before/after visual record; the golden set below is++ the automated subset. Record that the ignored test actually ran; an ignored/absent capture is not++ evidence.++- Pixel comparisons: choose one of++ - `egui_kittest` `snapshot` goldens (enable the `snapshot` feature, add `kittest.toml` with++ `threshold` per OS, commit a small fixed set of PNGs under `crates/ui-egui/tests/snapshots/`++ **with `.attribution` sidecars and `ATTRIBUTION.md` rows**, because the repository's asset rule++ applies even to screenshots); or++ - an app-owned tolerant compare against RGBA hashes stored in a Rust constant, with the same++ tolerance policy and no image assets.++ Exact selected set: five states — Standard workspace (demo, time 2 s), Timeline maximized with++ rows open, Project panel with folders open, a menu open, and the Settings dialog — each in++ **light and dark at ppp 1.0 and 2.0** (20 captures), not a single dark/default-scale set.++ Threshold: max channel delta 2/255, ≤0.1% failed pixels on Linux/Windows, 3/255 on macOS (if any++ platform-specific rasterization is observed); no tolerance for geometry rects. Never accept a new++ golden automatically; a changed golden needs a reasoned explanation in the PR.++- Mutation check (required, recorded as evidence, not committed as a test): nudge `Tokens::focus` or++ a panel width by a visible amount behind an env flag and show that the pixel/geometry test fails++ with the expected diff; restore. This proves the assertions detect change.++- Accessibility: **strict checks throughout**; `Harness::unnamed_widgets()` empty for the workspace,++ for each panel maximized, for every dialog in `Dialog`, and for the Home/Media Browser/Effect++ Controls/Properties/Timeline panels. Role contract tests for color well, tab + selected, splitter,++ tree item, text input, spin button, slider and a checked menu item. `Role::Button` + `selected` for++ selectable labels. Read-only fields are exempt by kittest. The repo-wide grep gate in §8.2 proves++ no global/per-builder accessibility opt-out remains.++- Glyph coverage: the extended chrome symbol test (§5.4); `ui_effect_names.rs:35` and++ `ui_presets_folder.rs:40` use `allow_missing_glyphs()` with a comment. No global glyph opt-out.++- `ui_gpu.rs` and `ui_visual_review.rs` are skip/ignore-capable: the acceptance record must name the++ exact invocation and show they actually ran. A skipped GPU test is not GPU evidence (§5.8).++- Screenshot tests (§5.7) and IME/adapter tests (§5.5).++++### 8.5 Save/reopen and command/undo workflows++++- UI edit → save `.ecproj` → reopen in a fresh `EffectcraftApp` → project JSON equal and viewer++ pixels equal; undo/redo across the save still works.++- Dock/floating/panel-window layout → save workspace → restart → restored; maximize/restore and++ split sizes unchanged.++- One command from the menu, one from the control channel and one from a synthetic click each++ produce one undo step; a discarded pass does not add another.++++### 8.6 Web workflow++++- `cargo xtask wasm` (all L0–L4 + ui-egui + web) and `cargo xtask web --serve 8765`.++- `node apps/effectcraft-web/tests/smoke.mjs --url http://127.0.0.1:8765/ --out <evidence>`:++ WebGPU/GPU-compositor path, viewer, `render.frame`, Render Queue downloads, background worker++ event-loop gaps (<400 ms), AudioContext, save/reopen, persistence across reload, offline service++ worker. Also `workers.mjs`, `page.mjs`, `storage.mjs`.++- Browser screenshots come from CDP (`smoke.mjs:113`), independent of the egui screenshot API; add++ a page-side check only for the in-app `window.effectcraft.request("ui.screenshot", …)` reply shape++ when the tab is visible. A hidden web tab cannot paint (logic-only passes carry no clipped++ primitives), so `ui.screenshot` on web is a visible-tab feature; record it.++- Web is a separate feature set: no OS clipboard/PRIMARY, no system fonts, embedded viewports.++- **Hidden-tab behaviour, realistically.** Upstream 0.37's web runner already falls back from++ `requestAnimationFrame` to `setTimeout(10 ms)` when `document.hidden()`++ (`eframe/src/web/web_runner.rs:238-279`), so `AppRunner::logic` keeps running with logic-only++ passes and the browser clamps background timers to roughly one second (long-backgrounded Chrome++ may throttle further). Assert that the session snapshot's timestamp advances across the hidden++ period at the browser's actual cadence, that frame workers keep completing within that allowance,++ and that the viewport is fully refreshed when the tab returns. Record the browser, visibility++ transition and measured cadence; do not require exactly 1 s and do not add a new worker/timer++ scheduler or page-independent persistence feature in this migration. Fix `WebApp::logic` to pass++ the app clock (`self.app.now()`) to `persist::snapshot`, not `ctx.input(|i| i.time)` (which is++ stale in a logic-only pass).++++### 8.7 Native platform matrix++++| Row | Required evidence |++| --- | --- |++| Linux headless wgpu (this server) | `ui_gpu.rs` with a **required** adapter on the i915 render node (`/dev/dri/renderD128`, no display session): assert `gpu_adapter().is_some()`, record adapter/backend/driver and the exact command. This qualifies a headless GPU-compositor run only, not native presentation. |++| Linux X11 | Native window under **Xvfb + a real window manager** (e.g. openbox) **+ an X11 input method** (e.g. ibus/fcitx): screenshot, save/reopen, floating panel window, focus/menu/close/auto-save, clipboard and PRIMARY between windows, X11 IME (Vietnamese/Japanese) with editor/undo checks. Record Xvfb/WM/IME versions and that the session is virtual and not composited. This can qualify the X11 parts; it cannot qualify a physical GPU or Wayland. |++| Linux Wayland | Requires a real compositor; unresolved unless a managed environment is provided. Run the E4/W15P PRIMARY **native capability matrix** on wlroots/Hyprland, KWin and Mutter: protocol availability, keyboard focus, keyboard and pointer-selection serial freshness, owner/seat change, empty/absent offers, self-paste, slow/canceled transfer, password exclusion, unchanged-selection reclaim, and no second regular data device (protocol trace). Also trace text-input-v3 current-epoch mismatched `Done` (incoming applied once, outgoing deferred), stale-epoch discard, and disable/enable on owner/support changes. Record unsupported capabilities honestly; do not substitute X11/arboard results. |++| Windows (`craft-windows` clone, separate task) | real native build/test, GUI launch, screenshots, menu/close/auto-save, clipboard, IME, DX12 pipeline startup timing, mixed-DPI window placement, and a held Ctrl+Z release after a layout switch; Basic Render Driver is software and must be reported as such. |++| macOS | **unresolved gate** unless real hardware evidence is provided: press-and-hold/dictation and surrounding-text NSRange (`W26`), Command-key shortcuts, traffic-light/titlebar placement, screenshots while occluded. |++| FreeBSD / Nix / Windows ARM64 | CI workflows are reusable `craft-common-actions`; run after the pin lands and report only what the runners provide (FreeBSD nightly, ARM64 MSI on schedule). |++++Headless kittest is not evidence for native focus, IME, file pickers, clipboard, PRIMARY or GPU++presentation. Physical-GPU and Wayland rows remain explicit unresolved gates until measured.++++### 8.8 Known upstream regressions as acceptance gates++++- `#8731` (text tessellation, reported +61% instructions for plain text): measure with the paired++ text-heavy operations (workspace, timeline, project) and the raw `tessellate` instruction count++ where possible. This measurement belongs to the pre-P1 gate. If the median regression is above++ threshold, the row-wise fix (provenance, test, removal condition) must be in the reviewed P8++ revision before P1 is frozen, or the migration is blocked. P5 may not add it afterwards.++- `#8736` (DX12 pipeline creation, reported ~40 ms): measure Windows startup and first-frame cost++ separately for the DX12 backend. If it pushes startup over threshold, the fix must be in P8 before++ P1 or accepted with an explicit owner decision and the measurement; P5 only re-reports it.++- `#8512` (system font startup cost): keep `system_fonts` off and record font-install/discovery++ time in the startup row so a later color-emoji decision has a baseline.++- `#8489`/`#8583`/`#8601`/`#8589` are handled by this plan's refactors.++++## 9. Performance plan++++### 9.1 Baseline before production changes++++Add instrumentation first (stage B0, no behaviour change): raw samples per operation, p50/p95/p99,++the number of **final** paint passes and discarded passes (`Context::will_discard()` at the end of++`draw`), texture-upload bytes per frame from `FullOutput.textures_delta`, logic-only tick time,++startup-to-first-frame and font-install/load time, and an optional counting global allocator in++`effectcraft-cli` for `bench --ops` (byte counts per operation). Record raw and compressed++`effectcraft-web` `.wasm` sizes. `Measure` gains `samples`, `median`, `p95`, `p99`, `cpu_ms`;++existing names and JSON fields stay. Then run the **B0-instrumented** baseline: commit `9581b53c`+++ the instrumentation patch, with its patch SHA and the 0.36.2 lock recorded. The baseline identity++is B0-instrumented `9581b53c`, not the bare commit. The same instrumentation is applied to the++candidate so both sides are measured identically.++++### 9.2 Matched operations++++| Operation | Command / driver | Sample rule |++| --- | --- | --- |++| Startup to first frame | `bench --ops --json` `startupToFirstFrame`; native log "first frame drawn" | ≥20 fresh processes per source/lock; same large project, fonts, window 1680×1020 |++| Steady workspace frame | `workspaceFrame` | ≥10 warmups, ≥30 timed iterations per session, 3 sessions |++| Timeline scroll / open rows | `timelineScrollFrame`, `timelineOpenFrame` | 5,000 layers, every 10th open; ≥30 iterations |++| Project panel scroll | `projectPanelFrame` | all folders open; ≥30 iterations |++| Menu open / dock resize / typing | new `menuOpenFrame`, `dockResizeFrame`, `textTypingFrame` | fixed input scripts; ≥30 iterations |++| Frame distributions | scripted workspace/timeline/typing loop or native playback | **≥1,000 actual final paint passes per row**; record discarded passes and dropped frames; p50/p95/p99 only with ≥1,000 |++| Logic-only tick | new `logicOnlyTick` | 1,000 `run_logic` ticks, idle queues; asserts no paint work |++| Idle repaint rate | new `idleRepaints60s` using `Context::set_repaint_observer` | virtual 60 s; count causes |++| Playback | native preview long enough for ≥1,000 presented frames (e.g. 20 s at 60 fps, or repeated 10 s segments with a fresh start) | actual pass count, dropped frames, audio clock; `ui.inspect.fps` is a smoothed readout, not a distribution |++| Texture uploads | bytes/frame from `textures_delta` | viewer frame and thumbnails |++| Allocations | counting allocator totals per op | optional but recorded |++| Font startup (`#8512`) | cold start with system-font provider off; record font discovery/install/load | ≥20 fresh processes; part of startup evidence |++| WASM size | `cargo xtask wasm` artifact | raw and gzip/brotli sizes, baseline vs candidate; accept a budget or make emoji fonts native-only |++| Engine control | `cargo xtask bench --quick --repeat 5` | guards accidental engine/render drift |++| GPU vs software | same UI ops with llvmpipe/software GL and a required hardware adapter where present; Windows Basic Render Driver separately | separate tables, never merged |++++### 9.3 Environment and protocol++++Record: CPU/GPU model, RAM, OS, driver, display scale, window size, renderer backend, release++profile, exact commit/SHA/lock/craft-ui/egui/winit revisions, font set, fixture project SHA, and++load average. Every row uses **≥10 warmups** and **≥30 timed iterations** for steady operations,++**≥20 fresh processes** for startup, and **≥1,000 actual final paint passes** for a frame++distribution. Report the exact frame counts, discarded passes, dropped frames, audio underruns, raw++samples, median/p50, p95 and p99; do not report a p99 from 30/90 samples. Measure peak RSS++(`/usr/bin/time -v` or `-l`) and idle CPU (60 s); use `perf stat -e instructions:u,cycles:u` where++available. Use `cpu_time`/instructions and wall time; on a shared host, wall time is secondary.++Software renderers and physical GPUs are separate tables.++++Predefined thresholds (owner sign-off required to widen):++++- steady/scroll/project/typing median ≤ +5%, p95 ≤ +10%;++- startup median ≤ +5%, p95 ≤ +10%, using the shared small-operation noise floor;++- logic-only tick median ≤ 0.5 ms and p99 ≤ 2 ms on the large project (no paint work);++- idle repaint count ≤ baseline per minute; no new recurring repaint while idle;++- texture upload bytes per steady frame ≤ +10%;++- peak RSS ≤ +5%; record absolute MiB as well; no automatic absolute-size exemption;++- engine render benchmark (`cargo xtask bench`) within its own noise band; no regression;++- text tessellation (`#8731`) and DX12 startup (`#8736`) are reported as their own rows and must++ meet the same median/p95 or be fixed/accepted explicitly.++++Noise policy: run the unchanged 0.36.2 build twice as a control. The first report must also run++**stock egui 0.37.0** as the required upstream-equivalence measurement control (not a production++pin), and report regressions only against these controls. If control spread prevents resolving the++shared thresholds, report inconclusive and rerun under quieter conditions; never widen a threshold++automatically. If a regression exceeds the gate, re-run paired 3× and profile;++never update a golden or baseline to hide it. A changed pixel golden is a reported visual change++with a reason, not a performance result. No performance number is claimed by this document; the++thresholds are proposals to be validated by paired runs on recorded hardware.++++## 10. Staged implementation PRs++++Dependency DAG: `B0 → P1 → P2 → P3 → P4 → P5`. P1 waits for the complete reviewed/published++storytold egui **P8** (E1–E21, P2b async W15P routing, P7 held-key pairing, P7b/E21b, P7c's++selected `#8763`/`#8748` fixes and any justified `#8731`/`#8736` perf fix), the completed winit++(W1–W27, W15P, W27 lifecycle), and craft-libs CL-1 and CL-2F after its DesignCraft/GridCraft++pilots. P1 includes the compatible `IMEOutput` producer and all required fork API adaptations.++There is no stock or intermediate-fork production stage. If a consumer already has an++incompatible craft-ui/egui bump, it must be reconciled in this same atomic stage. P4 adds native++language/platform evidence and optional language UI policy; reverting it never removes the P1++compatibility adapter. P5 is measurement/docs only and requires final platform and performance++acceptance.++++| Stage | Scope | Validation | Rollback |++| --- | --- | --- | --- |++| **B0** | Bench instrumentation only: samples/percentiles, final/discarded pass counters, logic-only tick, repaint observer, texture-byte counter, font-startup and WASM sizes, optional allocator; baseline run on B0-instrumented `9581b53c` (record patch SHA and lock) | `bench --ops --json` raw evidence; no behaviour change; gates | revert commit; baseline evidence retained |++| **P1** | Final reviewed storytold dependency pins (complete egui P8: E1–E21 + P2b + P7 + P7b/E21b + P7c `#8763`/`#8748` + justified perf fixes; completed winit W1–W27 + W15P and W27 lifecycle fixes; craft-ui with CL-1 + CL-2F), including the viewer_text surrounding-text adapter and compatible `IMEOutput` literal, feature `clipboard`, `default_fonts` + `monochrome_emoji_fonts`; mechanical API migration (IDs, roles, `Ui::scope_id`, `Atom`/`IdSalt`, font bytes, `TextEdit::align`, `MouseWheelSource`, screenshot callback via the CL-2F slot, test `Event`s); **actual strict kittest accessibility names and glyph fixes** until all tests pass with `check_accessibility: true` and missing-glyph `Panic`, with `allow_missing_glyphs` only on the two named script tests. No `with_accessibility_check(false)` anywhere. | `cargo xtask ci`; `cargo check/test --locked`; `cargo tree -d`; one-family/one-winit and wasm-target checks; all tests compile and pass | revert P1: restores the 0.36.2 lock; no data changes |++| **P2** | Lifecycle: `tick`/`draw` split, injected app clock, focus, polls/playback/audio/project and workspace-layout autosave/events in tick, hidden `RequestPaintWhileHidden` (including queued screenshots, settling and playback/child viewports), synthetic-input generation guard, input-waiter ordering after draw, close guard, screenshot scheduling ownership | §8.3 tests; native hidden/minimized manual check; benchmark logic-only/idle | revert P2: returns work to `ui`; behaviour-only, no data |++| **P3** | Accessibility completion (custom roles/names), glyph coverage, extended light/dark × 1.0/2.0 visual harness, geometry/pixel tests, style/visual adjustments if the tests show unintended movement | §8.4 tests, `cargo xtask assets` (only if PNG goldens), a required-adapter `ui_gpu.rs` run | revert P3: tests and names only (except any visual fix, which is isolated) |++| **P4** | Extended language/platform qualification: `set_language`/`set_ui_language` policy where applicable, RTL UI-label tests, PRIMARY native capability matrix, clipboard/non-Latin shortcut and native IME rows. E21b/`IMEOutput` compatibility is already part of P1. | fork-required tests and native matrix using the same coherent dependency unit | revert P4 policy/test additions; retain P1 final pins and required adapters |++| **P5** | Performance acceptance and re-measurement of the unchanged P1 dependency unit (no new fork commit), docs (`docs/architecture.md:359` still says 0.36.2; `docs/control-protocol.md` screenshots; `docs/testing.md` UI perf), final evidence. Any `#8731`/`#8736` fix must already be in the reviewed P8 pin from P1. | paired benchmark report with raw samples, frame counts, thresholds, stock-0.37 control, platform rows, unresolved gates | revert P5: docs/report only; no dependency or state change |++++Each stage is a separate reviewable PR with its own exact source/lock identity, validation log and++screenshots. No stage pushes, opens a PR or publishes without fresh human approval of the exact++content and validation.++++Compatibility checks after P1 and each later stage:++++```sh++cargo tree -d++cargo tree -i [email protected]++cargo tree -i [email protected]++cargo tree -i wasm-bindgen --target wasm32-unknown-unknown++cargo check --locked++cargo test --locked++git grep -n 'path *= *"/' -- Cargo.toml crates apps # must be empty++git grep -n 'branch *=' -- Cargo.toml # must be empty in publication++git grep -n 'aiongg' -- Cargo.toml Cargo.lock # must be empty in publication++git grep -n 'with_accessibility_check(false)' -- crates apps # must be empty++```++++## 11. Blocking unknowns and decisions++++1. **Final storytold egui/winit SHAs.** The candidate `aiongg` revisions are comparison inputs only.++ Production waits for the approved, published implementation: a storytold egui **P8** SHA with++ E1–E21 + P2b + P7 + P7b/E21b + P7c's selected `#8763`/`#8748` fixes + any justified++ `#8731`/`#8736` fix, and a completed storytold winit SHA with W1–W27 + W15P and the W27++ lifecycle fixes. Both must be reachable, immutable and fetchable with `--locked`.++2. **craft-libs PR 199 base.** The implementation starts from merged PR 199 at++ `3832c47ef68a0e6214f2c1e85f3526b6adcb686e`; historical `8614e4a`/`1764bca` on old `main`++ `4919088` and the stale `b68de8c`/`ec8840a` trees must not be merged. The final immutable++ craft-ui revision must keep registry `egui 0.37` and include CL-1 plus CL-2F.++3. **CL-2F.** EffectCraft requires the approved craft-ui slot helper at the CL-2F freeze in the++ same atomic stage as P1; only the Design/Grid pilots use the provisional CL-2 revision. If++ CL-2F slips, P1 cannot claim screenshot completion done; no app-local channel or unbounded++ queue is an acceptable substitute.++4. **E21b/P7b coordination.** The egui `IMEOutput` payload and the egui-winit W27 adapter must land++ atomically with the custom-editor adapters; the stock/fork `IMEOutput` shape cannot be mixed.++5. **`#8731` fix availability.** If text tessellation regresses over threshold, the fix belongs in++ the reviewed P8 revision before P1 (with provenance/test) or the migration is blocked; P5 cannot++ change the pin.++6. **`#8736` Windows startup cost.** Measure before P1; include the fix in P8 or record an explicit++ owner acceptance. P5 re-reports it.++7. **`monochrome_emoji_fonts` / `system_fonts` / WASM size.** The plan requires++ `monochrome_emoji_fonts` to preserve `✔`/`▣` and 0.36 parity. Measure the web raw/compressed++ size; accept a budget or add a native-only emoji-fonts feature. Enabling colour emoji via++ `system_fonts` is a separate decision with startup (`#8512`) and determinism costs.++8. **Pixel golden storage.** Committed PNGs require `.attribution` sidecars and `ATTRIBUTION.md`++ rows under the repository asset rule; if maintainers reject committed screenshots, use the++ hash-based tolerant comparison instead. Both need the same tolerance policy and the exact++ light/dark × 1.0/2.0 set.++9. **macOS evidence.** No macOS hardware is available to this task; the macOS gate (IME/NSRange,++ Command keys, title bar, hidden screenshots) remains unresolved until real evidence exists.++10. **Windows evidence.** Requires a `craft-windows` clone and the task workflow; the Basic Render++ Driver is software and cannot stand in for a real GPU result.++11. **Linux Wayland/PRIMARY and physical GPU.** The planning host has no display session (only an++ i915 render node), so a headless wgpu adapter run is possible but Wayland/PRIMARY/real++ presentation need a managed environment. Xvfb + WM + IME qualifies only the X11 parts.++12. **Accessibility workload.** The exact number of unnamed inputs is unknown until the suite runs;++ the known stock set is 39 `TextEdit` and 51 `DragValue`/`Slider` sites plus custom widgets that++ gain roles. P1 fixes what strict checks report; there is no global or per-builder opt-out, and++ P3 completes the custom-control coverage.++13. **Atomic compatibility boundary.** P1 uses the complete reviewed dependency unit and its++ required IME/screenshot adapters. No intermediate base pin is needed. Independent stock-0.37++ controls use a bounded test adapter and are never a production handoff. Extended language++ policy/qualification in P4 cannot undo required P1 API compatibility.++++## 12. Limitations of this planning task++++- No build, test, clippy, GUI, browser or benchmark was run. Compiler inventories are read from the++ 2026-10-22 audit (a historical fork revision, machine-local path patches, `ui-egui` lib/lib-test++ only) and from source inspection; integration tests and the app/web crates will reveal additional++ errors.++- The environment record reports no `DISPLAY`, no `WAYLAND_DISPLAY` and `XDG_SESSION_TYPE=tty`, but++ an i915 render node is present (`/dev/dri/renderD128` readable/writable). This supports a++ headless wgpu adapter run only; it does not qualify native presentation, Wayland, PRIMARY or++ physical-GPU performance.++- The cmap/glyph findings are a read-only inspection of the bundled font files, not a rendered++ proof; the implementation must run the coverage test.++- Upstream issue claims (`#8731`, `#8736`, `#8763`, `#8748`, `#8631`, `#8512`, `#8428`, `#8657`,++ `#8577`) are reported by upstream authors, not measured here; the linked evidence file++ (`/home/codex/work/ssd2/task-evidence/egui037-migration-20261022/upstream-discussions.json`)++ records the snapshots. `#8764` is open/unmerged (`upstream-8764-fresh.json`), a proposal only.++- No performance number is claimed. The thresholds above are proposals to be validated by paired++ runs on recorded hardware.++- Windows and macOS behaviour, IME, native focus, file pickers and real-GPU presentation are not++ qualified by headless kittest and remain explicit gates.++- Reviewer dispositions: the review's findings on workspace version 1, the visual-harness++ coverage, the absent shared `with_accessibility_check` switch, the incomplete PRIMARY matrix,++ child-viewport freezing while hidden, the performance sample counts, the `ppm` capture point,++ dependency/lock gates, skipping `ui_gpu.rs`, and the `Id::new` grep/occurrence counts were adopted++ and are fixed above. Two review suggestions were corrected rather than adopted: `RawInput::time`++ cannot supply a logic-only clock (`run_logic` discards it; an app-owned injected clock is++ required), and freezing the admission-time DPI is wrong when the frame is captured later (the++ issued geometry + geometry epoch are bound to the image, and the returned dimensions supply the++ pixel scale). The v2 review's hidden-input accumulation, P7c/CL-2F dependency, baseline-identity,++ E21b state/serial, W27/W25 gate, accessibility-builder and anchor findings are fixed in place++ above. The review's blanket++ claim that hidden browser logic cannot run is also corrected: eframe 0.37 already falls back to++ `setTimeout` for hidden tabs; the realistic gate is the browser's clamped cadence, not a new++ worker feature. The review's Linux "no display means no X11 evidence" is narrowed to the parts++ that genuinely need a real compositor/physical GPU; Xvfb + WM + IME can qualify X11 focus,++ clipboard/PRIMARY and X11 IME behaviour.++- The pinned fork, winit, craft-libs and PR 199 can move before implementation; every plan stage++ records the exact SHAs it was reviewed against.++++++## Local implementation update — 2026-10-23++++The user clarified that reviewed plans remain local and implementation proceeds before publication. The earlier requirement to publish/land this plan first is superseded; pushes and PR publication still require explicit approval.++++Canonical `storytold/effectcraft` `main` now resolves to `f6ef1a790625657259f449f3f4f0773d7df449bb`. The owned checkout was fast-forwarded to this revision. Earlier baseline SHAs and line anchors above are retained as historical review evidence; use this new revision and its exact lockfile for current-main integration and paired measurements. The original refs remain reachable.++++Preserve queue4096/click1–512/drag<=2048 validation and refusal-without-mutation test; these limits differ from FilmCraft. Preserve chrono feature split.++++The complete static delta review and exact old/new object identities are retained in the task evidence: `canonical-diffs-refresh-20261023.json` and `overnight-consumer-review-20261023.md`. This amendment claims no new build, native GUI or performance acceptance.++++## Local implementation stage 1 — 2026-10-23++++Implemented in the owned worktree only: no commit, push, PR, release or publication; no build,++test, fmt, clippy or `cargo metadata` was run (the parent runs managed `task.py` validation and++generates the lockfile). Local dependency redirects are the parent's (unpublished) worktrees.++++**Compatibility surface**++++- `egui`/`eframe`/`egui_kittest` moved to `0.37` with explicit++ `egui` features `default_fonts` + `monochrome_emoji_fonts` and `eframe/clipboard` on the UI++ crate and desktop app. The `craft-ui` revision is unchanged (the 0.36-era pin) with a TODO:++ the reviewed CL-1 + CL-2F revision is the parent's to supply; no remote revision was invented.++- `Id::new`→`Id::unique` everywhere (603 occurrences); `Ui::id`→`Ui::scope_id`;++ `UiStack.id`→`UiStack.scope_id`; `WidgetType`→`egui::Role` (ColorButton→ColorWell,++ SelectableLabel→Button with `selected`, Other→Unknown/TreeItem); `AtomLayoutResponse`→++ `WidgetAtomResponse` with an `IdSalt` swatch id; `FontData` comparison through `bytes()`;++ `TextEdit::vertical_align`→`align(Align2::LEFT_CENTER)`; `Event::MouseWheel` gained++ `source: MouseWheelSource::Wheel` in the control channel and every test.++- Screenshots replaced `UserData`/`Event::Screenshot` token scanning with++ `craft_ui::capture::CaptureSlot`: 4 outstanding requests, 128 MiB per image and 256 MiB++ aggregate reservations from checked geometry, issuance only after 3 settled non-discarded++ passes plus 0.35 s, geometry-epoch binding (window position excluded), stale-epoch retry and++ rejection, deadlines, cancellation and late-callback release. The callback holds only the weak++ slot; files and replies are written in the tick.++- The covered/minimized refusal in `ui.screenshot` is intentionally still present: removing it++ needs a native platform run showing a pending screenshot forces a hidden paint.++++**Lifecycle**++++- `EffectcraftApp::tick` (all eframe logic callbacks, including hidden logic-only ones): engine and++ background queues, script tasks, engine events, native command inbox, close guard, window title,++ project auto-save, workspace-layout auto-save, memory watch/home-on-open, playback + audio,++ control channel, screenshot completion/issuance, and `RequestPaintWhileHidden` when a UI pass is++ needed. `EffectcraftApp::draw` (the root `Ui`): language/theme/font setup (the existing two-pass++ font warm-up), input-driven shortcuts, layout, panels, dialogs, dropped files, Video Preview,++ workspace-state observation, plus the pass geometry/epoch and the `AfterInput` acknowledgement on++ the final non-discarded pass.++- `AppClock` ( `web_time::Instant`, injectable manual clock) replaces every wall-clock or++ `ctx.input(|i| i.time)` use in the tick (auto-save, watch folder, footage reload, playback,++ control deadlines, screenshot deadlines, toast timestamps). `panels/viewer` now records its++ drawn scale and playback advances in the tick.++- One pending synthetic batch: `feed_synthetic` refuses a second batch until a UI pass applied the++ first (`mark_synthetic_applied`), a font-gated pass requeues the batch instead of dropping it,++ and `raw_input_hook` keeps the control provenance across hidden iterations.++- Web: dropped files are read in `raw_input_hook`; the persist snapshot uses the app clock.++ `RequestPaintWhileHidden` is sent on native only — the shared web fork does not carry it, so++ hidden web input/screenshots remain unqualified.++- IME: the custom viewer editor handles `ImeEvent::DeleteSurrounding` (characters) and++ `DeleteSurroundingBytes` (UTF-8 bytes, converted at char boundaries through `TextDoc`), grouped++ with the following `Commit` under one typing/undo key. Outgoing surrounding text (E21b/W27) is++ recorded as the next step at the single `IMEOutput` producer; no empty placeholder was invented.++++**Tests added (not run here)**++++- `lib.rs::lifecycle_tests`: logic-only tick records no fonts/geometry; a control command completes++ without a pass; one pending synthetic batch across repeated hidden hooks with a font-gated++ requeue and exactly one reply; geometry epoch ignores window movement and tracks resize/back;++ hidden playback advances and stops at the plan's end; workspace-layout auto-save writes on a++ hidden tick; a hidden close request opens the guard and sends `CancelClose`; screenshot++ issuance/settlement, resize retry, admission bounds + timeout release, and late-callback++ no-write/no-second-reply.++- `panels/viewer_text.rs` tests: byte-count IME deletion around an emoji, character-count deletion++ over a selection with clamping, and no-op cases.++- `theme.rs` glyph test extended to the full drawn chrome set; `ui_effect_names`/`ui_presets_folder`++ opt out of the missing-glyph panic only for their CJK/Japanese fixtures.++++**Known remaining gates**++++- Parent must generate `Cargo.lock`, supply the local patch config and the reviewed craft-ui++ revision, then run the repository gates. Strict kittest accessibility is still on: stock++ `TextEdit`/`DragValue`/`Slider` fields without a label or hint will be reported (no global or++ per-builder opt-out was added).++- `ui_gpu`/native GUI, hidden-window screenshots (the refusal above), Wayland/X11 IME and PRIMARY,++ Windows/macOS rows, and every performance row remain unmeasured here.diff --cc packaging/env.shindex 68b57026f,68b57026f..1e6e2cde1--- a/packaging/env.sh+++ b/packaging/env.sh@@@ -49,7 -49,7 +49,7 @@@ warn()# Copy licence and readme files that exist into a package directory.copy_docs() {local dest="$1" f-- for f in README.md LICENSE LICENSE-MIT LICENSE-APACHE COPYRIGHT; do++ for f in README.md LICENSE LICENSE-MIT LICENSE-APACHE COPYRIGHT NOTICE; doif [[ -f "$ROOT/$f" ]]; then cp "$ROOT/$f" "$dest/"; fidonereturndiff --cc packaging/linux/flatpak/ai.storyteller.effectcraft.ymlindex be9f898ed,be9f898ed..7dd7a8d68--- a/packaging/linux/flatpak/ai.storyteller.effectcraft.yml+++ b/packaging/linux/flatpak/ai.storyteller.effectcraft.yml@@@ -55,6 -55,6 +55,7 @@@ modulesbuild-commands:- cargo --offline build --release --locked -p effectcraft -p effectcraft-cli- install -Dm755 target/release/effectcraft /app/bin/effectcraft++ - install -Dm644 NOTICE /app/share/doc/effectcraft/NOTICE- install -Dm755 target/release/effectcraft-cli /app/bin/effectcraft-cli- install -Dm644 packaging/linux/ai.storyteller.effectcraft.desktop /app/share/applications/ai.storyteller.effectcraft.desktop- install -Dm644 packaging/linux/ai.storyteller.effectcraft.mime.xml /app/share/mime/packages/ai.storyteller.effectcraft.xmldiff --cc packaging/linux/package.shindex a9349ca4f,a9349ca4f..a67a00d4a--- a/packaging/linux/package.sh+++ b/packaging/linux/package.sh@@@ -125,7 -125,7 +125,6 @@@ if has appimage; thefiAPPDIR="$WORK/EffectCraft.AppDir"cp -R "$STAGE" "$APPDIR"-- mv "$APPDIR/usr/share/doc" "$WORK/doc-unused"ln -s usr/bin/effectcraft "$APPDIR/AppRun"cp "$HERE/$APP_ID.desktop" "$APPDIR/$APP_ID.desktop"cp "$ROOT/assets/app-icon/hicolor/256x256/apps/$APP_ID.png" "$APPDIR/$APP_ID.png"diff --cc packaging/macos/package.shindex 95827b224,95827b224..6afc9a328--- a/packaging/macos/package.sh+++ b/packaging/macos/package.sh@@@ -103,6 -103,6 +103,8 @@@ mkdir -p "$APP/Contents/MacOS" "$APP/Co# Executable and icon carry the display name (CFBundleExecutable / CFBundleIconFile).cp "$WORK/bin/effectcraft" "$APP/Contents/MacOS/EffectCraft"cp "$ROOT/assets/app-icon/effectcraft.icns" "$APP/Contents/Resources/EffectCraft.icns"++# Required embedded-font notices are independent of optional font inputs.++cp "$ROOT/NOTICE" "$APP/Contents/Resources/NOTICE"sed -e "s/@VERSION@/$VERSION/g" -e "s/@SHORT_VERSION@/$SHORT_VERSION/g" \-e "s/@BUILD_SHA@/${EFFECTCRAFT_BUILD_SHA:-unknown}/g" \"$HERE/Info.plist.in" >"$APP/Contents/Info.plist"diff --cc packaging/windows/effectcraft.wxsindex 00b0c5d6a,00b0c5d6a..cc1df639b--- a/packaging/windows/effectcraft.wxs+++ b/packaging/windows/effectcraft.wxs@@@ -73,6 -73,6 +73,9 @@@<Fragment><ComponentGroup Id="EffectcraftFiles" Directory="INSTALLFOLDER">++ <Component Id="EffectcraftNotice">++ <File Id="EffectcraftNoticeFile" Source="$(var.BinDir)\NOTICE" KeyPath="yes" />++ </Component><Component Id="EffectcraftApp" Guid="BA719860-95FE-4154-B265-47006B8E9083"><File Id="EffectcraftExe" Source="$(var.BinDir)\effectcraft.exe" KeyPath="yes"><Shortcut Id="StartMenuShortcut" Directory="ProgramMenuFolder" Name="EffectCraft"diff --cc packaging/windows/package.ps1index 7654fe1f3,7654fe1f3..edbb163c0--- a/packaging/windows/package.ps1+++ b/packaging/windows/package.ps1@@@ -90,6 -90,6 +90,9 @@@ Copy-Item (Join-Path $Bin 'effectcraft.& (Join-Path $PSScriptRoot 'sign.ps1') (Join-Path $Stage 'effectcraft.exe') (Join-Path $Stage 'effectcraft-cli.exe')++# Required embedded-font notices ship independently of optional font inputs.++Copy-Item -LiteralPath (Join-Path $Root 'NOTICE') -Destination $Stage++# ---- MSI ---------------------------------------------------------------------------------------$Msi = Join-Path $Dist "effectcraft-$Version-windows-$Arch.msi"Invoke-Native 'wix build' {@@@ -106,7 -106,7 +109,7 @@@ $Portable = Join-Path $TargetDir "windoRemove-Item -Recurse -Force $Portable -ErrorAction SilentlyContinueNew-Item -ItemType Directory -Force -Path $Portable | Out-NullCopy-Item (Join-Path $Stage '*.exe') $Portable--foreach ($f in 'README.md', 'LICENSE', 'LICENSE-MIT', 'LICENSE-APACHE') {++foreach ($f in 'README.md', 'LICENSE', 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE') {$p = Join-Path $Root $fif (Test-Path $p) { Copy-Item $p $Portable }}